diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:47:44 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:47:44 +0200 |
commit | 941020379b1ea1ec7c564c21e68ea1674cda7683 (patch) | |
tree | 40fcaf109d6d585bcdc0faf7ea6c0812b3cc9a39 /vcl | |
parent | 0692507dcc62e94c7af88388961db1d7d12d6dbd (diff) | |
parent | 0d2916e03ea51529e15995830a1a8c36bd72e442 (diff) |
Merge branch 'master' into feature/gnumake4
Conflicts:
basebmp/prj/d.lst
basebmp/test/basictest.cxx
basebmp/test/makefile.mk
basegfx/inc/basegfx/basegfxdllapi.h
basegfx/inc/basegfx/tools/debugplotter.hxx
basegfx/inc/basegfx/tuple/b2ituple.hxx
basegfx/prj/d.lst
basegfx/source/numeric/makefile.mk
basegfx/source/polygon/makefile.mk
basegfx/source/range/makefile.mk
basegfx/source/raster/makefile.mk
basegfx/source/tuple/makefile.mk
basegfx/source/vector/makefile.mk
basegfx/test/basegfx1d.cxx
basegfx/test/makefile.mk
basegfx/util/makefile.mk
canvas/Library_canvasfactory.mk
canvas/Module_canvas.mk
canvas/prj/build.lst
canvas/prj/d.lst
canvas/source/cairo/cairo_canvashelper_texturefill.cxx
canvas/source/cairo/makefile.mk
canvas/source/tools/makefile.mk
comphelper/qa/string/makefile.mk
cppcanvas/Module_cppcanvas.mk
cppcanvas/inc/cppcanvas/cppcanvasdllapi.h
cppcanvas/prj/build.lst
cppcanvas/prj/d.lst
cppcanvas/source/mtfrenderer/makefile.mk
cppcanvas/util/makefile.mk
i18npool/source/search/makefile.mk
regexp/Library_regexp.mk
regexp/prj/d.lst
sax/CppunitTest_sax.mk
sax/Library_sax.mk
sax/prj/d.lst
sax/qa/cppunit/test_converter.cxx
sax/source/expatwrap/attrlistimpl.hxx
sax/util/makefile.mk
svtools/Library_svt.mk
tools/Executable_sspretty.mk
ucbhelper/prj/d.lst
ucbhelper/source/provider/configureucb.cxx
ucbhelper/source/provider/provconf.cxx
ucbhelper/util/makefile.mk
unotools/Library_utl.mk
unotools/Module_unotools.mk
unotools/Package_inc.mk
unotools/prj/build.lst
vcl/Library_desktop_detector.mk
vcl/Library_vcl.mk
vcl/Library_vclplug_gtk.mk
vcl/aqua/source/gdi/salprn.cxx
vcl/inc/aqua/saldata.hxx
vcl/unx/generic/gdi/salgdi3.cxx
Diffstat (limited to 'vcl')
1047 files changed, 13865 insertions, 30131 deletions
diff --git a/vcl/AllLangResTarget_vcl.mk b/vcl/AllLangResTarget_vcl.mk index 9a3453af2810..307f8ae27754 100644 --- a/vcl/AllLangResTarget_vcl.mk +++ b/vcl/AllLangResTarget_vcl.mk @@ -37,7 +37,7 @@ $(eval $(call gb_SrsTarget_SrsTarget,vcl/source/src)) $(eval $(call gb_SrsTarget_set_include,vcl/source/src,\ $$(INCLUDE) \ - -I$(SRCDIR)/vcl/inc \ + -I$(realpath $(SRCDIR)/vcl/inc) \ )) $(eval $(call gb_SrsTarget_add_files,vcl/source/src,\ diff --git a/vcl/Library_desktop_detector.mk b/vcl/Library_desktop_detector.mk index 33ef2145e03b..8d4654c4e0b6 100644 --- a/vcl/Library_desktop_detector.mk +++ b/vcl/Library_desktop_detector.mk @@ -33,11 +33,10 @@ $(eval $(call gb_Library_add_precompiled_header,desktop_detector,$(SRCDIR)/vcl/i $(eval $(call gb_Library_set_include,desktop_detector,\ $$(INCLUDE) \ - -I$(SRCDIR)/vcl/inc \ - -I$(SRCDIR)/vcl/inc/pch \ + -I$(realpath $(SRCDIR)/vcl/inc) \ + -I$(realpath $(SRCDIR)/vcl/inc/pch) \ -I$(SRCDIR)/solenv/inc \ -I$(OUTDIR)/inc/offuh \ - -I$(OUTDIR)/inc/stl \ -I$(OUTDIR)/inc \ )) @@ -58,10 +57,8 @@ $(eval $(call gb_Library_add_linked_libs,desktop_detector,\ i18npaper \ i18nutil \ jvmaccess \ - stl \ cppu \ sal \ - vos3 \ X11 \ Xext \ SM \ diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index a2f430eb39de..db96844e1de9 100755..100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -28,23 +28,24 @@ $(eval $(call gb_Library_Library,vcl)) ifeq ($(OS),MACOSX) -$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.macosx)) +$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.macosx,vcl/vcl)) else ifeq ($(OS),WNT) -$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.windows)) +$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.windows,vcl/vcl)) else -$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.unx)) +$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.unx,vcl/vcl)) endif $(eval $(call gb_Library_add_package_headers,vcl,vcl_inc)) +$(eval $(call gb_Library_add_package_headers,vcl,vcl_afmhash)) $(eval $(call gb_Library_set_include,vcl,\ $$(INCLUDE) \ - -I$(SRCDIR)/vcl/inc \ - -I$(SRCDIR)/vcl/inc/pch \ + -I$(realpath $(SRCDIR)/vcl/inc) \ + -I$(realpath $(SRCDIR)/vcl/inc/pch) \ -I$(SRCDIR)/solenv/inc \ -I$(OUTDIR)/inc/offuh \ - -I$(OUTDIR)/inc/stl \ -I$(OUTDIR)/inc \ + -I$(WORKDIR)/CustomTarget/vcl/unx/generic/fontmanager \ )) ifeq ($(GUIBASE),unx) $(eval $(call gb_Library_set_include,vcl,\ @@ -71,10 +72,8 @@ $(eval $(call gb_Library_add_linked_libs,vcl,\ i18npaper \ i18nutil \ jvmaccess \ - stl \ cppu \ sal \ - vos3 \ $(gb_STDLIBS) \ )) @@ -233,6 +232,7 @@ $(eval $(call gb_Library_add_cobjects,vcl,\ vcl/source/fontsubset/list \ )) $(eval $(call gb_Library_add_exception_objects,vcl,\ + vcl/source/app/brand \ vcl/source/app/dbggui \ vcl/source/app/dndhelp \ vcl/source/app/help \ @@ -241,6 +241,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/app/salvtables \ vcl/source/app/session \ vcl/source/app/settings \ + vcl/source/app/solarmutex \ vcl/source/app/sound \ vcl/source/app/stdtext \ vcl/source/app/svapp \ @@ -418,18 +419,20 @@ $(eval $(call gb_Library_add_defs,vcl,\ -DENABLE_GRAPHITE \ )) $(eval $(call gb_Library_add_exception_objects,vcl,\ - vcl/source/glyphs/graphite_cache \ vcl/source/glyphs/graphite_features \ vcl/source/glyphs/graphite_layout \ - vcl/source/glyphs/graphite_textsrc \ )) # handle X11 platforms, which have additional files and possibly system graphite ifeq ($(GUIBASE),unx) $(eval $(call gb_Library_add_exception_objects,vcl,\ - vcl/source/glyphs/graphite_adaptors \ vcl/source/glyphs/graphite_serverfont \ )) +else +$(eval $(call gb_Library_add_linked_libs,vcl,\ + graphite2_off \ + version \ +)) endif $(call gb_Library_use_external,vcl,graphite) diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk index 4eec27640da4..95428ae53853 100755..100644 --- a/vcl/Library_vclplug_gen.mk +++ b/vcl/Library_vclplug_gen.mk @@ -33,7 +33,6 @@ $(eval $(call gb_Library_set_include,vclplug_gen,\ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ -I$(OUTDIR)/inc/offuh \ - -I$(OUTDIR)/inc/stl \ -I$(OUTDIR)/inc \ )) @@ -50,10 +49,8 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_gen,\ i18npaper \ i18nutil \ jvmaccess \ - stl \ cppu \ sal \ - vos3 \ X11 \ Xext \ SM \ diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk index 039ab3434d84..cf4ac762022c 100755..100644 --- a/vcl/Library_vclplug_gtk.mk +++ b/vcl/Library_vclplug_gtk.mk @@ -33,7 +33,6 @@ $(eval $(call gb_Library_set_include,vclplug_gtk,\ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ -I$(OUTDIR)/inc/offuh \ - -I$(OUTDIR)/inc/stl \ -I$(OUTDIR)/inc \ )) @@ -48,6 +47,10 @@ $(eval $(call gb_Library_add_defs,vclplug_gtk,\ )) ifneq ($(ENABLE_DBUS),) +$(eval $(call gb_Library_set_include,vclplug_gtk,\ + $$(INCLUDE) \ + $(filter -I%,$(shell pkg-config --cflags dbus-glib-1)) \ +)) $(eval $(call gb_Library_add_defs,vclplug_gtk,\ -DENABLE_DBUS \ )) @@ -75,10 +78,8 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_gtk,\ i18npaper \ i18nutil \ jvmaccess \ - stl \ cppu \ sal \ - vos3 \ X11 \ Xext \ SM \ diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk new file mode 100644 index 000000000000..83fb8306468d --- /dev/null +++ b/vcl/Library_vclplug_gtk3.mk @@ -0,0 +1,128 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Library_Library,vclplug_gtk3)) + +$(eval $(call gb_Library_set_include,vclplug_gtk3,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ + -I$(SRCDIR)/vcl/inc/pch \ + -I$(SRCDIR)/solenv/inc \ + -I$(OUTDIR)/inc/offuh \ + -I$(OUTDIR)/inc \ +)) + +$(eval $(call gb_Library_set_cxxflags,vclplug_gtk3,\ + $$(CXXFLAGS) \ + $$(GTK3_CFLAGS) \ +)) + +$(eval $(call gb_Library_set_defs,vclplug_gtk3,\ + $$(DEFS) \ + -DVCLPLUG_GTK_IMPLEMENTATION \ + -DVERSION=\"$(UPD)$(LAST_MINOR)\" \ +)) + +ifneq ($(ENABLE_DBUS),) +$(eval $(call gb_Library_set_include,vclplug_gtk3,\ + $$(INCLUDE) \ + $(filter -I%,$(shell pkg-config --cflags dbus-glib-1)) \ +)) +$(eval $(call gb_Library_set_defs,vclplug_gtk3,\ + $$(DEFS) \ + -DENABLE_DBUS \ +)) +$(eval $(call gb_Library_set_ldflags,vclplug_gtk3,\ + $$(LDFLAGS) \ + $(shell pkg-config --libs dbus-glib-1)\ +)) +endif + +$(eval $(call gb_Library_set_ldflags,vclplug_gtk3,\ + $$(LDFLAGS) \ + $$(GTK3_LIBS) \ + $$(GTHREAD_LIBS) \ +)) + +$(eval $(call gb_Library_add_linked_libs,vclplug_gtk3,\ + vclplug_gen \ + vcl \ + tl \ + utl \ + sot \ + ucbhelper \ + basegfx \ + comphelper \ + cppuhelper \ + icuuc \ + icule \ + i18nisolang1 \ + i18npaper \ + i18nutil \ + jvmaccess \ + cppu \ + sal \ + X11 \ + Xext \ + SM \ + ICE \ + $(gb_STDLIBS) \ +)) + +$(eval $(call gb_Library_add_exception_objects,vclplug_gtk3,\ + vcl/unx/gtk3/a11y/gtk3atkaction \ + vcl/unx/gtk3/a11y/gtk3atkbridge \ + vcl/unx/gtk3/a11y/gtk3atkcomponent \ + vcl/unx/gtk3/a11y/gtk3atkeditabletext \ + vcl/unx/gtk3/a11y/gtk3atkfactory \ + vcl/unx/gtk3/a11y/gtk3atkhypertext \ + vcl/unx/gtk3/a11y/gtk3atkimage \ + vcl/unx/gtk3/a11y/gtk3atklistener \ + vcl/unx/gtk3/a11y/gtk3atkregistry \ + vcl/unx/gtk3/a11y/gtk3atkselection \ + vcl/unx/gtk3/a11y/gtk3atktable \ + vcl/unx/gtk3/a11y/gtk3atktextattributes \ + vcl/unx/gtk3/a11y/gtk3atktext \ + vcl/unx/gtk3/a11y/gtk3atkutil \ + vcl/unx/gtk3/a11y/gtk3atkvalue \ + vcl/unx/gtk3/a11y/gtk3atkwindow \ + vcl/unx/gtk3/a11y/gtk3atkwrapper \ + vcl/unx/gtk3/app/gtk3gtkdata \ + vcl/unx/gtk3/app/gtk3gtkinst \ + vcl/unx/gtk3/app/gtk3gtksys \ + vcl/unx/gtk3/window/gtk3gtkframe \ + vcl/unx/gtk3/window/gtk3gtkobject \ +)) + +ifeq ($(OS),LINUX) +$(eval $(call gb_Library_add_linked_libs,vclplug_gtk3,\ + dl \ + m \ + pthread \ +)) +endif +# vim: set noet sw=4 ts=4: diff --git a/vcl/Library_vclplug_kde.mk b/vcl/Library_vclplug_kde.mk index b751630353cc..ddc429180528 100755..100644 --- a/vcl/Library_vclplug_kde.mk +++ b/vcl/Library_vclplug_kde.mk @@ -33,7 +33,6 @@ $(eval $(call gb_Library_set_include,vclplug_kde,\ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ -I$(OUTDIR)/inc/offuh \ - -I$(OUTDIR)/inc/stl \ -I$(OUTDIR)/inc \ )) @@ -64,10 +63,8 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_kde,\ i18npaper \ i18nutil \ jvmaccess \ - stl \ cppu \ sal \ - vos3 \ X11 \ Xext \ SM \ diff --git a/vcl/Library_vclplug_kde4.mk b/vcl/Library_vclplug_kde4.mk index 49626f4f70a3..25695d9d5a33 100755..100644 --- a/vcl/Library_vclplug_kde4.mk +++ b/vcl/Library_vclplug_kde4.mk @@ -27,14 +27,16 @@ $(eval $(call gb_Library_Library,vclplug_kde4)) +$(eval $(call gb_Library_add_package_headers,vcl,vcl_kde4moc)) + $(eval $(call gb_Library_set_include,vclplug_kde4,\ $$(INCLUDE) \ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ -I$(OUTDIR)/inc/offuh \ - -I$(OUTDIR)/inc/stl \ -I$(OUTDIR)/inc \ + -I$(WORKDIR)/CustomTarget/vcl/unx/kde4 \ )) $(eval $(call gb_Library_set_include,vclplug_kde4,\ @@ -64,10 +66,8 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_kde4,\ i18npaper \ i18nutil \ jvmaccess \ - stl \ cppu \ sal \ - vos3 \ X11 \ Xext \ SM \ diff --git a/vcl/Library_vclplug_svp.mk b/vcl/Library_vclplug_svp.mk index e68d6c289e48..7df8f4790a17 100755..100644 --- a/vcl/Library_vclplug_svp.mk +++ b/vcl/Library_vclplug_svp.mk @@ -33,7 +33,6 @@ $(eval $(call gb_Library_set_include,vclplug_svp,\ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ -I$(OUTDIR)/inc/offuh \ - -I$(OUTDIR)/inc/stl \ -I$(OUTDIR)/inc \ )) @@ -43,6 +42,7 @@ $(eval $(call gb_Library_add_defs,vclplug_svp,\ $(eval $(call gb_Library_add_linked_libs,vclplug_svp,\ vcl \ + vclplug_gen \ tl \ utl \ sot \ @@ -55,10 +55,8 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_svp,\ i18npaper \ i18nutil \ jvmaccess \ - stl \ cppu \ sal \ - vos3 \ X11 \ Xext \ SM \ @@ -72,12 +70,6 @@ $(call gb_Library_use_externals,vclplug_svp,\ ) $(eval $(call gb_Library_add_exception_objects,vclplug_svp,\ - vcl/unx/generic/printergfx/bitmap_gfx \ - vcl/unx/generic/printergfx/common_gfx \ - vcl/unx/generic/printergfx/glyphset \ - vcl/unx/generic/printergfx/printerjob \ - vcl/unx/generic/printergfx/psputil \ - vcl/unx/generic/printergfx/text_gfx \ vcl/unx/headless/svpbmp \ vcl/unx/headless/svpdummies \ vcl/unx/headless/svpelement \ diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 929f60988bb1..c462e4e2c02e 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -40,6 +40,7 @@ $(eval $(call gb_Module_add_targets,vcl,\ Library_vclplug_gen \ Library_vclplug_svp \ Library_desktop_detector \ + Package_afmhash \ )) ifneq ($(ENABLE_GTK),) @@ -47,6 +48,11 @@ $(eval $(call gb_Module_add_targets,vcl,\ Library_vclplug_gtk \ )) endif +ifneq ($(ENABLE_GTK3),) +$(eval $(call gb_Module_add_targets,vcl,\ + Library_vclplug_gtk3 \ +)) +endif ifneq ($(ENABLE_KDE),) $(eval $(call gb_Module_add_targets,vcl,\ Library_vclplug_kde \ @@ -55,6 +61,7 @@ endif ifneq ($(ENABLE_KDE4),) $(eval $(call gb_Module_add_targets,vcl,\ Library_vclplug_kde4 \ + Package_kde4moc \ )) endif endif diff --git a/vcl/Package_afmhash.mk b/vcl/Package_afmhash.mk new file mode 100644 index 000000000000..d3de8357eb93 --- /dev/null +++ b/vcl/Package_afmhash.mk @@ -0,0 +1,29 @@ +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Bjoern Michaelsen <bjoern.michaelsen@canonical.com> (Canonical Ltd.) +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Contributor(s): Jan Holesovsky <kendy@suse.cz> +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +$(eval $(call gb_Package_Package,vcl_afmhash,$(WORKDIR)/CustomTarget/vcl/unx/generic/fontmanager)) +$(eval $(call gb_Package_add_customtarget,vcl_afmhash,vcl/unx/generic/fontmanager)) + +# vim: set noet sw=4: diff --git a/vcl/Package_kde4moc.mk b/vcl/Package_kde4moc.mk new file mode 100644 index 000000000000..56d2f064515e --- /dev/null +++ b/vcl/Package_kde4moc.mk @@ -0,0 +1,29 @@ +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Caolan McNamara <caolanm@redhat.com> (Red Hat, Inc.) +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +$(eval $(call gb_Package_Package,vcl_kde4moc,$(WORKDIR)/CustomTarget/vcl/unx/kde4)) +$(eval $(call gb_Package_add_customtarget,vcl_kde4moc,vcl/unx/kde4)) + +# vim: set noet sw=4: diff --git a/vcl/Package_osx.mk b/vcl/Package_osx.mk index 414479a88fed..0d8c39503e0b 100644 --- a/vcl/Package_osx.mk +++ b/vcl/Package_osx.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite @@ -29,8 +29,7 @@ $(eval $(call gb_Package_Package,vcl_zip,)) $(eval $(call gb_Package_add_file,vcl_zip,bin/osxres.zip,$(WORKDIR)/Misc/osxres.zip)) -/$(WORKDIR)/Misc/osxres.zip: $(SRCDIR)/vcl/aqua/source/res/MainMenu.nib/*.nib $(SRCDIR)/vcl/aqua/source/res/cursors/*.png - cd $(SRCDIR)/vcl/aqua/source/res ; \ - mkdir -p $(dir $@) ; \ - zip $@ MainMenu.nib/*.nib cursors/*.png - +/$(WORKDIR)/Misc/osxres.zip: $(SRCDIR)/vcl/aqua/source/res/MainMenu.nib/*.nib $(SRCDIR)/vcl/aqua/source/res/cursors/*.png + cd $(SRCDIR)/vcl/aqua/source/res ; \ + mkdir -p $(dir $@) ; \ + zip $@ MainMenu.nib/*.nib cursors/*.png diff --git a/vcl/StaticLibrary_vclmain.mk b/vcl/StaticLibrary_vclmain.mk index ccf800b38ce6..044ce10ca40c 100755..100644 --- a/vcl/StaticLibrary_vclmain.mk +++ b/vcl/StaticLibrary_vclmain.mk @@ -29,11 +29,10 @@ $(eval $(call gb_StaticLibrary_StaticLibrary,vclmain)) $(eval $(call gb_StaticLibrary_set_include,vclmain,\ $$(INCLUDE) \ - -I$(SRCDIR)/vcl/inc \ - -I$(SRCDIR)/vcl/inc/pch \ + -I$(realpath $(SRCDIR)/vcl/inc) \ + -I$(realpath $(SRCDIR)/vcl/inc/pch) \ -I$(SRCDIR)/solenv/inc \ -I$(OUTDIR)/inc/offuh \ - -I$(OUTDIR)/inc/stl \ -I$(OUTDIR)/inc \ )) @@ -49,7 +48,7 @@ $(call gb_StaticLibrary_get_target,vclmain) : $(OUTDIR)/lib/$(1) $$(eval $$(call gb_Deliver_add_deliverable,$(OUTDIR)/lib/$(1),$(call gb_CxxObject_get_target,vcl/source/salmain/salmain))) $(OUTDIR)/lib/$(1) : $(call gb_CxxObject_get_target,vcl/source/salmain/salmain) - $$(call gb_Deliver_deliver,$$<,$$@) + $$(call gb_Deliver_deliver,$$<,$$@) endef @@ -59,4 +58,4 @@ else $(eval $(call StaticLibrary_salmain_hack,salmain.o)) endif -# vim: set noet sw=4 ts=4: +# vim: set noet sw=4: diff --git a/vcl/WinResTarget_vcl.mk b/vcl/WinResTarget_vcl.mk index 68fe30c0826c..a878f43bbd0e 100755..100644 --- a/vcl/WinResTarget_vcl.mk +++ b/vcl/WinResTarget_vcl.mk @@ -29,7 +29,7 @@ $(eval $(call gb_WinResTarget_WinResTarget,vcl/src)) $(eval $(call gb_WinResTarget_set_include,vcl/src,\ $$(INCLUDE) \ - -I$(SRCDIR)/vcl/inc \ + -I$(realpath $(SRCDIR)/vcl/inc) \ )) $(eval $(call gb_WinResTarget_add_file,vcl/src,\ diff --git a/vcl/aqua/source/a11y/aqua11yactionwrapper.h b/vcl/aqua/source/a11y/aqua11yactionwrapper.h index 94388a98e3c3..9df4fc986859 100644 --- a/vcl/aqua/source/a11y/aqua11yactionwrapper.h +++ b/vcl/aqua/source/a11y/aqua11yactionwrapper.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,5 @@ @end #endif // _SV_AQUA11ACTIONWRAPPER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.h b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.h index a1a3fbab5ce3..62ab9d7141be 100644 --- a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.h +++ b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,3 +44,5 @@ @end #endif // _SV_AQUA11COMPONENTWRAPPER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yfocuslistener.cxx b/vcl/aqua/source/a11y/aqua11yfocuslistener.cxx index 1a7c72eac9ec..61bc4d44f147 100644 --- a/vcl/aqua/source/a11y/aqua11yfocuslistener.cxx +++ b/vcl/aqua/source/a11y/aqua11yfocuslistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -117,3 +118,4 @@ AquaA11yFocusListener::release() SAL_THROW(()) return ReferenceObject::release(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yfocuslistener.hxx b/vcl/aqua/source/a11y/aqua11yfocuslistener.hxx index db114be14771..bdfc9085ad08 100644 --- a/vcl/aqua/source/a11y/aqua11yfocuslistener.hxx +++ b/vcl/aqua/source/a11y/aqua11yfocuslistener.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,8 +34,6 @@ #include "aqua/keyboardfocuslistener.hxx" #include "aqua/aquavcltypes.h" -// #include <com/sun/star/accessibility/XAccessibleContext.hpp> - class AquaA11yFocusListener : public KeyboardFocusListener, public salhelper::ReferenceObject @@ -59,4 +58,6 @@ public: virtual oslInterlockedCount SAL_CALL release() SAL_THROW(()); }; -#endif // _AQUA11YFOCUSLISTENER_HXX_
\ No newline at end of file +#endif // _AQUA11YFOCUSLISTENER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yfocustracker.cxx b/vcl/aqua/source/a11y/aqua11yfocustracker.cxx index c901eea915a6..187e715c54f7 100644 --- a/vcl/aqua/source/a11y/aqua11yfocustracker.cxx +++ b/vcl/aqua/source/a11y/aqua11yfocustracker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -277,3 +278,5 @@ void AquaA11yFocusTracker::window_got_focus(Window *pWindow) #endif } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ylistener.cxx b/vcl/aqua/source/a11y/aqua11ylistener.cxx index 36e2c7ab2220..08b56718885a 100644 --- a/vcl/aqua/source/a11y/aqua11ylistener.cxx +++ b/vcl/aqua/source/a11y/aqua11ylistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -157,3 +158,5 @@ AquaA11yEventListener::notifyEvent( const AccessibleEventObject& aEvent ) throw( if( nil != notification ) NSAccessibilityPostNotification(element, notification); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yrolehelper.h b/vcl/aqua/source/a11y/aqua11yrolehelper.h index c15c39903432..69404fa372a1 100644 --- a/vcl/aqua/source/a11y/aqua11yrolehelper.h +++ b/vcl/aqua/source/a11y/aqua11yrolehelper.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,3 +41,5 @@ @end #endif // _SV_AQUA11ROLEHELPER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yselectionwrapper.h b/vcl/aqua/source/a11y/aqua11yselectionwrapper.h index 20bb99938ef0..de78565f4c4a 100644 --- a/vcl/aqua/source/a11y/aqua11yselectionwrapper.h +++ b/vcl/aqua/source/a11y/aqua11yselectionwrapper.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,3 +42,5 @@ @end #endif // _SV_AQUA11SELECTIONWRAPPER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm index a215bf913cf1..5b8d604f3b1a 100644 --- a/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,14 +49,14 @@ using namespace ::com::sun::star::uno; for ( sal_Int32 i=0 ; i < n ; ++i ) { [ children addObject: [ AquaA11yFactory wrapperForAccessible: xAccessibleSelection -> getSelectedAccessibleChild( i ) ] ]; } - + return children; - + } catch ( Exception& e) { } } - + return nil; } @@ -84,13 +84,13 @@ using namespace ::com::sun::star::uno; Reference< XAccessibleSelection > xAccessibleSelection = [ wrapper accessibleSelection ]; try { xAccessibleSelection -> clearAccessibleSelection(); - + unsigned c = [ value count ]; for ( unsigned i = 0 ; i < c ; ++i ) { xAccessibleSelection -> selectAccessibleChild( [ [ value objectAtIndex: i ] accessibleContext ] -> getAccessibleIndexInParent() ); } } catch ( Exception& e) { - } + } } @end diff --git a/vcl/aqua/source/a11y/aqua11ytablewrapper.h b/vcl/aqua/source/a11y/aqua11ytablewrapper.h index ed70ed219b6e..0b41d48e10c6 100644 --- a/vcl/aqua/source/a11y/aqua11ytablewrapper.h +++ b/vcl/aqua/source/a11y/aqua11ytablewrapper.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,3 +43,5 @@ -(id)columnsAttribute; @end #endif // _SV_AQUA11TABLEWRAPPER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.h b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.h index 0aa271a7f1e2..a21f75e7fd5a 100644 --- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.h +++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,3 +37,5 @@ +(NSMutableAttributedString *)createAttributedStringForElement:(AquaA11yWrapper *)wrapper inOrigRange:(id)origRange; @end #endif // _SV_AQUA11TEXTATTRIBUTESWRAPPER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm index 948e0dfa95aa..2122f56e9565 100644 --- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm @@ -134,18 +134,18 @@ using namespace ::rtl; +(void)applyAttributesFrom:(Sequence < PropertyValue >)attributes toString:(NSMutableAttributedString *)string forRange:(NSRange)range storeDefaultsTo:(AquaA11yWrapper *)wrapperStore getDefaultsFrom:(AquaA11yWrapper *)wrapper { NSAutoreleasePool * pool = [ [ NSAutoreleasePool alloc ] init ]; // constants - static const OUString attrUnderline = OUString::createFromAscii("CharUnderline"); - static const OUString attrBold = OUString::createFromAscii("CharWeight"); - static const OUString attrFontname = OUString::createFromAscii("CharFontName"); - static const OUString attrItalic = OUString::createFromAscii("CharPosture"); - static const OUString attrHeight = OUString::createFromAscii("CharHeight"); - static const OUString attrStrikethrough = OUString::createFromAscii("CharStrikeout"); - static const OUString attrShadow = OUString::createFromAscii("CharShadowed"); - static const OUString attrUnderlineColor = OUString::createFromAscii("CharUnderlineColor"); - static const OUString attrUnderlineHasColor = OUString::createFromAscii("CharUnderlineHasColor"); - static const OUString attrForegroundColor = OUString::createFromAscii("CharColor"); - static const OUString attrBackgroundColor = OUString::createFromAscii("CharBackColor"); - static const OUString attrSuperscript = OUString::createFromAscii("CharEscapement"); + static const OUString attrUnderline(RTL_CONSTASCII_USTRINGPARAM("CharUnderline")); + static const OUString attrBold(RTL_CONSTASCII_USTRINGPARAM("CharWeight")); + static const OUString attrFontname(RTL_CONSTASCII_USTRINGPARAM("CharFontName")); + static const OUString attrItalic(RTL_CONSTASCII_USTRINGPARAM("CharPosture")); + static const OUString attrHeight(RTL_CONSTASCII_USTRINGPARAM("CharHeight")); + static const OUString attrStrikethrough(RTL_CONSTASCII_USTRINGPARAM("CharStrikeout")); + static const OUString attrShadow(RTL_CONSTASCII_USTRINGPARAM("CharShadowed")); + static const OUString attrUnderlineColor(RTL_CONSTASCII_USTRINGPARAM("CharUnderlineColor")); + static const OUString attrUnderlineHasColor(RTL_CONSTASCII_USTRINGPARAM("CharUnderlineHasColor")); + static const OUString attrForegroundColor(RTL_CONSTASCII_USTRINGPARAM("CharColor")); + static const OUString attrBackgroundColor(RTL_CONSTASCII_USTRINGPARAM("CharBackColor")); + static const OUString attrSuperscript(RTL_CONSTASCII_USTRINGPARAM("CharEscapement")); // vars OUString fontname; int fonttraits = 0; diff --git a/vcl/aqua/source/a11y/aqua11ytextwrapper.h b/vcl/aqua/source/a11y/aqua11ytextwrapper.h index 34ba1611b7b3..dd7fa5c0411c 100644 --- a/vcl/aqua/source/a11y/aqua11ytextwrapper.h +++ b/vcl/aqua/source/a11y/aqua11ytextwrapper.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,3 +63,5 @@ @end #endif // _SV_AQUA11TEXTWRAPPER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yutil.h b/vcl/aqua/source/a11y/aqua11yutil.h index adf565f4d9bb..5007def0487b 100644 --- a/vcl/aqua/source/a11y/aqua11yutil.h +++ b/vcl/aqua/source/a11y/aqua11yutil.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,4 +37,5 @@ +(::com::sun::star::awt::Point)nsPointToVclPoint:(NSValue *)nsPoint; @end -#endif // _SV_AQUA11YUTIL_H
\ No newline at end of file +#endif // _SV_AQUA11YUTIL_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yvaluewrapper.h b/vcl/aqua/source/a11y/aqua11yvaluewrapper.h index 35573f855549..517a3014d565 100644 --- a/vcl/aqua/source/a11y/aqua11yvaluewrapper.h +++ b/vcl/aqua/source/a11y/aqua11yvaluewrapper.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,3 +45,5 @@ @end #endif // _SV_AQUA11VALUEWRAPPER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperbutton.h b/vcl/aqua/source/a11y/aqua11ywrapperbutton.h index 78c54e2c35ea..e4af22081106 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperbutton.h +++ b/vcl/aqua/source/a11y/aqua11ywrapperbutton.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,5 @@ @end #endif // _SV_AQUA11WRAPPERBUTTON_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappercheckbox.h b/vcl/aqua/source/a11y/aqua11ywrappercheckbox.h index e1016a6fe551..9c2580c19f31 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappercheckbox.h +++ b/vcl/aqua/source/a11y/aqua11ywrappercheckbox.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,5 @@ @end #endif // _SV_AQUA11WRAPPERCHECKOBOX_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappercombobox.h b/vcl/aqua/source/a11y/aqua11ywrappercombobox.h index c9b71585aea3..bdcff4a981d6 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappercombobox.h +++ b/vcl/aqua/source/a11y/aqua11ywrappercombobox.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,3 +49,5 @@ @end #endif // _SV_AQUA11WRAPPERCOMBOBOX_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappergroup.h b/vcl/aqua/source/a11y/aqua11ywrappergroup.h index bdbfb6e6b264..e53676d531ed 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappergroup.h +++ b/vcl/aqua/source/a11y/aqua11ywrappergroup.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,3 +39,5 @@ @end #endif // _SV_AQUA11WRAPPERGROUP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperlist.h b/vcl/aqua/source/a11y/aqua11ywrapperlist.h index db9bf7511af6..367795ff8d16 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperlist.h +++ b/vcl/aqua/source/a11y/aqua11ywrapperlist.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,3 +38,5 @@ @end #endif // _SV_AQUA11WRAPPERLIST_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.h b/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.h index 276f1c162e8c..1494e7dfe0b6 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.h +++ b/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,5 @@ @end #endif // _SV_AQUA11WRAPPERRADIOGROUP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.h b/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.h index 4c138372e27e..f6c05b955744 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.h +++ b/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,3 +38,5 @@ @end #endif // _SV_AQUA11WRAPPERRADIOGROUP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperrow.h b/vcl/aqua/source/a11y/aqua11ywrapperrow.h index deaa4f07248f..9b649ea0698d 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperrow.h +++ b/vcl/aqua/source/a11y/aqua11ywrapperrow.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,3 +39,5 @@ @end #endif // _SV_AQUA11WRAPPERROW_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.h b/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.h index e1e37a45d36e..3d4cdd848efc 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.h +++ b/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,5 @@ @end #endif // _SV_AQUA11WRAPPERSCROLLAREA_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.h b/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.h index df57418803fa..d589da51b153 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.h +++ b/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,3 +38,5 @@ @end #endif // _SV_AQUA11WRAPPERSCROLLBAR_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappersplitter.h b/vcl/aqua/source/a11y/aqua11ywrappersplitter.h index a114e6fb7a74..be6e99f8f3c8 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappersplitter.h +++ b/vcl/aqua/source/a11y/aqua11ywrappersplitter.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,3 +38,5 @@ @end #endif // _SV_AQUA11WRAPPERSPLITTER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperstatictext.h b/vcl/aqua/source/a11y/aqua11ywrapperstatictext.h index aef2957557d4..d7115b879e2a 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperstatictext.h +++ b/vcl/aqua/source/a11y/aqua11ywrapperstatictext.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,3 +39,5 @@ @end #endif // _SV_AQUA11WRAPPERSTATICTEXT_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappertabgroup.h b/vcl/aqua/source/a11y/aqua11ywrappertabgroup.h index 7fda77789015..54743abaa390 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappertabgroup.h +++ b/vcl/aqua/source/a11y/aqua11ywrappertabgroup.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,3 +38,5 @@ @end #endif // _SV_AQUA11WRAPPERTABGROUP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappertextarea.h b/vcl/aqua/source/a11y/aqua11ywrappertextarea.h index e47795d976b3..7a458163e400 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappertextarea.h +++ b/vcl/aqua/source/a11y/aqua11ywrappertextarea.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,3 +38,5 @@ @end #endif // _SV_AQUA11WRAPPERTEXTAREA_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappertoolbar.h b/vcl/aqua/source/a11y/aqua11ywrappertoolbar.h index 4ab947484cc4..c02195c7d0fa 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappertoolbar.h +++ b/vcl/aqua/source/a11y/aqua11ywrappertoolbar.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,3 +38,5 @@ @end #endif // _SV_AQUA11WRAPPERTOOLBAR_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/documentfocuslistener.cxx b/vcl/aqua/source/a11y/documentfocuslistener.cxx index 02a7337ce397..964f629bff51 100644 --- a/vcl/aqua/source/a11y/documentfocuslistener.cxx +++ b/vcl/aqua/source/a11y/documentfocuslistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,17 +28,11 @@ #include "documentfocuslistener.hxx" -#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEEVENTBROADCASTER_HPP_ #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> -#endif -#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_ #include <com/sun/star/accessibility/AccessibleEventId.hpp> -#endif -#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_ #include <com/sun/star/accessibility/AccessibleStateType.hpp> -#endif using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::lang; @@ -251,3 +246,5 @@ void DocumentFocusListener::detachRecursive( } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/documentfocuslistener.hxx b/vcl/aqua/source/a11y/documentfocuslistener.hxx index 3f02d3fc0ada..340219ec1967 100644 --- a/vcl/aqua/source/a11y/documentfocuslistener.hxx +++ b/vcl/aqua/source/a11y/documentfocuslistener.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -95,4 +96,5 @@ private: AquaA11yFocusTracker& m_aFocusTracker; }; -#endif // _DOCUMENTFOCUSLISTENER_HXX_
\ No newline at end of file +#endif // _DOCUMENTFOCUSLISTENER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/app/saldata.cxx b/vcl/aqua/source/app/saldata.cxx index 7b8174e16703..b6f47ab440af 100644 --- a/vcl/aqua/source/app/saldata.cxx +++ b/vcl/aqua/source/app/saldata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -111,7 +112,7 @@ void SalData::ensureThreadAutoreleasePool() } else { - DBG_ERROR( "no autorelease key" ); + OSL_FAIL( "no autorelease key" ); } } @@ -135,7 +136,7 @@ void SalData::drainThreadAutoreleasePool() } else { - DBG_ERROR( "no autorelease key" ); + OSL_FAIL( "no autorelease key" ); } } @@ -292,3 +293,5 @@ NSStatusItem* SalData::getStatusItem() } return pData->mpStatusItem; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 7a07718efaac..df0d95c12f1d 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,6 +42,7 @@ #include "vcl/svapp.hxx" #include "vcl/window.hxx" #include "vcl/timer.hxx" +#include "vcl/solarmutex.hxx" #include "aqua/saldata.hxx" #include "aqua/salinst.h" @@ -77,7 +79,7 @@ using namespace ::com::sun::star; extern sal_Bool ImplSVMain(); -static sal_Bool* gpbInit = 0; +static int* gpnInit = 0; static NSMenu* pDockMenu = nil; static bool bNoSVMain = true; static bool bLeftMain = false; @@ -114,7 +116,7 @@ class AquaDelayedSettingsChanged : public Timer void AquaSalInstance::delayedSettingsChanged( bool bInvalidate ) { - vos::OGuard aGuard( *mpSalYieldMutex ); + osl::SolarGuard aGuard( *mpSalYieldMutex ); AquaDelayedSettingsChanged* pTimer = new AquaDelayedSettingsChanged( bInvalidate ); pTimer->SetTimeout( 50 ); pTimer->Start(); @@ -211,9 +213,9 @@ static void initNSApp() [NSApp activateIgnoringOtherApps: YES]; } -sal_Bool ImplSVMainHook( sal_Bool * pbInit ) +sal_Bool ImplSVMainHook( int * pnInit ) { - gpbInit = pbInit; + gpnInit = pnInit; bNoSVMain = false; initNSApp(); @@ -248,7 +250,7 @@ sal_Bool ImplSVMainHook( sal_Bool * pbInit ) } else { - DBG_ERROR( "NSApplication initialization could not be done" ); + OSL_FAIL( "NSApplication initialization could not be done" ); } return TRUE; // indicate that ImplSVMainHook is implemented @@ -308,7 +310,7 @@ void InitSalMain() { rtl::OUString urlWorkDir; rtl_uString *sysWorkDir = NULL; - if (tools::getProcessWorkingDir(&urlWorkDir)) + if (tools::getProcessWorkingDir(urlWorkDir)) { oslFileError err2 = osl_getSystemPathFromFileURL(urlWorkDir.pData, &sysWorkDir); if (err2 == osl_File_E_None) @@ -374,27 +376,27 @@ SalYieldMutex::SalYieldMutex() void SalYieldMutex::acquire() { - OMutex::acquire(); - mnThreadId = vos::OThread::getCurrentIdentifier(); + SolarMutexObject::acquire(); + mnThreadId = osl::Thread::getCurrentIdentifier(); mnCount++; } void SalYieldMutex::release() { - if ( mnThreadId == vos::OThread::getCurrentIdentifier() ) + if ( mnThreadId == osl::Thread::getCurrentIdentifier() ) { if ( mnCount == 1 ) mnThreadId = 0; mnCount--; } - OMutex::release(); + SolarMutexObject::release(); } sal_Bool SalYieldMutex::tryToAcquire() { - if ( OMutex::tryToAcquire() ) + if ( SolarMutexObject::tryToAcquire() ) { - mnThreadId = vos::OThread::getCurrentIdentifier(); + mnThreadId = osl::Thread::getCurrentIdentifier(); mnCount++; return sal_True; } @@ -474,7 +476,7 @@ AquaSalInstance::AquaSalInstance() mpSalYieldMutex = new SalYieldMutex; mpSalYieldMutex->acquire(); ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); - maMainThread = vos::OThread::getCurrentIdentifier(); + maMainThread = osl::Thread::getCurrentIdentifier(); mbWaitingYield = false; maUserEventListMutex = osl_createMutex(); mnActivePrintJobs = 0; @@ -529,7 +531,7 @@ void AquaSalInstance::PostUserEvent( AquaSalFrame* pFrame, sal_uInt16 nType, voi // ----------------------------------------------------------------------- -vos::IMutex* AquaSalInstance::GetYieldMutex() +osl::SolarMutex* AquaSalInstance::GetYieldMutex() { return mpSalYieldMutex; } @@ -540,7 +542,7 @@ sal_uLong AquaSalInstance::ReleaseYieldMutex() { SalYieldMutex* pYieldMutex = mpSalYieldMutex; if ( pYieldMutex->GetThreadId() == - vos::OThread::getCurrentIdentifier() ) + osl::Thread::getCurrentIdentifier() ) { sal_uLong nCount = pYieldMutex->GetAcquireCount(); sal_uLong n = nCount; @@ -575,8 +577,7 @@ bool AquaSalInstance::CheckYieldMutex() bool bRet = true; SalYieldMutex* pYieldMutex = mpSalYieldMutex; - if ( pYieldMutex->GetThreadId() != - vos::OThread::getCurrentIdentifier() ) + if ( pYieldMutex->GetThreadId() != osl::Thread::getCurrentIdentifier()) { bRet = false; } @@ -588,7 +589,7 @@ bool AquaSalInstance::CheckYieldMutex() bool AquaSalInstance::isNSAppThread() const { - return vos::OThread::getCurrentIdentifier() == maMainThread; + return osl::Thread::getCurrentIdentifier() == maMainThread; } // ----------------------------------------------------------------------- @@ -605,9 +606,9 @@ void AquaSalInstance::handleAppDefinedEvent( NSEvent* pEvent ) break; case AppExecuteSVMain: { - sal_Bool bResult = ImplSVMain(); - if( gpbInit ) - *gpbInit = bResult; + int nResult = ImplSVMain(); + if( gpnInit ) + *gpnInit = nResult; [NSApp stop: NSApp]; bLeftMain = true; if( pDockMenu ) @@ -628,7 +629,7 @@ void AquaSalInstance::handleAppDefinedEvent( NSEvent* pEvent ) { if ( ((*it)->mbFullScreen == true) ) bIsFullScreenMode = true; - it++; + ++it; } switch ([pEvent data1]) @@ -685,7 +686,7 @@ void AquaSalInstance::handleAppDefinedEvent( NSEvent* pEvent ) break; default: - DBG_ERROR( "unhandled NSApplicationDefined event" ); + OSL_FAIL( "unhandled NSApplicationDefined event" ); break; }; } @@ -1340,3 +1341,5 @@ NSImage* CreateNSImage( const Image& rImage ) return pImage; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/app/salsys.cxx b/vcl/aqua/source/app/salsys.cxx index 21da319b42b7..6bda7feae1df 100644 --- a/vcl/aqua/source/app/salsys.cxx +++ b/vcl/aqua/source/app/salsys.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,7 +41,7 @@ #include "svids.hrc" -using namespace rtl; +using ::rtl::OUString; // ======================================================================= @@ -221,3 +222,5 @@ int AquaSalSystem::ShowNativeMessageBox( const String& rTitle, return nRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/app/saltimer.cxx b/vcl/aqua/source/app/saltimer.cxx index b482453704af..a3907ccb9621 100644 --- a/vcl/aqua/source/app/saltimer.cxx +++ b/vcl/aqua/source/app/saltimer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -133,3 +134,4 @@ void AquaSalTimer::Stop() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx index 98cbdcc7c5e2..5c2259ff22c6 100644 --- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,12 +47,15 @@ #include <postmac.h> using namespace ::com::sun::star::datatransfer; -using namespace rtl; using namespace ::com::sun::star::uno; using namespace com::sun::star::lang; using namespace cppu; using namespace std; +using ::rtl::OUString; +using ::rtl::OUStringToOString; +using ::rtl::OString; + namespace // private { const Type CPPUTYPE_SEQINT8 = getCppuType((Sequence<sal_Int8>*)0); @@ -738,3 +742,5 @@ NSArray* DataFlavorMapper::getAllSupportedPboardTypes() const return [array autorelease]; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.hxx b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx index 9847fcbd3987..51e29efed530 100644 --- a/vcl/aqua/source/dtrans/DataFlavorMapping.hxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -141,3 +142,5 @@ private: typedef boost::shared_ptr<DataFlavorMapper> DataFlavorMapperPtr_t; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/DragActionConversion.cxx b/vcl/aqua/source/dtrans/DragActionConversion.cxx index 06ce57e8748f..1e6880566c24 100644 --- a/vcl/aqua/source/dtrans/DragActionConversion.cxx +++ b/vcl/aqua/source/dtrans/DragActionConversion.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -90,3 +91,5 @@ sal_Int8 SystemToOfficeDragActions(unsigned int dragActions) return actions; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/DragActionConversion.hxx b/vcl/aqua/source/dtrans/DragActionConversion.hxx index 7facfef794b6..d4b12ae8dce8 100644 --- a/vcl/aqua/source/dtrans/DragActionConversion.hxx +++ b/vcl/aqua/source/dtrans/DragActionConversion.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,3 +45,5 @@ unsigned int OfficeToSystemDragActions(sal_Int8 dragActions); <type>com::sun::star::datatransfer::dnd::DNDConstants</type>. */ sal_Int8 SystemToOfficeDragActions(unsigned int dragActions); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/DragSource.cxx b/vcl/aqua/source/dtrans/DragSource.cxx index f3e73b765c94..2586c9ff6a79 100644 --- a/vcl/aqua/source/dtrans/DragSource.cxx +++ b/vcl/aqua/source/dtrans/DragSource.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,7 +48,6 @@ #include <memory> -using namespace rtl; using namespace cppu; using namespace osl; using namespace com::sun::star; @@ -62,6 +62,7 @@ using namespace com::sun::star::lang; using namespace comphelper; using namespace std; +using ::rtl::OUString; // For OOo internal D&D we provide the Transferable without NSDragPboard // interference as a shortcut @@ -381,3 +382,4 @@ Sequence< OUString > SAL_CALL DragSource::getSupportedServiceNames() throw (Runt +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/DragSource.hxx b/vcl/aqua/source/dtrans/DragSource.hxx index 017ca047b679..943c84c5036e 100644 --- a/vcl/aqua/source/dtrans/DragSource.hxx +++ b/vcl/aqua/source/dtrans/DragSource.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -140,3 +141,5 @@ public: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/DragSourceContext.cxx b/vcl/aqua/source/dtrans/DragSourceContext.cxx index cd70dc55c896..4d18379e90af 100644 --- a/vcl/aqua/source/dtrans/DragSourceContext.cxx +++ b/vcl/aqua/source/dtrans/DragSourceContext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -72,3 +73,4 @@ void SAL_CALL DragSourceContext::transferablesFlavorsChanged( ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/DragSourceContext.hxx b/vcl/aqua/source/dtrans/DragSourceContext.hxx index 5d84c165d851..276567af3f99 100644 --- a/vcl/aqua/source/dtrans/DragSourceContext.hxx +++ b/vcl/aqua/source/dtrans/DragSourceContext.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -70,3 +71,5 @@ private: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/DropTarget.cxx b/vcl/aqua/source/dtrans/DropTarget.cxx index b55a70872372..f5ac3b975491 100644 --- a/vcl/aqua/source/dtrans/DropTarget.cxx +++ b/vcl/aqua/source/dtrans/DropTarget.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,7 @@ #include <com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hpp> #include <rtl/unload.h> -#ifndef COMPHELPER_MAKESEQUENCE_HXX_INCLUDED #include "comphelper/makesequence.hxx" -#endif #include <cppuhelper/interfacecontainer.hxx> #include "aqua_clipboard.hxx" @@ -53,7 +52,6 @@ #include <aqua/salframe.h> #include <aqua/salframeview.h> -using namespace rtl; using namespace cppu; using namespace osl; using namespace com::sun::star::datatransfer; @@ -65,6 +63,8 @@ using namespace com::sun::star::uno; using namespace com::sun::star; using namespace comphelper; +using ::rtl::OUString; + OUString dropTarget_getImplementationName() { return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1")); @@ -604,3 +604,4 @@ void DropTarget::concludeDragOperation(id /*sender*/) return dropTarget_getSupportedServiceNames(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/DropTarget.hxx b/vcl/aqua/source/dtrans/DropTarget.hxx index 77e2a08c5de7..2ec1674a13df 100644 --- a/vcl/aqua/source/dtrans/DropTarget.hxx +++ b/vcl/aqua/source/dtrans/DropTarget.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,9 +34,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> -#ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDROPTARGETLISTENR_HPP_ #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> -#endif #include <com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hpp> #include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> #include <com/sun/star/datatransfer/dnd/XDropTargetDropContext.hpp> @@ -169,3 +168,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx b/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx index 3f558b0a5b4f..0bd461d81096 100644 --- a/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx +++ b/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "HtmlFmtFlt.hxx" #include <rtl/string.h> @@ -145,3 +146,5 @@ bool isHTMLFormat(const Sequence<sal_Int8>& aHtmlSequence) reinterpret_cast<const sal_Char*>(aHtmlSequence.getConstArray()), HtmlFormatStartLen) == 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/HtmlFmtFlt.hxx b/vcl/aqua/source/dtrans/HtmlFmtFlt.hxx index 49f0cc70590c..bbf2fc5164eb 100644 --- a/vcl/aqua/source/dtrans/HtmlFmtFlt.hxx +++ b/vcl/aqua/source/dtrans/HtmlFmtFlt.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef INCLUDED_HTMLFMTFLT_HXX #define INCLUDED_HTMLFMTFLT_HXX @@ -18,3 +19,5 @@ com::sun::star::uno::Sequence<sal_Int8> HTMLFormatToTextHtml(const com::sun::sta bool isHTMLFormat (const com::sun::star::uno::Sequence<sal_Int8>& aHtmlSequence); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/OSXTransferable.cxx b/vcl/aqua/source/dtrans/OSXTransferable.cxx index 2e6b327de446..040c452ec6c8 100644 --- a/vcl/aqua/source/dtrans/OSXTransferable.cxx +++ b/vcl/aqua/source/dtrans/OSXTransferable.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,13 +30,10 @@ #include "precompiled_vcl.hxx" #include <sal/types.h> -#ifndef _TRANSFERABLE_HXX_ #include "OSXTransferable.hxx" -#endif #include "DataFlavorMapping.hxx" -using namespace rtl; using namespace std; using namespace osl; using namespace cppu; @@ -45,6 +43,8 @@ using namespace com::sun::star::io; using namespace com::sun::star::lang; using namespace com::sun::star::container; +using ::rtl::OUString; + const Type CPPUTYPE_SEQINT8 = getCppuType((Sequence<sal_Int8>*)0); const Type CPPUTYPE_OUSTRING = getCppuType((OUString*)0); @@ -172,7 +172,7 @@ bool OSXTransferable::compareDataFlavors(const DataFlavor& lhs, const DataFlavor } catch( IllegalArgumentException& ) { - OSL_ENSURE( sal_False, "Invalid content type detected" ); + OSL_FAIL( "Invalid content type detected" ); return false; } @@ -213,3 +213,5 @@ bool OSXTransferable::cmpAllContentTypeParameter(const Reference<XMimeContentTyp return true; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/OSXTransferable.hxx b/vcl/aqua/source/dtrans/OSXTransferable.hxx index 6601905f1610..82e8fea57e20 100644 --- a/vcl/aqua/source/dtrans/OSXTransferable.hxx +++ b/vcl/aqua/source/dtrans/OSXTransferable.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -98,3 +99,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/PictToBmpFlt.cxx b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx index 1410fc2bd66d..3eb4fb8d49fc 100644 --- a/vcl/aqua/source/dtrans/PictToBmpFlt.cxx +++ b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OSXTransferable.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -199,3 +197,5 @@ bool BMPToImage( com::sun::star::uno::Sequence<sal_Int8>& aBmp, return bResult; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/PictToBmpFlt.hxx b/vcl/aqua/source/dtrans/PictToBmpFlt.hxx index 12a73452ad7b..cdd0c41d5f4b 100644 --- a/vcl/aqua/source/dtrans/PictToBmpFlt.hxx +++ b/vcl/aqua/source/dtrans/PictToBmpFlt.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef INCLUDED_PICTTOBMPFLT_HXX #define INCLUDED_PICTTOBMPFLT_HXX @@ -35,3 +36,5 @@ bool BMPToImage( com::sun::star::uno::Sequence<sal_Int8>& aBmp, ); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/aqua_clipboard.cxx b/vcl/aqua/source/dtrans/aqua_clipboard.cxx index 657211be5dc8..6e47df691623 100644 --- a/vcl/aqua/source/dtrans/aqua_clipboard.cxx +++ b/vcl/aqua/source/dtrans/aqua_clipboard.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,10 +45,10 @@ using namespace com::sun::star::lang; using namespace com::sun::star::uno; using namespace cppu; using namespace osl; -using namespace rtl; using namespace std; using namespace comphelper; +using ::rtl::OUString; @implementation EventListener; @@ -389,3 +390,4 @@ Sequence< OUString > SAL_CALL AquaClipboard::getSupportedServiceNames() throw( R return clipboard_getSupportedServiceNames(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/aqua_clipboard.hxx b/vcl/aqua/source/dtrans/aqua_clipboard.hxx index 8f45f50717f3..e495ee3c239e 100644 --- a/vcl/aqua/source/dtrans/aqua_clipboard.hxx +++ b/vcl/aqua/source/dtrans/aqua_clipboard.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -179,3 +180,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/dtrans/service_entry.cxx b/vcl/aqua/source/dtrans/service_entry.cxx index 327fba900508..4c4aa893ae0b 100644 --- a/vcl/aqua/source/dtrans/service_entry.cxx +++ b/vcl/aqua/source/dtrans/service_entry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -75,3 +76,4 @@ uno::Reference<XInterface> AquaSalInstance::CreateDropTarget() return uno::Reference<XInterface>(static_cast< XInitialization* >(new DropTarget()), UNO_QUERY); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm index 8786ed7d0013..2bb67dcc1940 100644 --- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -523,7 +523,7 @@ static void filterAccelerator( rtl::OUString& io_rText ) } else { - DBG_ERROR( "unsupported class" ); + OSL_FAIL( "unsupported class" ); } mpController->updateEnableState(); } @@ -555,7 +555,7 @@ static void filterAccelerator( rtl::OUString& io_rText ) } else { - DBG_ERROR( "unsupported class" ); + OSL_FAIL( "unsupported class" ); } mpController->updateEnableState(); } @@ -1033,7 +1033,7 @@ static void addEdit( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO aFieldRect.origin.y = rCurY - aFieldRect.size.height; [pFieldView setFrame: aFieldRect]; - if( rCtrlType.equalsAscii( "Range" ) ) + if( rCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Range" ) ) ) { // add a stepper control NSRect aStepFrame = { { aFieldRect.origin.x + aFieldRect.size.width + 5, @@ -1352,7 +1352,7 @@ static void addEdit( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO } else { - DBG_ERROR( "Unsupported UI option" ); + OSL_FAIL( "Unsupported UI option" ); } } diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 62e783522a88..94022b763a03 100755..100644 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -275,11 +276,7 @@ bool ATSLayout::LayoutText( ImplLayoutArgs& rArgs ) aTagSizes[0] = sizeof( nLineDirTag ); aTagValues[0] = &nLineDirTag; // set run-specific layout controls -#if 0 // why don't line-controls work as reliably as layout-controls??? - ATSUSetLineControls( maATSULayout, rArgs.mnMinCharPos, 1, aTagAttrs, aTagSizes, aTagValues ); -#else ATSUSetLayoutControls( maATSULayout, 1, aTagAttrs, aTagSizes, aTagValues ); -#endif } return true; @@ -1096,113 +1093,6 @@ void ATSLayout::InvalidateMeasurements() // ======================================================================= -#if 0 -// helper class to convert ATSUI outlines to VCL PolyPolygons -class PolyArgs -{ -public: - PolyArgs(); - ~PolyArgs(); - - void Init( PolyPolygon* pPolyPoly, long nXOffset, long nYOffset ); - void AddPoint( const Float32Point&, PolyFlags ); - void ClosePolygon(); - -private: - PolyPolygon* mpPolyPoly; - long mnXOffset, mnYOffset; - - Point* mpPointAry; - BYTE* mpFlagAry; - USHORT mnMaxPoints; - - USHORT mnPointCount; - USHORT mnPolyCount; - bool mbHasOffline; -}; - -// ----------------------------------------------------------------------- - -PolyArgs::PolyArgs() -: mpPolyPoly(NULL), - mnPointCount(0), - mnPolyCount(0), - mbHasOffline(false) -{ - mnMaxPoints = 256; - mpPointAry = new Point[ mnMaxPoints ]; - mpFlagAry = new BYTE [ mnMaxPoints ]; -} - -// ----------------------------------------------------------------------- - -PolyArgs::~PolyArgs() -{ - delete[] mpFlagAry; - delete[] mpPointAry; -} - -// ----------------------------------------------------------------------- - -void PolyArgs::Init( PolyPolygon* pPolyPoly, long nXOffset, long nYOffset ) -{ - mnXOffset = nXOffset; - mnYOffset = nYOffset; - mpPolyPoly = pPolyPoly; - - mpPolyPoly->Clear(); - mnPointCount = 0; - mnPolyCount = 0; -} - -// ----------------------------------------------------------------------- - -void PolyArgs::AddPoint( const Float32Point& rPoint, PolyFlags eFlags ) -{ - if( mnPointCount >= mnMaxPoints ) - { - // resize if needed (TODO: use STL?) - mnMaxPoints *= 4; - Point* mpNewPoints = new Point[ mnMaxPoints ]; - BYTE* mpNewFlags = new BYTE[ mnMaxPoints ]; - for( int i = 0; i < mnPointCount; ++i ) - { - mpNewPoints[ i ] = mpPointAry[ i ]; - mpNewFlags[ i ] = mpFlagAry[ i ]; - } - delete[] mpFlagAry; - delete[] mpPointAry; - mpPointAry = mpNewPoints; - mpFlagAry = mpNewFlags; - } - - // convert to pixels and add startpoint offset - int nXPos = Float32ToInt( rPoint.x ); - int nYPos = Float32ToInt( rPoint.y ); - mpPointAry[ mnPointCount ] = Point( nXPos + mnXOffset, nYPos + mnYOffset ); - // set point flags - mpFlagAry[ mnPointCount++ ]= eFlags; - mbHasOffline |= (eFlags != POLY_NORMAL); -} - -// ----------------------------------------------------------------------- - -void PolyArgs::ClosePolygon() -{ - if( !mnPolyCount++ ) - return; - - // append finished polygon - Polygon aPoly( mnPointCount, mpPointAry, (mbHasOffline ? mpFlagAry : NULL) ); - mpPolyPoly->Insert( aPoly ); - - // prepare for new polygon - mnPointCount = 0; - mbHasOffline = false; -} -#endif -// ======================================================================= - // glyph fallback is supported directly by Aqua // so methods used only by MultiSalLayout can be dummy implementated bool ATSLayout::GetGlyphOutlines( SalGraphics&, PolyPolyVector& ) const { return false; } @@ -1265,3 +1155,4 @@ SalLayout* AquaSalGraphics::GetTextLayout( ImplLayoutArgs&, int /*nFallbackLevel // ======================================================================= +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/salatsuifontutils.cxx b/vcl/aqua/source/gdi/salatsuifontutils.cxx index 61fcd78586b3..a8ded318e1e0 100644 --- a/vcl/aqua/source/gdi/salatsuifontutils.cxx +++ b/vcl/aqua/source/gdi/salatsuifontutils.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -344,75 +345,6 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF } } -#if 0 // multiple-master fonts are mostly obsolete nowadays - // if we still want to support them this should probably be done one frame higher - ItemCount nMaxInstances = 0; - rc = ATSUCountFontInstances ( nFontID, &nMaxInstances ); - for( ItemCount nInstanceIndex = 0; nInstanceIndex < nMaxInstances; ++nInstanceIndex ) - { - ItemCount nMaxVariations = 0; - rc = ATSUGetFontInstance( nFontID, nInstanceIndex, 0, NULL, NULL, &nMaxVariations ); - if( (rc == noErr) && (nMaxVariations > 0) ) - { - fprintf(stderr,"\tnMaxVariations=%d\n",(int)nMaxVariations); - typedef ::std::vector<ATSUFontVariationAxis> VariationAxisVector; - typedef ::std::vector<ATSUFontVariationValue> VariationValueVector; - VariationAxisVector aVariationAxes( nMaxVariations ); - VariationValueVector aVariationValues( nMaxVariations ); - ItemCount nVariationCount = 0; - rc = ATSUGetFontInstance ( nFontID, nInstanceIndex, nMaxVariations, - &aVariationAxes[0], &aVariationValues[0], &nVariationCount ); - fprintf(stderr,"\tnVariationCount=%d\n",(int)nVariationCount); - for( ItemCount nVariationIndex = 0; nVariationIndex < nMaxVariations; ++nVariationIndex ) - { - const char* pTag = (const char*)&aVariationAxes[nVariationIndex]; - fprintf(stderr,"\tvariation[%d] \'%c%c%c%c\' is %d\n", (int)nVariationIndex, - pTag[3],pTag[2],pTag[1],pTag[0], (int)aVariationValues[nVariationIndex]); - } - } - } -#endif - -#if 0 // selecting non-defaulted font features is not enabled yet - ByteString aFName( rDFA.maName, RTL_TEXTENCODING_UTF8 ); - ByteString aSName( rDFA.maStyleName, RTL_TEXTENCODING_UTF8 ); - ItemCount nMaxFeatures = 0; - rc = ATSUCountFontFeatureTypes( nFontID, &nMaxFeatures ); - fprintf(stderr,"Font \"%s\" \"%s\" has %d features\n",aFName.GetBuffer(),aSName.GetBuffer(),rc); - if( (rc == noErr) && (nMaxFeatures > 0) ) - { - typedef std::vector<ATSUFontFeatureType> FeatureVector; - FeatureVector aFeatureVector( nMaxFeatures ); - ItemCount nFeatureCount = 0; - rc = ATSUGetFontFeatureTypes( nFontID, nMaxFeatures, &aFeatureVector[0], &nFeatureCount ); - fprintf(stderr,"nFeatureCount=%d\n",(int)nFeatureCount); - for( ItemCount nFeatureIndex = 0; nFeatureIndex < nFeatureCount; ++nFeatureIndex ) - { - ItemCount nMaxSelectors = 0; - rc = ATSUCountFontFeatureSelectors( nFontID, aFeatureVector[nFeatureIndex], &nMaxSelectors ); - fprintf(stderr,"\tFeature[%d] = %d has %d selectors\n", - (int)nFeatureIndex, (int)aFeatureVector[nFeatureIndex], (int)nMaxSelectors ); - typedef std::vector<ATSUFontFeatureSelector> SelectorVector; - SelectorVector aSelectorVector( nMaxSelectors ); - typedef std::vector<MacOSBoolean> BooleanVector; - BooleanVector aEnabledVector( nMaxSelectors ); - BooleanVector aExclusiveVector( nMaxSelectors ); - ItemCount nSelectorCount = 0; - rc = ATSUGetFontFeatureSelectors ( nFontID, aFeatureVector[nFeatureIndex], nMaxSelectors, - &aSelectorVector[0], &aEnabledVector[0], &nSelectorCount, &aExclusiveVector[0]); - for( ItemCount nSelectorIndex = 0; nSelectorIndex < nSelectorCount; ++nSelectorIndex ) - { - FontNameCode eFontNameCode; - rc = ATSUGetFontFeatureNameCode( nFontID, aFeatureVector[nFeatureIndex], - aSelectorVector[nSelectorIndex], &eFontNameCode ); - fprintf(stderr,"\t\tselector[%d] n=%d e=%d, x=%d\n", - (int)nSelectorIndex, (int)eFontNameCode, - aEnabledVector[nSelectorIndex], aExclusiveVector[nSelectorIndex] ); - } - } - } -#endif - bool bRet = (rDFA.maName.Len() > 0); return bRet; } @@ -551,3 +483,4 @@ ImplMacFontData* SystemFontList::GetFontDataFromId( ATSUFontID nFontId ) const // ----------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/salbmp.cxx b/vcl/aqua/source/gdi/salbmp.cxx index d73b3eb25511..bfb15f0a8076 100644 --- a/vcl/aqua/source/gdi/salbmp.cxx +++ b/vcl/aqua/source/gdi/salbmp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -156,6 +157,13 @@ bool AquaSalBitmap::Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount ) // ------------------------------------------------------------------ +bool AquaSalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > /*xBitmapCanvas*/, Size& /*rSize*/, bool /*bMask*/ ) +{ + return false; +} + +// ------------------------------------------------------------------ + void AquaSalBitmap::Destroy() { DestroyContext(); @@ -260,7 +268,7 @@ bool AquaSalBitmap::AllocateUserData() case 24: mnBytesPerRow = (mnWidth << 1) + mnWidth; break; case 32: mnBytesPerRow = mnWidth << 2; break; default: - DBG_ERROR("vcl::AquaSalBitmap::AllocateUserData(), illegal bitcount!"); + OSL_FAIL("vcl::AquaSalBitmap::AllocateUserData(), illegal bitcount!"); } } @@ -271,7 +279,7 @@ bool AquaSalBitmap::AllocateUserData() } catch( const std::bad_alloc& ) { - DBG_ERROR( "vcl::AquaSalBitmap::AllocateUserData: bad alloc" ); + OSL_FAIL( "vcl::AquaSalBitmap::AllocateUserData: bad alloc" ); maUserBuffer.reset( NULL ); mnBytesPerRow = 0; } @@ -905,3 +913,5 @@ bool AquaSalBitmap::GetSystemData( BitmapSystemData& rData ) return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/salcolorutils.cxx b/vcl/aqua/source/gdi/salcolorutils.cxx index 37b6ec65a108..682537771178 100755..100644 --- a/vcl/aqua/source/gdi/salcolorutils.cxx +++ b/vcl/aqua/source/gdi/salcolorutils.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,3 +50,4 @@ void SetSalColor( const SalColor& rColor, float* pQuartzColor ) // ======================================================================= +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index f4fc437186fa..3f8829b1e72b 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #include "osl/file.hxx" #include "osl/process.h" -#include "vos/mutex.hxx" +#include "osl/mutex.hxx" #include "rtl/bootstrap.h" #include "rtl/strbuf.hxx" @@ -75,6 +76,7 @@ ImplMacFontData::ImplMacFontData( const ImplDevFontAttributes& rDFA, ATSUFontID , mbHasOs2Table( false ) , mbCmapEncodingRead( false ) , mbHasCJKSupport( false ) +, mbFontCapabilitiesRead( false ) {} // ----------------------------------------------------------------------- @@ -150,15 +152,61 @@ const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const // parse the CMAP CmapResult aCmapResult; - if( ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) ) + if( !ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) ) + return mpCharMap; + + mpCharMap = new ImplFontCharMap( aCmapResult ); + mpCharMap->AddReference(); + return mpCharMap; +} + +bool ImplMacFontData::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const +{ + // read this only once per font + if( mbFontCapabilitiesRead ) { - // create the matching charmap - mpCharMap->DeReference(); - mpCharMap = new ImplFontCharMap( aCmapResult ); - mpCharMap->AddReference(); + rFontCapabilities = maFontCapabilities; + return !rFontCapabilities.maUnicodeRange.empty() || !rFontCapabilities.maCodePageRange.empty(); } + mbFontCapabilitiesRead = true; - return mpCharMap; + // prepare to get the GSUB table raw data + ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId ); + ByteCount nBufSize = 0; + OSStatus eStatus; + eStatus = ATSFontGetTable( rFont, GetTag("GSUB"), 0, 0, NULL, &nBufSize ); + if( eStatus == noErr ) + { + // allocate a buffer for the GSUB raw data + ByteVector aBuffer( nBufSize ); + // get the GSUB raw data + ByteCount nRawLength = 0; + eStatus = ATSFontGetTable( rFont, GetTag("GSUB"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength ); + if( eStatus == noErr ) + { + const unsigned char* pGSUBTable = &aBuffer[0]; + vcl::getTTScripts(maFontCapabilities.maGSUBScriptTags, pGSUBTable, nRawLength); + } + } + eStatus = ATSFontGetTable( rFont, GetTag("OS/2"), 0, 0, NULL, &nBufSize ); + if( eStatus == noErr ) + { + // allocate a buffer for the GSUB raw data + ByteVector aBuffer( nBufSize ); + // get the OS/2 raw data + ByteCount nRawLength = 0; + eStatus = ATSFontGetTable( rFont, GetTag("OS/2"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength ); + if( eStatus == noErr ) + { + const unsigned char* pOS2Table = &aBuffer[0]; + vcl::getTTCoverage( + maFontCapabilities.maUnicodeRange, + maFontCapabilities.maCodePageRange, + pOS2Table, nRawLength); + } + } + rFontCapabilities = maFontCapabilities; + return !rFontCapabilities.maUnicodeRange.empty() || !rFontCapabilities.maCodePageRange.empty(); } // ----------------------------------------------------------------------- @@ -397,17 +445,17 @@ void AquaSalGraphics::initResolution( NSWindow* ) } else { - DBG_ERROR( "no resolution found in device description" ); + OSL_FAIL( "no resolution found in device description" ); } } else { - DBG_ERROR( "no device description" ); + OSL_FAIL( "no device description" ); } } else { - DBG_ERROR( "no screen found" ); + OSL_FAIL( "no screen found" ); } // #i107076# maintaining size-WYSIWYG-ness causes many problems for @@ -456,7 +504,7 @@ void AquaSalGraphics::copyResolution( AquaSalGraphics& rGraphics ) // ----------------------------------------------------------------------- -sal_uInt16 AquaSalGraphics::GetBitCount() +sal_uInt16 AquaSalGraphics::GetBitCount() const { sal_uInt16 nBits = mnBitmapDepth ? mnBitmapDepth : 32;//24; return nBits; @@ -1152,23 +1200,6 @@ void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY, l { ApplyXorContext(); -#if 0 // TODO: make AquaSalBitmap as fast as the alternative implementation below - SalBitmap* pBitmap = getBitmap( nSrcX, nSrcY, nSrcWidth, nSrcHeight ); - if( pBitmap ) - { - SalTwoRect aPosAry; - aPosAry.mnSrcX = 0; - aPosAry.mnSrcY = 0; - aPosAry.mnSrcWidth = nSrcWidth; - aPosAry.mnSrcHeight = nSrcHeight; - aPosAry.mnDestX = nDstX; - aPosAry.mnDestY = nDstY; - aPosAry.mnDestWidth = nSrcWidth; - aPosAry.mnDestHeight = nSrcHeight; - drawBitmap( &aPosAry, *pBitmap ); - delete pBitmap; - } -#else DBG_ASSERT( mxLayer!=NULL, "AquaSalGraphics::copyArea() for non-layered graphics" ); // in XOR mode the drawing context is redirected to the XOR mask @@ -1207,7 +1238,7 @@ void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY, l // mark the destination rectangle as updated RefreshRect( nDstX, nDstY, nSrcWidth, nSrcHeight ); -#endif + } // ----------------------------------------------------------------------- @@ -1232,7 +1263,7 @@ void AquaSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rS void AquaSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap,SalColor ) { - DBG_ERROR("not implemented for color masking!"); + OSL_FAIL("not implemented for color masking!"); drawBitmap( pPosAry, rSalBitmap ); } @@ -1780,15 +1811,16 @@ static OSStatus GgoMoveToProc( const Float32Point* pPoint, void* pData ) return eStatus; } -sal_Bool AquaSalGraphics::GetGlyphOutline( long nGlyphId, basegfx::B2DPolyPolygon& rPolyPoly ) +sal_Bool AquaSalGraphics::GetGlyphOutline( sal_GlyphId nGlyphId, basegfx::B2DPolyPolygon& rPolyPoly ) { GgoData aGgoData; aGgoData.mpPolyPoly = &rPolyPoly; rPolyPoly.clear(); ATSUStyle rATSUStyle = maATSUStyle; // TODO: handle glyph fallback when CWS pdffix02 is integrated + GlyphID aGlyphId = nGlyphId & GF_IDXMASK; OSStatus eGgoStatus = noErr; - OSStatus eStatus = ATSUGlyphGetCubicPaths( rATSUStyle, nGlyphId, + OSStatus eStatus = ATSUGlyphGetCubicPaths( rATSUStyle, aGlyphId, GgoMoveToProc, GgoLineToProc, GgoCurveToProc, GgoClosePathProc, &aGgoData, &eGgoStatus ); if( (eStatus != noErr) ) // TODO: why is (eGgoStatus!=noErr) when curves are involved? @@ -1822,10 +1854,10 @@ long AquaSalGraphics::GetGraphicsWidth() const // ----------------------------------------------------------------------- -sal_Bool AquaSalGraphics::GetGlyphBoundRect( long nGlyphId, Rectangle& rRect ) +sal_Bool AquaSalGraphics::GetGlyphBoundRect( sal_GlyphId nGlyphId, Rectangle& rRect ) { ATSUStyle rATSUStyle = maATSUStyle; // TODO: handle glyph fallback - GlyphID aGlyphId = nGlyphId; + GlyphID aGlyphId = nGlyphId & GF_IDXMASK; ATSGlyphScreenMetrics aGlyphMetrics; OSStatus eStatus = ATSUGlyphGetScreenMetrics( rATSUStyle, 1, &aGlyphId, 0, FALSE, !mbNonAntialiasedText, &aGlyphMetrics ); @@ -1997,6 +2029,14 @@ const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const return mpMacFontData->GetImplFontCharMap(); } +bool AquaSalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const +{ + if( !mpMacFontData ) + return false; + + return mpMacFontData->GetImplFontCapabilities(rFontCapabilities); +} + // ----------------------------------------------------------------------- // fake a SFNT font directory entry for a font table @@ -2375,20 +2415,7 @@ void AquaSalGraphics::GetGlyphWidths( const ImplFontData* pFontData, bool bVerti else if( pFontData->IsEmbeddable() ) { // get individual character widths -#if 0 // FIXME - rWidths.reserve( 224 ); - for( sal_Unicode i = 32; i < 256; ++i ) - { - int nCharWidth = 0; - if( ::GetCharWidth32W( mhDC, i, i, &nCharWidth ) ) - { - rUnicodeEnc[ i ] = rWidths.size(); - rWidths.push_back( nCharWidth ); - } - } -#else - DBG_ERROR("not implemented for non-subsettable fonts!\n"); -#endif + OSL_FAIL("not implemented for non-subsettable fonts!\n"); } } @@ -2682,3 +2709,4 @@ bool XorEmulation::UpdateTarget() // ======================================================================= +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx index 1652dadfbdfb..5480b630f373 100755..100644 --- a/vcl/aqua/source/gdi/salgdiutils.cxx +++ b/vcl/aqua/source/gdi/salgdiutils.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -300,3 +301,4 @@ void AquaSalGraphics::UpdateWindow( NSRect& ) // ----------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/salmathutils.cxx b/vcl/aqua/source/gdi/salmathutils.cxx index 1a0011068194..7c02a276e278 100755..100644 --- a/vcl/aqua/source/gdi/salmathutils.cxx +++ b/vcl/aqua/source/gdi/salmathutils.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -161,3 +162,4 @@ unsigned long Euclidian2Norm ( const LRectCoorVector pVec ) // ======================================================================= +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index f66c7aa2b32d..81060fd38633 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -341,10 +342,6 @@ sal_Bool AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPa break; case CTRL_TOOLTIP: // ** TO DO - #if 0 - if( nPart == PART_ENTIRE_CONTROL ) // we don't currently support the tooltip - return true; - #endif break; case CTRL_MENU_POPUP: @@ -1527,3 +1524,5 @@ sal_Bool AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart return toReturn; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index a882e82a93fe..5011564a9065 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,6 +33,7 @@ #include "vcl/print.hxx" #include "vcl/unohelp.hxx" +#include <sal/macros.h> #include "aqua/salinst.h" #include "aqua/salprn.h" @@ -49,7 +51,6 @@ #include <algorithm> -using namespace rtl; using namespace vcl; using namespace com::sun::star; using namespace com::sun::star::uno; @@ -57,6 +58,9 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; +using ::rtl::OUString; +using ::rtl::OStringToOUString; + // ======================================================================= AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) : @@ -105,12 +109,6 @@ AquaSalInfoPrinter::~AquaSalInfoPrinter() delete mpGraphics; if( mpPrintInfo ) [mpPrintInfo release]; - #if 0 - // FIXME: verify that NSPrintInfo releases the printer - // else we have a leak here - if( mpPrinter ) - [mpPrinter release]; - #endif if( mrContext ) CFRelease( mrContext ); } @@ -156,7 +154,7 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const mpGraphics->SetPrinterGraphics( i_rContext, nDPIX, nDPIY, 1.0 ); } else - DBG_ERROR( "no print info in SetupPrinterGraphics" ); + OSL_FAIL( "no print info in SetupPrinterGraphics" ); } } @@ -441,7 +439,7 @@ static Size getPageSize( vcl::PrinterController& i_rController, sal_Int32 i_nPag 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" ) ) + if( aPageParms[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PageSize" ) ) ) { awt::Size aSize; aPageParms[ nProperty].Value >>= aSize; @@ -714,7 +712,7 @@ sal_Bool AquaSalPrinter::StartJob( const XubString* /*i_pFileName*/, bool /*i_bDirect*/, ImplJobSetup* ) { - DBG_ERROR( "should never be called" ); + OSL_FAIL( "should never be called" ); return sal_False; } @@ -824,3 +822,4 @@ int AquaSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx index 8e77c67c7854..af5fa82958f9 100644 --- a/vcl/aqua/source/gdi/salvd.cxx +++ b/vcl/aqua/source/gdi/salvd.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -253,3 +254,5 @@ void AquaSalVirtualDevice::GetSize( long& rWidth, long& rHeight ) rHeight = 0; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index eec0a0ec3602..6c06339445a4 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -666,12 +667,6 @@ sal_Bool AquaSalFrame::GetWindowState( SalFrameState* pState ) SAL_FRAMESTATE_MASK_Y | SAL_FRAMESTATE_MASK_WIDTH | SAL_FRAMESTATE_MASK_HEIGHT | - #if 0 - SAL_FRAMESTATE_MASK_MAXIMIZED_X | - SAL_FRAMESTATE_MASK_MAXIMIZED_Y | - SAL_FRAMESTATE_MASK_MAXIMIZED_WIDTH | - SAL_FRAMESTATE_MASK_MAXIMIZED_HEIGHT | - #endif SAL_FRAMESTATE_MASK_STATE; NSRect aStateRect = [mpWindow frame]; @@ -729,6 +724,10 @@ void AquaSalFrame::SetScreenNumber(unsigned int nScreen) } } +void AquaSalFrame::SetApplicationID( const rtl::OUString &/*rApplicationID*/ ) +{ +} + // ----------------------------------------------------------------------- void AquaSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay ) @@ -930,7 +929,7 @@ NSCursor* AquaSalFrame::getCurrentCursor() const pCursor = GetSalData()->getCursor( mePointerStyle ); if( pCursor == nil ) { - DBG_ERROR( "unmapped cursor" ); + OSL_FAIL( "unmapped cursor" ); pCursor = [NSCursor arrowCursor]; } break; @@ -1272,6 +1271,8 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) getResolution( nDPIX, nDPIY ); aAppFont = getFont( [NSFont systemFontOfSize: 0], nDPIY, aAppFont ); + aStyleSettings.SetToolbarIconSize( nDPIY > 160 ? STYLE_TOOLBAR_ICONSIZE_LARGE : STYLE_TOOLBAR_ICONSIZE_SMALL ); + // TODO: better mapping of aqua<->ooo font settings aStyleSettings.SetAppFont( aAppFont ); aStyleSettings.SetHelpFont( aAppFont ); @@ -1325,7 +1326,9 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetScrollBarSize( static_cast<long int>([NSScroller scrollerWidth]) ); // images in menus false for MacOSX - aStyleSettings.SetUseImagesInMenus( false ); + aStyleSettings.SetPreferredUseImagesInMenus( false ); + aStyleSettings.SetHideDisabledMenuItems( sal_True ); + aStyleSettings.SetAcceleratorsInContextMenus( sal_False ); rSettings.SetStyleSettings( aStyleSettings ); @@ -1550,6 +1553,17 @@ SalPointerState AquaSalFrame::GetPointerState() return state; } +SalFrame::SalIndicatorState AquaSalFrame::GetIndicatorState() +{ + SalIndicatorState aState; + aState.mnState = 0; + return aState; +} + +void AquaSalFrame::SimulateKeyPress( sal_uInt16 /*nKeyCode*/ ) +{ +} + bool AquaSalFrame::SetPluginParent( SystemParentData* ) { // plugin parent may be killed unexpectedly by @@ -1790,3 +1804,4 @@ void AquaSalFrame::EndSetClipRegion() } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index dd2deefdeeaa..ade5594ec667 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -29,6 +29,7 @@ #include "precompiled_vcl.hxx" #include <sal/alloca.h> +#include <sal/macros.h> #include "vcl/window.hxx" #include "vcl/svapp.hxx" @@ -106,7 +107,7 @@ static sal_uInt16 ImplMapCharCode( sal_Unicode aCode ) }; sal_uInt16 nKeyCode = 0; - if( aCode < sizeof( aKeyCodeMap) / sizeof( aKeyCodeMap[0] ) ) + if( aCode < SAL_N_ELEMENTS( aKeyCodeMap) ) nKeyCode = aKeyCodeMap[ aCode ]; else if( aCode >= 0xf700 && aCode < 0xf780 ) nKeyCode = aFunctionKeyCodeMap[ aCode - 0xf700 ]; @@ -169,7 +170,7 @@ static AquaSalFrame* getMouseContainerFrame() { if( GetSalData() && GetSalData()->mpFirstInstance ) { - vos::IMutex* pMutex = GetSalData()->mpFirstInstance->GetYieldMutex(); + osl::SolarMutex* pMutex = GetSalData()->mpFirstInstance->GetYieldMutex(); if( pMutex ) { pMutex->acquire(); @@ -440,7 +441,7 @@ static AquaSalFrame* getMouseContainerFrame() return mpFrame ? (mpFrame->getClipPath() != 0 ? NO : YES) : YES; } -// helper class similar to a vos::OGuard for the SalYieldMutex +// helper class similar to a osl::SolarGuard for the SalYieldMutex // the difference is that it only does tryToAcquire instead of aquire // so dreaded deadlocks like #i93512# are prevented class TryGuard @@ -918,7 +919,7 @@ private: // Caution: should the table grow to more than 5 or 6 entries, // we must consider moving it to a kind of hash map - const unsigned int nExceptions = sizeof( aExceptionalKeys ) / sizeof( aExceptionalKeys[0] ); + const unsigned int nExceptions = SAL_N_ELEMENTS( aExceptionalKeys ); for( unsigned int i = 0; i < nExceptions; i++ ) { if( nKeyCode == aExceptionalKeys[i].nKeyCode && diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index c237b10f1512..ef76f4cf6e61 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -562,7 +563,7 @@ void AquaSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) maItems.insert( maItems.begin() + nPos, pAquaSalMenuItem ); else { - DBG_ERROR( "invalid item index in insert" ); + OSL_FAIL( "invalid item index in insert" ); return; } @@ -585,7 +586,7 @@ void AquaSalMenu::RemoveItem( unsigned nPos ) } else { - DBG_ERROR( "invalid item index in remove" ); + OSL_FAIL( "invalid item index in remove" ); return; } @@ -808,7 +809,7 @@ void AquaSalMenu::statusLayout() if( [pView isMemberOfClass: [OOStatusItemView class]] ) // well of course it is [(OOStatusItemView*)pView layout]; else - DBG_ERROR( "someone stole our status view" ); + OSL_FAIL( "someone stole our status view" ); } } @@ -965,3 +966,4 @@ AquaSalMenuItem::~AquaSalMenuItem() // ------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/window/salnsmenu.mm b/vcl/aqua/source/window/salnsmenu.mm index fcc2392a01a9..b86caa49d870 100755 --- a/vcl/aqua/source/window/salnsmenu.mm +++ b/vcl/aqua/source/window/salnsmenu.mm @@ -62,7 +62,7 @@ pFrame->CallCallback(SALEVENT_MENUDEACTIVATE, &aMenuEvt); } else - DBG_ERROR( "unconnected menu" ); + OSL_FAIL( "unconnected menu" ); } } } @@ -123,7 +123,7 @@ pPopupMenu->ImplSelectWithStart( pCurMenu ); } else - DBG_ERROR( "menubar item without frame !" ); + OSL_FAIL( "menubar item without frame !" ); } } @end diff --git a/vcl/aqua/source/window/salobj.cxx b/vcl/aqua/source/window/salobj.cxx index 6b5952bee8a1..a070a8f0be12 100644 --- a/vcl/aqua/source/window/salobj.cxx +++ b/vcl/aqua/source/window/salobj.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -243,3 +244,4 @@ void AquaSalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) { } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accel.h b/vcl/inc/accel.h index 284868748c89..bf3006c9ca7b 100644 --- a/vcl/inc/accel.h +++ b/vcl/inc/accel.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,3 +58,5 @@ public: void ImplGetKeyCode( KeyFuncType eFunc, sal_uInt16& rCode1, sal_uInt16& rCode2, sal_uInt16& rCode3, sal_uInt16& rCode4 ); #endif // _SV_ACCEL_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accmgr.hxx b/vcl/inc/accmgr.hxx index 553503380b15..2ffa2b366920 100644 --- a/vcl/inc/accmgr.hxx +++ b/vcl/inc/accmgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,11 +30,13 @@ #define _SV_ACCMGR_HXX #include <vcl/sv.h> +#include <vector> -class ImplAccelList; class Accelerator; class KeyCode; +typedef ::std::vector< Accelerator* > ImplAccelList; + // -------------------- // - ImplAccelManager - // -------------------- @@ -62,3 +65,5 @@ public: }; #endif // _SV_ACCMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/aqua11yfactory.h b/vcl/inc/aqua/aqua11yfactory.h index 30f355dd502c..2fa38d9901db 100644 --- a/vcl/inc/aqua/aqua11yfactory.h +++ b/vcl/inc/aqua/aqua11yfactory.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,3 +46,5 @@ +(void)revokeView: (NSView *) theViewt; @end #endif // _SV_AQUA11FACTORY_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/aqua11yfocustracker.hxx b/vcl/inc/aqua/aqua11yfocustracker.hxx index 1dbf68c4a5ef..b9721619b8ac 100644 --- a/vcl/inc/aqua/aqua11yfocustracker.hxx +++ b/vcl/inc/aqua/aqua11yfocustracker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #ifndef _AQUA11YFOCUSTRACKER_HXX_ #define _AQUA11YFOCUSTRACKER_HXX_ -#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_ #include <com/sun/star/accessibility/XAccessible.hpp> -#endif #include "keyboardfocuslistener.hxx" @@ -106,3 +105,5 @@ private: }; #endif // _AQUA11YFOCUSTRACKER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/aqua11ylistener.hxx b/vcl/inc/aqua/aqua11ylistener.hxx index 461b149e4650..cab8d8c89d58 100644 --- a/vcl/inc/aqua/aqua11ylistener.hxx +++ b/vcl/inc/aqua/aqua11ylistener.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,4 +63,5 @@ private: ::com::sun::star::awt::Rectangle m_oldBounds; }; -#endif // _AQUA11YLISTENER_HXX_
\ No newline at end of file +#endif // _AQUA11YLISTENER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/aqua11ywrapper.h b/vcl/inc/aqua/aqua11ywrapper.h index 44640966d760..aebea78f0394 100644 --- a/vcl/inc/aqua/aqua11ywrapper.h +++ b/vcl/inc/aqua/aqua11ywrapper.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -117,3 +118,5 @@ struct ReferenceWrapper @end #endif // _SV_AQUA11WRAPPER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/aquaprintview.h b/vcl/inc/aqua/aquaprintview.h index 391a9546f63a..2c5849f10e65 100755..100644 --- a/vcl/inc/aqua/aquaprintview.h +++ b/vcl/inc/aqua/aquaprintview.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,3 +66,5 @@ struct PrintAccessoryViewState #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/aquavclevents.hxx b/vcl/inc/aqua/aquavclevents.hxx index 8e03c59d0954..034edd3882b5 100644 --- a/vcl/inc/aqua/aquavclevents.hxx +++ b/vcl/inc/aqua/aquavclevents.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,3 +95,5 @@ const EventTypeSpec cTextInputEvents[] = { { kEventClassTextInput, kEventTextInp const EventTypeSpec cAppearanceScrollbarVariantChangedEvent = { kEventClassAppearance, kEventAppearanceScrollBarVariantChanged }; #endif // INCLUDED_AQUAVCLEVENTS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/aquavcltypes.h b/vcl/inc/aqua/aquavcltypes.h index 7346282963d7..93003faecad7 100644 --- a/vcl/inc/aqua/aquavcltypes.h +++ b/vcl/inc/aqua/aquavcltypes.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,3 +35,5 @@ #include "postmac.h" #endif _AQUAVCLTYPES_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/keyboardfocuslistener.hxx b/vcl/inc/aqua/keyboardfocuslistener.hxx index 71eba2f46c02..bf9c70250005 100644 --- a/vcl/inc/aqua/keyboardfocuslistener.hxx +++ b/vcl/inc/aqua/keyboardfocuslistener.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #ifndef _KEYBOARDFOCUSLISTENER_HXX_ #define _KEYBOARDFOCUSLISTENER_HXX_ -#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_ #include <com/sun/star/accessibility/XAccessible.hpp> -#endif #include <rtl/ref.hxx> @@ -44,4 +43,5 @@ public: virtual void SAL_CALL focusedObjectChanged(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xAccessible) = 0; }; -#endif // _KEYBOARDFOCUSLISTENER_HXX_
\ No newline at end of file +#endif // _KEYBOARDFOCUSLISTENER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salatsuifontutils.hxx b/vcl/inc/aqua/salatsuifontutils.hxx index 81e60871ae86..51079b8ec5d2 100644 --- a/vcl/inc/aqua/salatsuifontutils.hxx +++ b/vcl/inc/aqua/salatsuifontutils.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,7 +54,7 @@ public: ATSUFontFallbacks maFontFallbacks; private: - typedef std::hash_map<ATSUFontID,ImplMacFontData*> MacFontContainer; + typedef boost::unordered_map<ATSUFontID,ImplMacFontData*> MacFontContainer; MacFontContainer maFontContainer; void InitGlyphFallbacks(); @@ -61,3 +62,4 @@ private: #endif // _SV_SALATSUIFONTUTILS_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salbmp.h b/vcl/inc/aqua/salbmp.h index 0f86332ca761..e0dd26554aac 100644 --- a/vcl/inc/aqua/salbmp.h +++ b/vcl/inc/aqua/salbmp.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,6 +80,9 @@ public: bool Create( const SalBitmap& rSalBmp ); bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ); bool Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount ); + virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, + Size& rSize, + bool bMask = false ); void Destroy(); @@ -110,3 +114,5 @@ public: }; #endif // _SV_SALBMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salcolorutils.hxx b/vcl/inc/aqua/salcolorutils.hxx index 74ccb69756fd..ae6afdabb9ff 100755..100644 --- a/vcl/inc/aqua/salcolorutils.hxx +++ b/vcl/inc/aqua/salcolorutils.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,3 +51,5 @@ void SetSalColor( const SalColor& rColor, float* pQuartzColor ); // ------------------------------------------------------------------ #endif // _SV_SALCOLORUTILS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salconst.h b/vcl/inc/aqua/salconst.h index 2046ec20a806..50971a819c09 100755..100644 --- a/vcl/inc/aqua/salconst.h +++ b/vcl/inc/aqua/salconst.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -66,3 +67,5 @@ static const long kPixMapHRes = 72; static const long kPixMapVRes = 72; #endif // _SV_SALCONST_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/saldata.hxx b/vcl/inc/aqua/saldata.hxx index e9bceb06bb67..5c6fb32acb9d 100644 --- a/vcl/inc/aqua/saldata.hxx +++ b/vcl/inc/aqua/saldata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,7 +43,7 @@ #include <list> #include <vector> #include <map> -#include <hash_set> +#include <boost/unordered_set.hpp> #include <cstdio> #include <cstdarg> @@ -70,10 +71,10 @@ class SystemFontList; // ----------- class AquaSalFrame; -struct FrameHash : public std::hash<sal_IntPtr> +struct FrameHash : public boost::hash<sal_IntPtr> { size_t operator()(const AquaSalFrame* frame) const - { return std::hash<sal_IntPtr>::operator()( reinterpret_cast<const sal_IntPtr>(frame) ); } + { return boost::hash<sal_IntPtr>::operator()( reinterpret_cast<const sal_IntPtr>(frame) ); } }; #define INVALID_CURSOR_PTR (NSCursor*)0xdeadbeef @@ -84,7 +85,7 @@ struct SalData SALTIMERPROC mpTimerProc; // timer callback proc AquaSalInstance *mpFirstInstance; // pointer of first instance std::list<AquaSalFrame*> maFrames; // list of all frames - std::hash_set<const AquaSalFrame*,FrameHash> maFrameCheck; // for fast check of frame existance + boost::unordered_set<const AquaSalFrame*,FrameHash> maFrameCheck; // for fast check of frame existance std::list<AquaSalFrame*> maPresentationFrames; // list of frames in presentation mode SalObject *mpFirstObject; // pointer of first object window SalVirtualDevice *mpFirstVD; // first VirDev @@ -137,3 +138,5 @@ void ImplSalYieldMutexAcquire(); void ImplSalYieldMutexRelease(); #endif // _SV_SALDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salfontutils.hxx b/vcl/inc/aqua/salfontutils.hxx index 6f9f61efda70..8394d874bf10 100644 --- a/vcl/inc/aqua/salfontutils.hxx +++ b/vcl/inc/aqua/salfontutils.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -64,3 +65,4 @@ static const char *kFontWeightRegular2 = "regular"; #endif // _SV_SALFONTUTILS_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salframe.h b/vcl/inc/aqua/salframe.h index 8852b538f537..4d205c08287f 100644 --- a/vcl/inc/aqua/salframe.h +++ b/vcl/inc/aqua/salframe.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -151,11 +152,14 @@ public: virtual void Beep( SoundType eSoundType ); virtual const SystemEnvData* GetSystemData() const; virtual SalPointerState GetPointerState(); + virtual SalIndicatorState GetIndicatorState(); + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ); virtual void SetParent( SalFrame* pNewParent ); virtual bool SetPluginParent( SystemParentData* pNewParent ); virtual void SetExtendedFrameStyle( SalExtStyle ); virtual void SetBackgroundBitmap( SalBitmap* ); virtual void SetScreenNumber(unsigned int); + virtual void SetApplicationID( const rtl::OUString &rApplicationID ); // shaped system windows // set clip region to none (-> rectangular windows, normal state) @@ -217,3 +221,5 @@ public: }; #endif // _SV_SALFRAME_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salframeview.h b/vcl/inc/aqua/salframeview.h index c79539cf14e8..d4418d36bf5a 100755..100644 --- a/vcl/inc/aqua/salframeview.h +++ b/vcl/inc/aqua/salframeview.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -212,3 +213,5 @@ @end #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salgdi.h b/vcl/inc/aqua/salgdi.h index 50f2bb1156b9..d4176d83ca0e 100644 --- a/vcl/inc/aqua/salgdi.h +++ b/vcl/inc/aqua/salgdi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,6 +36,7 @@ #include "postmac.h" #include "aqua/aquavcltypes.h" +#include <vcl/fontcapabilities.hxx> #include "outfont.hxx" #include "salgdi.hxx" @@ -60,6 +62,7 @@ public: virtual sal_IntPtr GetFontId() const; const ImplFontCharMap* GetImplFontCharMap() const; + bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; bool HasChar( sal_uInt32 cChar ) const; void ReadOs2Table() const; @@ -69,10 +72,12 @@ public: private: const ATSUFontID mnFontId; mutable const ImplFontCharMap* mpCharMap; + mutable vcl::FontCapabilities maFontCapabilities; mutable bool mbOs2Read; // true if OS2-table related info is valid mutable bool mbHasOs2Table; mutable bool mbCmapEncodingRead; // true if cmap encoding of Mac font is read mutable bool mbHasCJKSupport; // #i78970# CJK fonts need extra leading + mutable bool mbFontCapabilitiesRead; }; // abstracting quartz color instead of having to use an CGFloat[] array @@ -243,7 +248,7 @@ public: // get device resolution virtual void GetResolution( long& rDPIX, long& rDPIY ); // get the depth of the device - virtual sal_uInt16 GetBitCount(); + virtual sal_uInt16 GetBitCount() const; // get the width of the device virtual long GetGraphicsWidth() const; @@ -276,6 +281,7 @@ public: virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ); // get the repertoire of the current font virtual const ImplFontCharMap* GetImplFontCharMap() const; + virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; // graphics must fill supplied font list virtual void GetDevFontList( ImplDevFontList* ); // graphics should call ImplAddDevFontSubstitute on supplied @@ -332,8 +338,8 @@ public: Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual sal_Bool GetGlyphOutline( long nIndex, basegfx::B2DPolyPolygon& ); + virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); + virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); @@ -409,3 +415,5 @@ inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha {} #endif // _SV_SALGDI_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salinst.h b/vcl/inc/aqua/salinst.h index 62baaa2762f8..a53243f65966 100644 --- a/vcl/inc/aqua/salinst.h +++ b/vcl/inc/aqua/salinst.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,10 @@ #ifndef _SV_SALINST_H #define _SV_SALINST_H -#include "vos/mutex.hxx" -#include "vos/thread.hxx" +#include "osl/mutex.hxx" +#include "osl/thread.hxx" #include "osl/conditn.h" +#include <vcl/solarmutex.hxx> #include "aqua/aquavcltypes.h" @@ -46,10 +48,10 @@ class Image; // - SalYieldMutex - // ----------------- -class SalYieldMutex : public vos::OMutex +class SalYieldMutex : public vcl::SolarMutexObject { sal_uLong mnCount; - vos::OThread::TThreadIdentifier mnThreadId; + oslThreadIdentifier mnThreadId; public: SalYieldMutex(); @@ -57,10 +59,10 @@ public: virtual void release(); virtual sal_Bool tryToAcquire(); sal_uLong GetAcquireCount() const { return mnCount; } - vos::OThread::TThreadIdentifier GetThreadId() const { return mnThreadId; } + oslThreadIdentifier GetThreadId() const { return mnThreadId; } }; -#define YIELD_GUARD vos::OGuard aGuard( GetSalData()->mpFirstInstance->GetYieldMutex() ) +#define YIELD_GUARD osl::SolarGuard aGuard( GetSalData()->mpFirstInstance->GetYieldMutex() ) // ------------------- @@ -92,7 +94,7 @@ class AquaSalInstance : public SalInstance public: SalYieldMutex* mpSalYieldMutex; // Sal-Yield-Mutex rtl::OUString maDefaultPrinter; - vos::OThread::TThreadIdentifier maMainThread; + oslThreadIdentifier maMainThread; bool mbWaitingYield; int mnActivePrintJobs; std::list< SalUserEvent > maUserEvents; @@ -131,7 +133,7 @@ public: virtual SalI18NImeStatus* CreateI18NImeStatus(); virtual SalSystem* CreateSalSystem(); virtual SalBitmap* CreateSalBitmap(); - virtual vos::IMutex* GetYieldMutex(); + virtual osl::SolarMutex* GetYieldMutex(); virtual sal_uLong ReleaseYieldMutex(); virtual void AcquireYieldMutex( sal_uLong nCount ); virtual bool CheckYieldMutex(); @@ -201,3 +203,5 @@ CGImageRef CreateCGImage( const Image& ); NSImage* CreateNSImage( const Image& ); #endif // _SV_SALINST_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salmathutils.hxx b/vcl/inc/aqua/salmathutils.hxx index 6106dc328740..e81f68e46b0b 100755..100644 --- a/vcl/inc/aqua/salmathutils.hxx +++ b/vcl/inc/aqua/salmathutils.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -85,3 +86,5 @@ unsigned long Euclidian2Norm ( const LRectCoorVector pVec ); #endif #endif // _SV_SALMATHUTILS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salmenu.h b/vcl/inc/aqua/salmenu.h index 6a83c4a7add3..84c7341889b7 100644 --- a/vcl/inc/aqua/salmenu.h +++ b/vcl/inc/aqua/salmenu.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -118,3 +119,5 @@ public: }; #endif // _SV_SALMENU_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salnativewidgets.h b/vcl/inc/aqua/salnativewidgets.h index 11d4ea5c1c62..fd6226c8030b 100755..100644 --- a/vcl/inc/aqua/salnativewidgets.h +++ b/vcl/inc/aqua/salnativewidgets.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -69,3 +70,5 @@ #define CLIP_FUZZ 1 #endif // _SV_NATIVEWIDGETS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salnsmenu.h b/vcl/inc/aqua/salnsmenu.h index e9b2cbe922b8..fac4aec75792 100755..100644 --- a/vcl/inc/aqua/salnsmenu.h +++ b/vcl/inc/aqua/salnsmenu.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -66,3 +67,5 @@ class AquaSalMenuItem; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salnstimer.h b/vcl/inc/aqua/salnstimer.h index e29fef43b6b4..5c4ba0eea430 100755..100644 --- a/vcl/inc/aqua/salnstimer.h +++ b/vcl/inc/aqua/salnstimer.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,3 +39,5 @@ @end #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salobj.h b/vcl/inc/aqua/salobj.h index 423e63715065..0eca9e9badbd 100644 --- a/vcl/inc/aqua/salobj.h +++ b/vcl/inc/aqua/salobj.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -84,3 +85,5 @@ public: }; #endif // _SV_SALOBJ_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salprn.h b/vcl/inc/aqua/salprn.h index 725fc9a43861..f2a188cc0340 100644 --- a/vcl/inc/aqua/salprn.h +++ b/vcl/inc/aqua/salprn.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -169,3 +170,5 @@ inline double TenMuToPt( double nUnits ) { return floor(((nUnits)/fPtTo100thMM)+ #endif // _SV_SALPRN_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salsys.h b/vcl/inc/aqua/salsys.h index dbb2ea0b20ea..15415712d896 100644 --- a/vcl/inc/aqua/salsys.h +++ b/vcl/inc/aqua/salsys.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,3 +59,5 @@ public: #endif // _SV_SALSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/saltimer.h b/vcl/inc/aqua/saltimer.h index f2840eee45ea..305bce14af07 100644 --- a/vcl/inc/aqua/saltimer.h +++ b/vcl/inc/aqua/saltimer.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,3 +53,5 @@ class AquaSalTimer : public SalTimer }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/salvd.h b/vcl/inc/aqua/salvd.h index 6f184167d22a..a589430e9fb7 100644 --- a/vcl/inc/aqua/salvd.h +++ b/vcl/inc/aqua/salvd.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,5 @@ public: // ======================================================================= #endif // _SV_SALVD_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/svsys.h b/vcl/inc/aqua/svsys.h index 1edce25cea28..291e7801db75 100644 --- a/vcl/inc/aqua/svsys.h +++ b/vcl/inc/aqua/svsys.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,3 +34,5 @@ #include "postmac.h" #endif // _SV_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/aqua/vclnsapp.h b/vcl/inc/aqua/vclnsapp.h index f25593d335a7..bdbe15840e0f 100755..100644 --- a/vcl/inc/aqua/vclnsapp.h +++ b/vcl/inc/aqua/vclnsapp.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,3 +69,5 @@ class AquaSalFrame; @end #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bmpfast.hxx b/vcl/inc/bmpfast.hxx index de330704b74f..b43df0e115b2 100644 --- a/vcl/inc/bmpfast.hxx +++ b/vcl/inc/bmpfast.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,3 +50,5 @@ bool ImplFastBitmapBlending( BitmapWriteAccess& rDst, bool ImplFastEraseBitmap( BitmapBuffer&, const BitmapColor& ); #endif // _SV_BMPFAST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx index 7e1dfb6b0b39..e6374ea032f5 100644 --- a/vcl/inc/brdwin.hxx +++ b/vcl/inc/brdwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -84,7 +85,8 @@ class ImplBorderWindowView; #define BORDERWINDOW_TITLE_NORMAL ((sal_uInt16)0x0001) #define BORDERWINDOW_TITLE_SMALL ((sal_uInt16)0x0002) #define BORDERWINDOW_TITLE_TEAROFF ((sal_uInt16)0x0004) -#define BORDERWINDOW_TITLE_NONE ((sal_uInt16)0x0008) +#define BORDERWINDOW_TITLE_POPUP ((sal_uInt16)0x0008) +#define BORDERWINDOW_TITLE_NONE ((sal_uInt16)0x0010) // -------------------- // - ImplBorderWindow - @@ -350,3 +352,5 @@ public: #endif // _SV_BRDWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/canvasbitmap.hxx b/vcl/inc/canvasbitmap.hxx index 6b719ef988ef..e0773257b029 100644 --- a/vcl/inc/canvasbitmap.hxx +++ b/vcl/inc/canvasbitmap.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -127,3 +128,5 @@ namespace unotools } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/controldata.hxx b/vcl/inc/controldata.hxx index 0be0f5bd402e..b30184be2481 100644 --- a/vcl/inc/controldata.hxx +++ b/vcl/inc/controldata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -60,3 +61,5 @@ namespace vcl //........................................................................ #endif // VCL_CONTROLDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/cupsmgr.hxx b/vcl/inc/cupsmgr.hxx index 0250cece817e..b76e8ef99289 100644 --- a/vcl/inc/cupsmgr.hxx +++ b/vcl/inc/cupsmgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,13 +49,13 @@ struct FPtrHash class CUPSManager : public PrinterInfoManager { CUPSWrapper* m_pCUPSWrapper; - std::hash_map< FILE*, rtl::OString, FPtrHash > m_aSpoolFiles; + boost::unordered_map< FILE*, rtl::OString, FPtrHash > m_aSpoolFiles; int m_nDests; void* m_pDests; bool m_bNewDests; - std::hash_map< rtl::OUString, int, rtl::OUStringHash > m_aCUPSDestMap; + boost::unordered_map< rtl::OUString, int, rtl::OUStringHash > m_aCUPSDestMap; - std::hash_map< rtl::OUString, PPDContext, rtl::OUStringHash > m_aDefaultContexts; + boost::unordered_map< rtl::OUString, PPDContext, rtl::OUStringHash > m_aDefaultContexts; rtl::OString m_aUser; // this is a security risk, but the CUPS API demands @@ -106,3 +107,5 @@ public: } // namespace psp #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/dbggui.hxx b/vcl/inc/dbggui.hxx index 0526a109a376..61d878de3451 100644 --- a/vcl/inc/dbggui.hxx +++ b/vcl/inc/dbggui.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -72,3 +73,5 @@ sal_uInt16 DbgRegisterNamedUserChannel( const XubString& _rChannelUIName, DbgPri #endif #endif // _SV_DBGGUI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/dndevdis.hxx b/vcl/inc/dndevdis.hxx index 5b91bd0713ec..41be5ba3fc38 100644 --- a/vcl/inc/dndevdis.hxx +++ b/vcl/inc/dndevdis.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,7 @@ #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> #include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> -#ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDRAGESTURERECOGNIZER_HPP_ #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp> -#endif #include <cppuhelper/implbase3.hxx> #include <vcl/window.hxx> @@ -48,6 +47,7 @@ class DNDEventDispatcher: public ::cppu::WeakImplHelper3< ::osl::Mutex m_aMutex; ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_aDataFlavorList; + Window* findTopLevelWindow(Point location); /* * fire the events on the dnd listener container of the specified window */ @@ -112,3 +112,5 @@ public: //================================================================================================== #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/dndlcon.hxx b/vcl/inc/dndlcon.hxx index 5a41a20e4271..1c3654c1a9ea 100644 --- a/vcl/inc/dndlcon.hxx +++ b/vcl/inc/dndlcon.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -122,3 +123,5 @@ public: //================================================================================================== #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/fontcache.hxx b/vcl/inc/fontcache.hxx index 7747b99015fe..ad261e8d8e6d 100644 --- a/vcl/inc/fontcache.hxx +++ b/vcl/inc/fontcache.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,7 @@ #include "tools/string.hxx" -#include <hash_map> +#include <boost/unordered_map.hpp> namespace psp { @@ -51,7 +52,7 @@ class VCL_PLUGIN_PUBLIC FontCache FontCacheEntry m_aEntry; }; - typedef std::hash_map< ::rtl::OString, FontFile, ::rtl::OStringHash > FontDirMap; + typedef boost::unordered_map< ::rtl::OString, FontFile, ::rtl::OStringHash > FontDirMap; struct FontDir { sal_Int64 m_nTimestamp; @@ -62,7 +63,7 @@ class VCL_PLUGIN_PUBLIC FontCache FontDir() : m_nTimestamp(0), m_bNoFiles(false), m_bUserOverrideOnly( false ) {} }; - typedef std::hash_map< int, FontDir > FontCacheData; + typedef boost::unordered_map< int, FontDir > FontCacheData; FontCacheData m_aCache; String m_aCacheFile; bool m_bDoFlush; @@ -97,3 +98,5 @@ public: } // namespace psp #endif // _PSPRINT_FONTCACHE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx index a57f5f0fd553..99b627153fa3 100644 --- a/vcl/inc/fontsubset.hxx +++ b/vcl/inc/fontsubset.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -97,3 +98,4 @@ protected: #endif // _SV_FONTSUBSET_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/glyphcache.hxx b/vcl/inc/glyphcache.hxx index a818ef6a75c3..42f90672f87b 100644 --- a/vcl/inc/glyphcache.hxx +++ b/vcl/inc/glyphcache.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,8 +43,9 @@ struct ImplKernPairData; class ImplFontOptions; #include <tools/gen.hxx> -#include <hash_map> -#include <hash_set> +#include <boost/unordered_map.hpp> +#include <boost/unordered_set.hpp> +#include <boost/shared_ptr.hpp> namespace basegfx { class B2DPolyPolygon; } @@ -55,6 +57,11 @@ class RawBitmap; class ServerFontLayout; #include <sallayout.hxx> +namespace vcl +{ + struct FontCapabilities; +} + // ======================================================================= class VCL_PLUGIN_PUBLIC GlyphCache @@ -96,7 +103,7 @@ private: // the FontList key's mpFontData member is reinterpreted as integer font id struct IFSD_Equal{ bool operator()( const ImplFontSelectData&, const ImplFontSelectData& ) const; }; struct IFSD_Hash{ size_t operator()( const ImplFontSelectData& ) const; }; - typedef ::std::hash_map<ImplFontSelectData,ServerFont*,IFSD_Hash,IFSD_Equal > FontList; + typedef ::boost::unordered_map<ImplFontSelectData,ServerFont*,IFSD_Hash,IFSD_Equal > FontList; FontList maFontList; sal_uLong mnMaxSize; // max overall cache size in bytes mutable sal_uLong mnBytesUsed; @@ -180,7 +187,9 @@ public: virtual bool TestFont() const { return true; } virtual void* GetFtFace() const { return 0; } virtual int GetLoadFlags() const { return 0; } - virtual void SetFontOptions( const ImplFontOptions&) {} + virtual void SetFontOptions( boost::shared_ptr<ImplFontOptions> ) {} + virtual boost::shared_ptr<ImplFontOptions> GetFontOptions() const + { return boost::shared_ptr<ImplFontOptions>(); } virtual bool NeedsArtificialBold() const { return false; } virtual bool NeedsArtificialItalic() const { return false; } @@ -190,6 +199,7 @@ public: virtual sal_uLong GetKernPairs( ImplKernPairData** ) const { return 0; } virtual int GetGlyphKernValue( int, int ) const { return 0; } virtual const ImplFontCharMap* GetImplFontCharMap() const = 0; + virtual bool GetFontCapabilities(vcl::FontCapabilities &) const { return false; } Point TransformPoint( const Point& ) const; GlyphData& GetGlyphData( int nGlyphIndex ); @@ -225,7 +235,7 @@ protected: virtual ServerFontLayoutEngine* GetLayoutEngine() { return NULL; } private: - typedef ::std::hash_map<int,GlyphData> GlyphList; + typedef ::boost::unordered_map<int,GlyphData> GlyphList; mutable GlyphList maGlyphList; const ImplFontSelectData maFontSelData; @@ -258,9 +268,8 @@ class VCL_PLUGIN_PUBLIC ImplServerFontEntry : public ImplFontEntry { private: ServerFont* mpServerFont; - ImplFontOptions maFontOptions; + boost::shared_ptr<ImplFontOptions> mpFontOptions; bool mbGotFontOptions; - bool mbValidFontOptions; public: ImplServerFontEntry( ImplFontSelectData& ); @@ -371,10 +380,12 @@ protected: { return (rA.mnChar1 == rB.mnChar1) && (rA.mnChar2 == rB.mnChar2); } }; struct PairHash{ int operator()(const ImplKernPairData& rA) const { return (rA.mnChar1) * 256 ^ rA.mnChar2; } }; - typedef std::hash_set< ImplKernPairData, PairHash, PairEqual > UnicodeKernPairs; + typedef boost::unordered_set< ImplKernPairData, PairHash, PairEqual > UnicodeKernPairs; mutable UnicodeKernPairs maUnicodeKernPairs; }; // ======================================================================= #endif // _SV_GLYPHCACHE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphite_adaptors.hxx b/vcl/inc/graphite_adaptors.hxx deleted file mode 100644 index 753523f4aa0d..000000000000 --- a/vcl/inc/graphite_adaptors.hxx +++ /dev/null @@ -1,152 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_GRAPHITEADAPTORS_HXX -#define _SV_GRAPHITEADAPTORS_HXX - -// We need this to enable namespace support in libgrengine headers. -#define GR_NAMESPACE - -// Standard Library -#include <stdexcept> -// Platform - -#ifndef _SVWIN_H -#include <tools/svwin.h> -#endif - -#ifndef _SV_SVSYS_HXX -#include <svsys.h> -#endif - -#ifndef _SV_SALGDI_HXX -#include <salgdi.hxx> -#endif - -#ifndef _SV_SALLAYOUT_HXX -#include <sallayout.hxx> -#endif - -// Module -#include "vcl/dllapi.h" - -// Libraries -#include <preextstl.h> -#include <graphite/GrClient.h> -#include <graphite/Font.h> -#include <graphite/ITextSource.h> -#include <postextstl.h> - -// Module type definitions and forward declarations. -// -#ifndef MSC -// SAL/VCL types -class ServerFont; -class FreetypeServerFont; - -// Graphite types - -struct FontProperties : gr::FontProps -{ - FontProperties(const FreetypeServerFont & font) throw(); -}; - -namespace grutils -{ - class GrFeatureParser; -} - -// This class adapts the Sal font and graphics services to form required by -// the Graphite engine. -// @author tse -// -class VCL_PLUGIN_PUBLIC GraphiteFontAdaptor : public gr::Font -{ - typedef std::map<const gr::gid16, std::pair<gr::Rect, gr::Point> > GlyphMetricMap; - friend class GrFontHasher; -public: - static bool IsGraphiteEnabledFont(ServerFont &) throw(); - - GraphiteFontAdaptor(ServerFont & font, const sal_Int32 dpi_x, const sal_Int32 dpi_y); - GraphiteFontAdaptor(const GraphiteFontAdaptor &) throw(); - ~GraphiteFontAdaptor() throw(); - - gr::Font * copyThis(); - - // Basic attribute accessors. - virtual float ascent(); - virtual float descent(); - virtual bool bold(); - virtual bool italic(); - virtual float height(); - virtual unsigned int getDPIx(); - virtual unsigned int getDPIy(); - - // Font access methods. - virtual const void * getTable(gr::fontTableId32 tableID, size_t * pcbSize); - virtual void getFontMetrics(float * ascent_out, float * descent_out = 0, float * em_square_out = 0); - - // Glyph metrics. - virtual void getGlyphMetrics(gr::gid16 glyphID, gr::Rect & boundingBox, gr::Point & advances); - - // Adaptor attributes. - const FontProperties & fontProperties() const throw(); - FreetypeServerFont & font() const throw(); - const grutils::GrFeatureParser * features() const { return mpFeatures; }; - -private: - virtual void UniqueCacheInfo(ext_std::wstring &, bool &, bool &); - - FreetypeServerFont& mrFont; - FontProperties maFontProperties; - const unsigned int mnDpiX, mnDpiY; - const float mfAscent, - mfDescent, - mfEmUnits; - grutils::GrFeatureParser * mpFeatures; - GlyphMetricMap maGlyphMetricMap; -}; - -// Partial implementation of class GraphiteFontAdaptor. -// -inline const FontProperties & GraphiteFontAdaptor::fontProperties() const throw() { - return maFontProperties; -} - -inline FreetypeServerFont & GraphiteFontAdaptor::font() const throw() { - return mrFont; -} -#endif // not MFC - -// Partial implementation of class TextSourceAdaptor. -// -//inline const ImplLayoutArgs & TextSourceAdaptor::layoutArgs() const throw() { -// return _layout_args; -//} - - -#endif // _SV_GRAPHITEADAPTORS_HXX diff --git a/vcl/inc/graphite_cache.hxx b/vcl/inc/graphite_cache.hxx deleted file mode 100644 index af1392ed4d4b..000000000000 --- a/vcl/inc/graphite_cache.hxx +++ /dev/null @@ -1,289 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// Description: Classes to cache Graphite Segments to try to improve -// rendering performance. - -#ifndef GraphiteSegmentCache_h -#define GraphiteSegmentCache_h - -#include <tools/solar.h> -#include <rtl/ustring.h> - -#define GRCACHE_REUSE_VECTORS 1 - -//#include <rope> -#include <hash_map> - -class TextSourceAdaptor; -/** -* GrSegRecord stores a Graphite Segment and its associated text -*/ -class GrSegRecord { -public: - GrSegRecord(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl); - - ~GrSegRecord(); - - void reuse(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl); - - void clearVectors(); - 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, 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()); - mvGlyph2Char.insert(mvGlyph2Char.begin(),vGlyph2Char.begin(),vGlyph2Char.end()); - } -#endif - gr::Segment * getSegment() { return m_seg; } - TextSourceAdaptor * getTextSrc() { return m_text; } - void unlock() { --m_lockCount; } - bool isRtl() const { return mbIsRtl; } -#ifdef GRCACHE_REUSE_VECTORS - const long & width() const { return mnWidth; } - const GraphiteLayout::Glyphs & glyphs() const { return mvGlyphs; } - 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; - TextSourceAdaptor * m_text; - gr::Segment * m_seg; - const xub_Unicode * m_nextKey; - const xub_Unicode* m_pStr; - size_t m_startChar; - float m_fontScale; - long mnWidth; - GraphiteLayout::Glyphs mvGlyphs; // glyphs in display order - std::vector<int> mvCharDxs; // right hand side x offset of each glyph - std::vector<int> mvChar2BaseGlyph; - std::vector<int> mvGlyph2Char; - bool mbIsRtl; - int m_lockCount; - friend class GraphiteSegmentCache; -}; - -typedef std::hash_map<long, GrSegRecord*, std::hash<long> > GraphiteSegMap; -typedef std::hash_multimap<size_t, GrSegRecord*> GraphiteRopeMap; -typedef std::pair<GraphiteRopeMap::iterator, GraphiteRopeMap::iterator> GrRMEntry; - -/** -* GraphiteSegmentCache contains the cached Segments for one particular font size -*/ -class GraphiteSegmentCache -{ -public: - enum { - // not really sure what good values are here, - // bucket size should be >> cache size - SEG_BUCKET_FACTOR = 4, - SEG_DEFAULT_CACHE_SIZE = 2047 - }; - GraphiteSegmentCache(sal_uInt32 nSegCacheSize) - : m_segMap(nSegCacheSize * SEG_BUCKET_FACTOR), - m_nSegCacheSize(nSegCacheSize), - m_oldestKey(NULL) {}; - ~GraphiteSegmentCache() - { - m_ropeMap.clear(); - GraphiteSegMap::iterator i = m_segMap.begin(); - while (i != m_segMap.end()) - { - GrSegRecord *r = i->second; - delete r; - ++i; - } - m_segMap.clear(); - }; - GrSegRecord * getSegment(ImplLayoutArgs & layoutArgs, bool bIsRtl, int segCharLimit) - { - GrSegRecord * found = NULL; - // try to find a segment starting at correct place, if not, try to find a - // match for the complete buffer - GraphiteSegMap::iterator iMap = - m_segMap.find(reinterpret_cast<long>(layoutArgs.mpStr + - layoutArgs.mnMinCharPos)); - if (iMap != m_segMap.end()) - { - found = iMap->second; - } - else - { - iMap = m_segMap.find(reinterpret_cast<long>(layoutArgs.mpStr)); - if (iMap != m_segMap.end()) - { - found = iMap->second; - } - } - if (found) - { - if (found->m_seg->startCharacter() <= layoutArgs.mnMinCharPos && - found->m_seg->stopCharacter() >= layoutArgs.mnEndCharPos) - { - DBG_ASSERT(found && found->m_seg, "null entry in GraphiteSegmentCache"); - // restore original start character, in case it has changed - found->m_seg->setTextSourceOffset(found->m_startChar); - // check that characters are the same, at least in the range of - // interest - // We could use substr and ==, but substr does a copy, - // so its probably faster to do it like this - for (int i = layoutArgs.mnMinCharPos; i < segCharLimit; i++) - { - //if (!found->m_rope->match(rtl::OUString(layoutArgs.mpStr[i], layoutArgs.mnLength), i - found->m_seg->startCharacter())) - if (found->m_rope->getStr()[i-found->m_seg->startCharacter()] != layoutArgs.mpStr[i]) - return NULL; - } - if (found->isRtl() != bIsRtl) - { - return NULL; - } - if (found->m_seg->stopCharacter() > layoutArgs.mnEndCharPos && - static_cast<int>(found->char2BaseGlyph().size()) > layoutArgs.mnEndCharPos) - { - // check that the requested end character isn't mid cluster - if (found->char2BaseGlyph()[layoutArgs.mnEndCharPos-layoutArgs.mnMinCharPos] == -1) - { - return NULL; - } - } -// if (found->m_lockCount != 0) -// OutputDebugString("Multple users of SegRecord!"); - found->m_lockCount++; - } - else found = NULL; - } - else - { - // the pointers aren't the same, but we might still have the same text in a segment - // this is expecially needed when editing a large paragraph - // each edit changes the pointers, but if we don't reuse any segments it gets very - // slow. - rtl::OUString * rope = new rtl::OUString(layoutArgs.mpStr + layoutArgs.mnMinCharPos, - segCharLimit - layoutArgs.mnMinCharPos); - if (!rope) return NULL; - size_t nHash = (*(rope)).hashCode(); - GrRMEntry range = m_ropeMap.equal_range(nHash); - while (range.first != range.second) - { - found = range.first->second; - if (found->m_lockCount == 0) - { - if(rope->match(*(found->m_rope))) - { - // found, but the pointers are all wrong - found->m_seg->setTextSourceOffset(layoutArgs.mnMinCharPos); - // the switch is done in graphite_layout.cxx - //found->m_text->switchLayoutArgs(layoutArgs); - found->m_lockCount++; - break; - } - else - found = NULL; - } - else - found = NULL; - ++(range.first); - } - delete rope; - } - return found; - }; - GrSegRecord * cacheSegment(TextSourceAdaptor * adapter, gr::Segment * seg, bool bIsRtl); -private: - GraphiteSegMap m_segMap; - GraphiteRopeMap m_ropeMap; - sal_uInt32 m_nSegCacheSize; - const xub_Unicode * m_oldestKey; - const xub_Unicode * m_prevKey; -}; - -typedef std::hash_map<int, GraphiteSegmentCache *, std::hash<int> > GraphiteCacheMap; - -/** -* GraphiteCacheHandler maps a particular font, style, size to a GraphiteSegmentCache -*/ -class GraphiteCacheHandler -{ -public: - GraphiteCacheHandler() : m_cacheMap(255) - { - const char * pEnvCache = getenv( "SAL_GRAPHITE_CACHE_SIZE" ); - if (pEnvCache != NULL) - { - int envCacheSize = atoi(pEnvCache); - if (envCacheSize <= 0) - m_nSegCacheSize = GraphiteSegmentCache::SEG_DEFAULT_CACHE_SIZE; - else - { - m_nSegCacheSize = envCacheSize; - } - } - else - { - m_nSegCacheSize = GraphiteSegmentCache::SEG_DEFAULT_CACHE_SIZE; - } - }; - ~GraphiteCacheHandler() - { - GraphiteCacheMap::iterator i = m_cacheMap.begin(); - while (i != m_cacheMap.end()) - { - GraphiteSegmentCache *r = i->second; - delete r; - ++i; - } - m_cacheMap.clear(); - }; - - static GraphiteCacheHandler instance; - - GraphiteSegmentCache * getCache(sal_Int32 & fontHash) - { - if (m_cacheMap.count(fontHash) > 0) - { - return m_cacheMap.find(fontHash)->second; - } - GraphiteSegmentCache *pCache = new GraphiteSegmentCache(m_nSegCacheSize); - m_cacheMap[fontHash] = pCache; - return pCache; - } -private: - GraphiteCacheMap m_cacheMap; - sal_uInt32 m_nSegCacheSize; -}; - -#endif - diff --git a/vcl/inc/graphite_features.hxx b/vcl/inc/graphite_features.hxx index 47b8f062e299..742ad2c3f5f5 100644 --- a/vcl/inc/graphite_features.hxx +++ b/vcl/inc/graphite_features.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,14 +30,17 @@ // Parse a string of features specified as ; separated pairs. // e.g. // 1001=1&2002=2&fav1=0 -#include <preextstl.h> -#include <graphite/GrClient.h> -#include <graphite/Font.h> -#include <graphite/GrFeature.h> -#include <postextstl.h> +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <graphite2/Font.h> namespace grutils { + union FeatId + { + gr_uint32 num; + unsigned char label[5]; + }; class GrFeatureParser { @@ -45,31 +49,30 @@ namespace grutils static const char FEAT_PREFIX; static const char FEAT_SEPARATOR; static const char FEAT_ID_VALUE_SEPARATOR; - static const std::string ISO_LANG; - GrFeatureParser(gr::Font & font, const std::string features, const std::string lang); - GrFeatureParser(gr::Font & font, const std::string lang); - GrFeatureParser(const GrFeatureParser & copy); + GrFeatureParser(const gr_face * face, const ::rtl::OString features, const ::rtl::OString lang); + GrFeatureParser(const gr_face * face, const ::rtl::OString lang); ~GrFeatureParser(); - size_t getFontFeatures(gr::FeatureSetting settings[MAX_FEATURES]) const; + //size_t getFontFeatures(gr::FeatureSetting settings[MAX_FEATURES]) const; bool parseErrors() { return mbErrors; }; - static bool isValid(gr::Font & font, gr::FeatureSetting & setting); - gr::isocode getLanguage() const { return maLang; }; - bool hasLanguage() const { return (maLang.rgch[0] != '\0'); } - sal_Int32 hashCode() const; + //static bool isValid(gr::Font & font, gr::FeatureSetting & setting); + gr_uint32 getLanguage() const { return maLang.num; }; + bool hasLanguage() const { return (maLang.label[0] != '\0'); } + sal_Int32 hashCode() const { return mnHash; } + size_t numFeatures() const { return mnNumSettings; } + gr_feature_val * values() const { return mpSettings; }; private: - void setLang(gr::Font & font, const std::string & lang); - bool isCharId(const std::string & id, size_t offset, size_t length); - int getCharId(const std::string & id, size_t offset, size_t length); - int getIntValue(const std::string & id, size_t offset, size_t length); + GrFeatureParser(const GrFeatureParser & copy); + void setLang(const gr_face * face, const ::rtl::OString & lang); + bool isCharId(const ::rtl::OString & id, size_t offset, size_t length); + gr_uint32 getCharId(const ::rtl::OString & id, size_t offset, size_t length); + short getIntValue(const ::rtl::OString & id, size_t offset, size_t length); size_t mnNumSettings; - gr::isocode maLang; + FeatId maLang; bool mbErrors; - gr::FeatureSetting maSettings[64]; + sal_uInt32 mnHash; + gr_feature_val * mpSettings; }; - union FeatId - { - gr::featid num; - unsigned char label[5]; - }; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx index d4f89d4cb91d..c6c711d94dc7 100644 --- a/vcl/inc/graphite_layout.hxx +++ b/vcl/inc/graphite_layout.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,31 +34,19 @@ // We need this to enable namespace support in libgrengine headers. #define GR_NAMESPACE -#define GRCACHE 1 - // Standard Library #include <memory> #include <vector> +#include <map> #include <utility> // Libraries -#include <preextstl.h> -#include <graphite/GrClient.h> -#include <graphite/Font.h> -#include <graphite/GrConstants.h> -#include <graphite/GrAppData.h> -#include <graphite/SegmentAux.h> -#include <postextstl.h> +#include <graphite2/Font.h> +#include <graphite2/Segment.h> // Platform #include <sallayout.hxx> #include <vcl/dllapi.h> // Module -// For backwards compatibility with 2.4.x -#if (SUPD == 680) -typedef sal_Int32 sal_GlyphId; -#endif - - // Module type definitions and forward declarations. // class TextSourceAdaptor; @@ -66,21 +55,40 @@ class GrSegRecord; // SAL/VCL types class ServerFont; -#ifdef WNT -// The GraphiteWinFont is just a wrapper to enable GrFontHasher to be a friend -// so that UniqueCacheInfo can be called. -#include <graphite/WinFont.h> -class GraphiteWinFont : public gr::WinFont +// Graphite types +namespace grutils { class GrFeatureParser; } + +class GraphiteFaceWrapper { - friend class GrFontHasher; public: - GraphiteWinFont(HDC hdc) : gr::WinFont(hdc) {}; - virtual ~GraphiteWinFont() {}; + typedef std::map<int, gr_font*> GrFontMap; + GraphiteFaceWrapper(gr_face * pFace) : m_pFace(pFace) {} + ~GraphiteFaceWrapper() + { + GrFontMap::iterator i = m_fonts.begin(); + while (i != m_fonts.end()) + gr_font_destroy((*i++).second); + m_fonts.clear(); + gr_face_destroy(m_pFace); + } + const gr_face * face() const { return m_pFace; } + gr_font * font(int ppm) const + { + GrFontMap::const_iterator i = m_fonts.find(ppm); + if (i != m_fonts.end()) + return i->second; + return NULL; + }; + void addFont(int ppm, gr_font * pFont) + { + if (m_fonts[ppm]) + gr_font_destroy(m_fonts[ppm]); + m_fonts[ppm] = pFont; + } +private: + gr_face * m_pFace; + GrFontMap m_fonts; }; -#endif -// Graphite types -namespace gr { class Segment; class GlyphIterator; } -namespace grutils { class GrFeatureParser; } // This class uses the SIL Graphite engine to provide complex text layout services to the VCL // @author tse @@ -88,63 +96,38 @@ namespace grutils { class GrFeatureParser; } class VCL_PLUGIN_PUBLIC GraphiteLayout : public SalLayout { public: - // Mask to allow Word break status to be stored within mvChar2BaseGlyph - enum { - WORD_BREAK_BEFORE = 0x40000000, - HYPHEN_BREAK_BEFORE = 0x80000000, - BREAK_MASK = 0xC0000000, - GLYPH_INDEX_MASK = 0x3FFFFFFF - } LineBreakMask; class Glyphs : public std::vector<GlyphItem> { public: typedef std::pair<Glyphs::const_iterator, Glyphs::const_iterator> iterator_pair_t; - void fill_from(gr::Segment & rSeg, ImplLayoutArgs & rArgs, - bool bRtl, long &rWidth, float fScaling, - std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, - std::vector<int> & rCharDxs); - void move_glyph(Glyphs::iterator, long dx); - - const_iterator cluster_base(const_iterator) const; - iterator_pair_t neighbour_clusters(const_iterator) const; - private: - std::pair<float,float> appendCluster(gr::Segment & rSeg, ImplLayoutArgs & rArgs, - bool bRtl, float fSegmentAdvance, int nFirstCharInCluster, int nNextChar, - int nFirstGlyphInCluster, int nNextGlyph, float fScaling, - std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, - std::vector<int> & rCharDxs, long & rDXOffset); - void append(gr::Segment & rSeg, ImplLayoutArgs & rArgs, gr::GlyphInfo & rGi, float nextGlyphOrigin, float fScaling, std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs, long & rDXOffset, bool bIsBase); }; mutable Glyphs mvGlyphs; void clear(); private: - TextSourceAdaptor * mpTextSrc; // Text source. - gr::LayoutEnvironment maLayout; - const gr::Font &mrFont; + const gr_face * mpFace; // not owned by layout + gr_font * mpFont; // not owned by layout + int mnSegCharOffset; // relative to ImplLayoutArgs::mpStr long mnWidth; - std::vector<int> mvCharDxs; std::vector<int> mvChar2BaseGlyph; std::vector<int> mvGlyph2Char; + std::vector<int> mvCharDxs; + std::vector<int> mvCharBreaks; float mfScaling; const grutils::GrFeatureParser * mpFeatures; public: - explicit GraphiteLayout( const gr::Font& font, const grutils::GrFeatureParser* features = NULL ) throw(); + GraphiteLayout(const gr_face * pFace, gr_font * pFont = NULL, + const grutils::GrFeatureParser * features = NULL) throw(); // used by upper layers virtual bool LayoutText( ImplLayoutArgs& ); // first step of layout // split into two stages to allow dc to be restored on the segment -#ifdef GRCACHE - gr::Segment * CreateSegment(ImplLayoutArgs& rArgs, GrSegRecord ** pRecord = NULL); - bool LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment, GrSegRecord * pSegRecord); -#else - gr::Segment * CreateSegment(ImplLayoutArgs& rArgs); - bool LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment); -#endif + gr_segment * CreateSegment(ImplLayoutArgs& rArgs); + bool LayoutGlyphs(ImplLayoutArgs& rArgs, gr_segment * pSegment); virtual void AdjustLayout( ImplLayoutArgs& ); // adjusting positions @@ -168,19 +151,25 @@ public: virtual void DrawText(SalGraphics&) const {}; virtual ~GraphiteLayout() throw(); + void SetFont(gr_font * pFont) { mpFont = pFont; } + gr_font * GetFont() { return mpFont; } void SetFeatures(grutils::GrFeatureParser * aFeature) { mpFeatures = aFeature; } void SetFontScale(float s) { mfScaling = s; }; - const TextSourceAdaptor * textSrc() const { return mpTextSrc; }; virtual sal_GlyphId getKashidaGlyph(int & width) = 0; void kashidaJustify(std::vector<int> & rDeltaWidth, sal_GlyphId, int width); static const int EXTRA_CONTEXT_LENGTH; private: - int glyph_to_char(Glyphs::iterator); - std::pair<int,int> glyph_to_chars(const GlyphItem &) const; - - std::pair<long,long> caret_positions(size_t) const; void expandOrCondense(ImplLayoutArgs &rArgs); + void fillFrom(gr_segment * rSeg, ImplLayoutArgs & rArgs, float fScaling); + + void append(gr_segment * pSeg, + ImplLayoutArgs & rArgs, + const gr_slot * pSlot, + float nextGlyphOrigin, float fScaling, + long & rDXOffset, bool bIsBase, int baseChar); }; #endif // _SV_GRAPHITELAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphite_serverfont.hxx b/vcl/inc/graphite_serverfont.hxx index 819180b30bf6..63adf526c2a1 100644 --- a/vcl/inc/graphite_serverfont.hxx +++ b/vcl/inc/graphite_serverfont.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,19 +34,19 @@ #ifndef MSC #include <graphite_layout.hxx> -#include <graphite_adaptors.hxx> // Modules class VCL_PLUGIN_PUBLIC GraphiteLayoutImpl : public GraphiteLayout { public: - GraphiteLayoutImpl(const gr::Font & font, const grutils::GrFeatureParser * features, GraphiteFontAdaptor * pFont) throw() - : GraphiteLayout(font, features), mpFont(pFont) {}; + GraphiteLayoutImpl(const gr_face * pFace, + ServerFont & rServerFont) throw() + : GraphiteLayout(pFace), mrServerFont(rServerFont) {}; virtual ~GraphiteLayoutImpl() throw() {}; virtual sal_GlyphId getKashidaGlyph(int & width); private: - GraphiteFontAdaptor * mpFont; + ServerFont & mrServerFont; }; // This class implments the server font specific parts. @@ -54,13 +55,19 @@ private: class VCL_PLUGIN_PUBLIC GraphiteServerFontLayout : public ServerFontLayout { private: - mutable GraphiteFontAdaptor * mpFont; // mutable so that the DrawOffset/DrawBase can be set mutable GraphiteLayoutImpl maImpl; + grutils::GrFeatureParser * mpFeatures; + const sal_Unicode * mpStr; public: - explicit GraphiteServerFontLayout( GraphiteFontAdaptor* font ) throw(); + GraphiteServerFontLayout(ServerFont& pServerFont) throw(); - virtual bool LayoutText( ImplLayoutArgs& rArgs) { SalLayout::AdjustLayout(rArgs); return maImpl.LayoutText(rArgs); }; // first step of layout + virtual bool LayoutText( ImplLayoutArgs& rArgs) + { + mpStr = rArgs.mpStr; + SalLayout::AdjustLayout(rArgs); + return maImpl.LayoutText(rArgs); + }; // first step of layout virtual void AdjustLayout( ImplLayoutArgs& rArgs) { SalLayout::AdjustLayout(rArgs); @@ -88,11 +95,14 @@ public: virtual ~GraphiteServerFontLayout() throw(); + static bool IsGraphiteEnabledFont(ServerFont * pServerFont); // For use with PspGraphics - const sal_Unicode* getTextPtr() const; + const sal_Unicode* getTextPtr() const { return mpStr; }; int getMinCharPos() const { return mnMinCharPos; } int getMaxCharPos() const { return mnEndCharPos; } }; #endif #endif //_SV_GRAPHITESERVERFONT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/helpwin.hxx b/vcl/inc/helpwin.hxx index fc3e2d5ffce8..7862a4961bbd 100644 --- a/vcl/inc/helpwin.hxx +++ b/vcl/inc/helpwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,5 @@ void ImplSetHelpWindowPos( Window* pHelpWindow, sal_uInt16 nHelpWinStyle, sal_uI const Point& rPos, const Rectangle* pHelpArea ); #endif // _SV_HELPWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/idlemgr.hxx b/vcl/inc/idlemgr.hxx index 93da741827eb..674bdf070c3a 100644 --- a/vcl/inc/idlemgr.hxx +++ b/vcl/inc/idlemgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,8 +31,10 @@ #include <vcl/sv.h> #include <vcl/timer.hxx> +#include <vector> -class ImplIdleList; +struct ImplIdleData; +typedef ::std::vector< ImplIdleData* > ImplIdleList; // --------------- // - ImplIdleMgr - @@ -58,3 +61,5 @@ public: }; #endif // _SV_IDLEMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx index b509464bae4e..69d127a68d15 100644 --- a/vcl/inc/ilstbox.hxx +++ b/vcl/inc/ilstbox.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +29,8 @@ #ifndef _SV_ILSTBOX_HXX #define _SV_ILSTBOX_HXX +#include <boost/ptr_container/ptr_vector.hpp> + #include <vcl/sv.h> #include <vcl/image.hxx> #include <vcl/ctrl.hxx> @@ -60,7 +63,7 @@ enum LB_EVENT_TYPE // ----------------- // - ImplEntryType - // ----------------- - + struct ImplEntryType { XubString maStr; @@ -102,8 +105,8 @@ struct ImplEntryType // ----------------- // - ImplEntryList - // ----------------- - -class ImplEntryList : private List + +class ImplEntryList { private: Window* mpWindow; // For getting the current locale when matching strings @@ -116,8 +119,14 @@ private: Link maSelectionChangedHdl; sal_Bool mbCallSelectionChangedHdl; + boost::ptr_vector<ImplEntryType> maEntries; - ImplEntryType* GetEntry( sal_uInt16 nPos ) const { return (ImplEntryType*)List::GetObject( nPos ); } + ImplEntryType* GetEntry( sal_uInt16 nPos ) const + { + if (nPos >= maEntries.size()) + return NULL; + return const_cast<ImplEntryType*>(&maEntries[nPos]); + } public: ImplEntryList( Window* pWindow ); @@ -125,8 +134,8 @@ public: sal_uInt16 InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry, sal_Bool bSort ); void RemoveEntry( sal_uInt16 nPos ); - const ImplEntryType* GetEntryPtr( sal_uInt16 nPos ) const { return (const ImplEntryType*) GetObject( nPos ); } - ImplEntryType* GetMutableEntryPtr( sal_uInt16 nPos ) const { return (ImplEntryType*) GetObject( nPos ); } + const ImplEntryType* GetEntryPtr( sal_uInt16 nPos ) const { return (const ImplEntryType*) GetEntry( nPos ); } + ImplEntryType* GetMutableEntryPtr( sal_uInt16 nPos ) const { return GetEntry( nPos ); } void Clear(); sal_uInt16 FindMatchingEntry( const XubString& rStr, sal_uInt16 nStart = 0, sal_Bool bForward = sal_True, sal_Bool bLazy = sal_True ) const; @@ -140,7 +149,7 @@ public: long GetAddedHeight( sal_uInt16 nEndIndex, sal_uInt16 nBeginIndex = 0, long nBeginHeight = 0 ) const; long GetEntryHeight( sal_uInt16 nPos ) const; - sal_uInt16 GetEntryCount() const { return (sal_uInt16)List::Count(); } + sal_uInt16 GetEntryCount() const { return (sal_uInt16)maEntries.size(); } sal_Bool HasImages() const { return mnImages ? sal_True : sal_False; } XubString GetEntryText( sal_uInt16 nPos ) const; @@ -390,7 +399,7 @@ protected: // --------------- // - ImplListBox - // --------------- - + class ImplListBox : public Control { private: @@ -513,7 +522,7 @@ public: // ----------------------------- // - ImplListBoxFloatingWindow - // ----------------------------- - + class ImplListBoxFloatingWindow : public FloatingWindow { private: @@ -556,7 +565,7 @@ public: // ----------- // - ImplWin - // ----------- - + class ImplWin : public Control { private: @@ -564,7 +573,6 @@ private: sal_uInt16 mnItemPos; // wegen UserDraw muss ich wissen, welches Item ich darstelle. XubString maString; Image maImage; - Image maImageHC; Rectangle maFocusRect; Size maUserItemSize; @@ -600,8 +608,8 @@ public: const Image& GetImage() const { return maImage; } void SetImage( const Image& rImg ) { maImage = rImg; } - sal_Bool SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL ); - const Image& GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + sal_Bool SetModeImage( const Image& rImage ); + const Image& GetModeImage( ) const; virtual void MBDown(); @@ -647,3 +655,5 @@ void ImplInitFieldSettings( Window* pWin, sal_Bool bFont, sal_Bool bForeground, void ImplInitDropDownButton( PushButton* pButton ); #endif // _SV_ILSTBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/image.h b/vcl/inc/image.h index 6ae9ad3a9c4a..86f924993ed3 100644 --- a/vcl/inc/image.h +++ b/vcl/inc/image.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,7 @@ #include <vcl/bitmapex.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> // ---------------- // - ImplImageBmp - @@ -53,7 +54,7 @@ public: void Replace( sal_uInt16 nPos, const BitmapEx& rBmpEx ); void ReplaceColors( const Color* pSrcColors, const Color* pDstColors, sal_uIntPtr nColorCount ); - void ColorTransform( BmpColorMode eColorMode ); + void ColorTransform(); void Invert(); BitmapEx GetBitmapEx( sal_uInt16 nPosCount, sal_uInt16* pPosAry ) const; @@ -111,7 +112,7 @@ struct ImageAryData struct ImplImageList { typedef std::vector<ImageAryData *> ImageAryDataVec; - typedef std::hash_map< rtl::OUString, ImageAryData *, rtl::OUStringHash > + typedef boost::unordered_map< rtl::OUString, ImageAryData *, rtl::OUStringHash > ImageAryDataNameHash; ImageAryDataVec maImages; @@ -180,3 +181,5 @@ private: // prevent assignment and copy construction }; #endif // _SV_IMAGE_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impbmp.hxx b/vcl/inc/impbmp.hxx index 778cc0f8f750..c77e906bd8ae 100644 --- a/vcl/inc/impbmp.hxx +++ b/vcl/inc/impbmp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -106,3 +107,5 @@ inline void ImpBitmap::ImplSetSourceSize( const Size& rSize) } #endif // _SV_IMPBMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index cc4271932b47..40355af21518 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -134,7 +135,7 @@ public: }; // ------------------ -// - ImplFontHints - +// - ImplFontOptions - // ------------------ class ImplFontOptions @@ -153,19 +154,20 @@ public: meHinting(HINTING_DONTKNOW), meHintStyle(HINT_SLIGHT) {} - ImplFontOptions( FontEmbeddedBitmap eEmbeddedBitmap, FontAntiAlias eAntiAlias, - FontAutoHint eAutoHint, FontHinting eHinting, FontHintStyle eHintStyle) : - meEmbeddedBitmap(eEmbeddedBitmap), - meAntiAlias(eAntiAlias), - meAutoHint(eAutoHint), - meHinting(eHinting), - meHintStyle(eHintStyle) + virtual ~ImplFontOptions() {} - FontAutoHint GetUseAutoHint() const { return meAutoHint; } - FontHintStyle GetHintStyle() const { return meHintStyle; } - bool DontUseEmbeddedBitmaps() const { return meEmbeddedBitmap == EMBEDDEDBITMAP_FALSE; } - bool DontUseAntiAlias() const { return meAntiAlias == ANTIALIAS_FALSE; } - bool DontUseHinting() const { return (meHinting == HINTING_FALSE) || (GetHintStyle() == HINT_NONE); } + FontAutoHint GetUseAutoHint() const + { return meAutoHint; } + FontHintStyle GetHintStyle() const + { return meHintStyle; } + bool DontUseEmbeddedBitmaps() const + { return meEmbeddedBitmap == EMBEDDEDBITMAP_FALSE; } + bool DontUseAntiAlias() const + { return meAntiAlias == ANTIALIAS_FALSE; } + bool DontUseHinting() const + { return (meHinting == HINTING_FALSE) || (GetHintStyle() == HINT_NONE); } + virtual void *GetPattern(void * /*pFace*/, bool /*bEmbolden*/) const + { return NULL; } }; // ------------------- @@ -237,3 +239,4 @@ bool ParseCMAP( const unsigned char* pRawData, int nRawLength, CmapResult& ); #endif // _SV_IMPFONT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index e136fcc06ade..6b6bce184770 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -180,3 +181,5 @@ private: }; #endif // _SV_IMPGRAPH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impimagetree.hxx b/vcl/inc/impimagetree.hxx index 9649fe2f5ec8..41c4f565ef22 100644 --- a/vcl/inc/impimagetree.hxx +++ b/vcl/inc/impimagetree.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,7 @@ #include <utility> #include <vector> -#include <hash_map> +#include <boost/unordered_map.hpp> #include "boost/noncopyable.hpp" #include "com/sun/star/uno/Reference.hxx" @@ -57,7 +58,11 @@ public: bool loadImage( rtl::OUString const & name, rtl::OUString const & style, - BitmapEx & bitmap, bool localized = false ); + BitmapEx & bitmap, bool localized = false, bool loadMissing = false ); + + bool loadDefaultImage( + rtl::OUString const & style, + BitmapEx& bitmap); void shutDown(); // a crude form of life cycle control (called from DeInitVCL; otherwise, @@ -65,15 +70,19 @@ public: // be too late for the destructors of the bitmaps in m_iconCache) private: + bool doLoadImage( + rtl::OUString const & name, rtl::OUString const & style, + BitmapEx & bitmap, bool localized); + typedef std::list< std::pair< rtl::OUString, com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > > > Zips; - typedef std::hash_map< + typedef boost::unordered_map< rtl::OUString, bool, rtl::OUStringHash > CheckStyleCache; - typedef std::hash_map< + typedef boost::unordered_map< rtl::OUString, std::pair< bool, BitmapEx >, rtl::OUStringHash > IconCache; rtl::OUString m_style; @@ -94,3 +103,5 @@ private: typedef salhelper::SingletonRef< ImplImageTree > ImplImageTreeSingletonRef; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impoct.hxx b/vcl/inc/impoct.hxx index 8b0e85021db9..daf6a275ada1 100644 --- a/vcl/inc/impoct.hxx +++ b/vcl/inc/impoct.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -174,3 +175,5 @@ inline void ImpNodeCache::ImplReleaseNode( OctreeNode* pNode ) } #endif // _SV_IMPOCT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impprn.hxx b/vcl/inc/impprn.hxx deleted file mode 100644 index 883bd55c66be..000000000000 --- a/vcl/inc/impprn.hxx +++ /dev/null @@ -1,140 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if 0 -#define _SV_IMPPRN_HXX - -#include <vcl/print.hxx> -#include <vcl/timer.hxx> -#ifndef _VCL_IMPDEL_HXX -#include <vcl/impdel.hxx> -#endif - -#include <vector> - -struct QueuePage; - -// ---------------- -// - ImplQPrinter - -// ---------------- - -/* - ImplQPrinter is on most systems a simple buffer that allows a potential - lengthy print job to be printed in the background. For this it saves all - normal drawing operations for each printed page to a metafile, then spooling - the metafiles timer based to a normal printer. The application can act in the meantime - including changing the original document without influencing the print job. - - On some systems (currently Mac/Aqua Cocoa) ImplQPrinter has the additional - purpose of adapting to the print system: here theprint systems starts a - job and will not return from that function until it has ended; to do so - it queries for each consecutive page to be printed. Also the Cocoa print system - needs to know the number of pages BEFORE starting a print job. Since our Printer - does not know that, we need to do the completing spooling to ImplQPrinter before - we can actually print to the real print system. Let's call this the pull model - instead of the push model (because the systems pulls the pages). -*/ - -class ImplQPrinter : public Printer, public vcl::DeletionNotifier -{ -private: - Printer* mpParent; - std::vector< QueuePage* > maQueue; - AutoTimer maTimer; - bool mbAborted; - bool mbUserCopy; - bool mbDestroyAllowed; - bool mbDestroyed; - - GDIMetaFile maCurPageMetaFile; - long mnMaxBmpDPIX; - long mnMaxBmpDPIY; - sal_uLong mnRestoreDrawMode; - int mnCurCopyCount; - - DECL_LINK( ImplPrintHdl, Timer* ); - - ~ImplQPrinter(); - - void ImplPrintMtf( GDIMetaFile& rMtf, long nMaxBmpDPIX, long nMaxBmpDPIY ); - - ImplQPrinter( const ImplQPrinter& rPrinter ); - Printer& operator =( const ImplQPrinter& rPrinter ); - - void PrePrintPage( QueuePage* ); - void PostPrintPage(); - -public: - - ImplQPrinter( Printer* pParent ); - void Destroy(); - - void StartQueuePrint(); - void EndQueuePrint(); - void AbortQueuePrint(); - void AddQueuePage( GDIMetaFile* pPage, sal_uInt16 nPage, sal_Bool bNewJobSetup ); - - bool IsUserCopy() const { return mbUserCopy; } - void SetUserCopy( bool bSet ) { mbUserCopy = bSet; } - - /** - used by pull implementation to emit the next page - */ - void PrintPage( unsigned int nPage ); - /** - used by pull implementation to get the number of physical pages - (that is how often PrintNextPage should be called) - */ - sal_uLong GetPrintPageCount() const; - - /** - used by pull implementation to get ranges of physical pages that - are to be printed on the same paper. If bIncludeOrientationChanges is true - then orientation changes will not break a page run; the implementation has - to rotate the page contents accordingly in that case. - - The returned vector contains all pages indices beginning a new medium and additionally - the index that of the last page+1 (for convenience, so the length of a range - is always v[i+1] - v[i]) - - Example: 5 pages, all A4 - return: [0 5] - - Example: 6 pages, beginning A4, switching tol A5 on fourth page, back to A4 on fifth page - return [0 3 4 6] - - returns an false in push model (error condition) - */ - bool GetPaperRanges( std::vector< sal_uLong >& o_rRanges, bool i_bIncludeOrientationChanges ) const; - - /** - get the jobsetup for a page - */ - ImplJobSetup* GetPageSetup( unsigned int nPage ) const; -}; - -#endif // _SV_IMPPRN_HXX diff --git a/vcl/inc/jobset.h b/vcl/inc/jobset.h index 981194080ede..b1cbdb9853f9 100644 --- a/vcl/inc/jobset.h +++ b/vcl/inc/jobset.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #include <tools/string.hxx> #include <vcl/sv.h> #include <vcl/prntypes.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <rtl/ustring.hxx> // ------------------ @@ -64,7 +65,7 @@ struct ImplJobSetup long mnPaperHeight; // paper height (100th mm) sal_uIntPtr mnDriverDataLen; // length of system specific data sal_uInt8* mpDriverData; // system specific data (will be streamed a byte block) - ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > maValueMap; + ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > maValueMap; ImplJobSetup(); ImplJobSetup( const ImplJobSetup& rJobSetup ); @@ -77,3 +78,5 @@ struct ImplJobSetup // Papierformat berechnet, wenn dieses ungleich PAPER_USER ist #endif // _SV_JOBSET_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/list.h b/vcl/inc/list.h index 82fff328681b..78c7edce2839 100644 --- a/vcl/inc/list.h +++ b/vcl/inc/list.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -97,3 +98,5 @@ extern "C" #endif /* __CLIST_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/outdata.hxx b/vcl/inc/outdata.hxx index 5d2852444767..2f4a9b5ed7aa 100644 --- a/vcl/inc/outdata.hxx +++ b/vcl/inc/outdata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,3 +48,5 @@ inline int ImplIsColorTransparent( Color aColor ) } #endif // _SV_OUTDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h index 50aee1fbe049..43ba77df8ab7 100644 --- a/vcl/inc/outdev.h +++ b/vcl/inc/outdev.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -217,11 +218,11 @@ private: // cache of recently used font instances struct IFSD_Equal { bool operator()( const ImplFontSelectData&, const ImplFontSelectData& ) const; }; struct IFSD_Hash { size_t operator()( const ImplFontSelectData& ) const; }; - typedef ::std::hash_map<ImplFontSelectData,ImplFontEntry*,IFSD_Hash,IFSD_Equal > FontInstanceList; + typedef ::boost::unordered_map<ImplFontSelectData,ImplFontEntry*,IFSD_Hash,IFSD_Equal > FontInstanceList; FontInstanceList maFontInstanceList; // cache of recently requested font names vs. selected font names - typedef ::std::hash_map<String,String,FontNameHash> FontNameList; + typedef ::boost::unordered_map<String,String,FontNameHash> FontNameList; FontNameList maFontNameList; public: @@ -262,3 +263,5 @@ struct ImplOutDevData void ImplFreeOutDevFontData(); #endif // _SV_OUTDEV_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx index aabc6bd2797f..faf2b00793f2 100644 --- a/vcl/inc/outfont.hxx +++ b/vcl/inc/outfont.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,6 @@ #define _SV_OUTFONT_HXX #include <tools/string.hxx> -#include <tools/list.hxx> #include <i18npool/lang.h> #include <tools/gen.hxx> #include <tools/solar.h> @@ -37,7 +37,7 @@ #include <unotools/fontdefs.hxx> #include <vcl/vclenum.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> class ImplDevFontListData; class ImplGetDevFontList; @@ -192,7 +192,7 @@ private: mutable bool mbMatchData; // true if matching attributes are initialized bool mbMapNames; // true if MapNames are available - typedef std::hash_map<const String, ImplDevFontListData*,FontNameHash> DevFontList; + typedef boost::unordered_map<const String, ImplDevFontListData*,FontNameHash> DevFontList; DevFontList maDevFontList; ImplPreMatchFontSubstitution* mpPreMatchHook; // device specific prematch substitution @@ -351,7 +351,7 @@ private: // TODO: at least the ones which just differ in orientation, stretching or height typedef ::std::pair<sal_UCS4,FontWeight> GFBCacheKey; struct GFBCacheKey_Hash{ size_t operator()( const GFBCacheKey& ) const; }; - typedef ::std::hash_map<GFBCacheKey,String,GFBCacheKey_Hash> UnicodeFallbackList; + typedef ::boost::unordered_map<GFBCacheKey,String,GFBCacheKey_Hash> UnicodeFallbackList; UnicodeFallbackList* mpUnicodeFallbackList; }; @@ -404,3 +404,4 @@ private: #endif // _SV_OUTFONT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pch/precompiled_vcl.cxx b/vcl/inc/pch/precompiled_vcl.cxx index af8e2048bd88..66c95bc3b2e1 100644 --- a/vcl/inc/pch/precompiled_vcl.cxx +++ b/vcl/inc/pch/precompiled_vcl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,3 +28,4 @@ #include "precompiled_vcl.hxx" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx index 37ba36569834..c07523757071 100644 --- a/vcl/inc/pch/precompiled_vcl.hxx +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,3 +32,4 @@ #include <tools/debug.hxx> #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/print.h b/vcl/inc/print.h index b90eaae756bf..dc54ca28dc8b 100644 --- a/vcl/inc/print.h +++ b/vcl/inc/print.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,7 @@ #include "rtl/ustring.hxx" #include <vector> -#include <hash_map> +#include <boost/unordered_map.hpp> struct SalPrinterQueueInfo; class QueueInfo; @@ -60,7 +61,7 @@ struct ImplPrnQueueData class VCL_PLUGIN_PUBLIC ImplPrnQueueList { public: - std::hash_map< rtl::OUString, sal_Int32, rtl::OUStringHash > + boost::unordered_map< rtl::OUString, sal_Int32, rtl::OUStringHash > m_aNameToIndex; std::vector< ImplPrnQueueData > m_aQueueInfos; std::vector< rtl::OUString > m_aPrinterList; @@ -81,3 +82,5 @@ void SAL_DLLPRIVATE ImplUpdateJobSetupPaper( JobSetup& rJobSetup ); #endif // _SV_PRINT_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx index 8201610593af..d162bc07ea8a 100644 --- a/vcl/inc/printdlg.hxx +++ b/vcl/inc/printdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,7 +64,6 @@ namespace vcl FixedLine maHorzDim; FixedLine maVertDim; - bool useHCColorReplacement() const; public: PrintPreviewWindow( Window* pParent, const ResId& ); virtual ~PrintPreviewWindow(); @@ -174,9 +174,7 @@ namespace vcl CheckBox maReverseOrderBox; Image maCollateImg; - Image maCollateHCImg; Image maNoCollateImg; - Image maNoCollateHCImg; long mnCollateUIMode; @@ -335,3 +333,5 @@ namespace vcl #endif // _SV_PRNDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/printergfx.hxx b/vcl/inc/printergfx.hxx index c11bfa867148..7fea405a558e 100644 --- a/vcl/inc/printergfx.hxx +++ b/vcl/inc/printergfx.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,10 @@ #include "sallayout.hxx" #include "osl/file.hxx" #include "tools/gen.hxx" +#include "vclpluginapi.h" #include <list> -#include <hash_map> +#include <boost/unordered_map.hpp> namespace psp { @@ -138,7 +140,7 @@ struct CharacterMetric; * vcl/unx/source/gdi/salgdi2.cxx */ -class PrinterBmp +class VCLPLUG_GEN_PUBLIC PrinterBmp { public: @@ -181,7 +183,7 @@ struct GraphicsStatus class Font3; -class PrinterGfx +class VCLPLUG_GEN_PUBLIC PrinterGfx { private: @@ -252,7 +254,7 @@ private: /* font / font substitution */ friend class Font3; - const ::std::hash_map< fontID, fontID >* mpFontSubstitutes; + const ::boost::unordered_map< fontID, fontID >* mpFontSubstitutes; int getCharWidth (sal_Bool b_vert, sal_Unicode n_char, CharacterMetric *p_bbox); fontID getCharMetric (const Font3 &rFont, sal_Unicode n_char, @@ -440,3 +442,4 @@ public: #endif /* _PSPRINT_PRINTERGFX_HXX_ */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/printerjob.hxx b/vcl/inc/printerjob.hxx index cdf8745febcc..62a1c078bc32 100644 --- a/vcl/inc/printerjob.hxx +++ b/vcl/inc/printerjob.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -147,3 +148,4 @@ public: #endif /* _PSPRINT_PRINTERJOB_HXX_ */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/region.h b/vcl/inc/region.h index b45ab91be149..5814e981aac2 100644 --- a/vcl/inc/region.h +++ b/vcl/inc/region.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -132,3 +133,5 @@ public: }; #endif // _SV_REGION_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx index b19c2ac33aeb..d880be0d6d37 100644 --- a/vcl/inc/salbmp.hxx +++ b/vcl/inc/salbmp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,11 +29,11 @@ #ifndef _SV_SALBMP_HXX #define _SV_SALBMP_HXX -#ifndef _TL_GEN_HXX #include <tools/gen.hxx> -#endif #include <vcl/dllapi.h> +#include <com/sun/star/rendering/XBitmapCanvas.hpp> + struct BitmapBuffer; class SalGraphics; class BitmapPalette; @@ -52,6 +53,9 @@ public: SalGraphics* pGraphics ) = 0; virtual bool Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount ) = 0; + virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, + Size& rSize, + bool bMask = false ) = 0; virtual void Destroy() = 0; virtual Size GetSize() const = 0; virtual sal_uInt16 GetBitCount() const = 0; @@ -63,3 +67,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/saldatabasic.hxx b/vcl/inc/saldatabasic.hxx index 0a27089ceb47..9d4eb0fc73f9 100644 --- a/vcl/inc/saldatabasic.hxx +++ b/vcl/inc/saldatabasic.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,3 +60,5 @@ inline SalData* GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index 8fbbe96ba8bf..51c6bcf7e73e 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,9 +34,7 @@ #ifdef __cplusplus -#ifndef _SV_PTRSTYLE_HXX #include <vcl/ptrstyle.hxx> -#endif #include <vcl/sndstyle.hxx> #endif // __cplusplus @@ -44,9 +43,7 @@ #include <tools/gen.hxx> #include <vcl/region.hxx> -#ifndef _VCL_IMPDEL_HXX #include <vcl/impdel.hxx> -#endif #include <rtl/ustring.hxx> #include <vcl/keycod.hxx> @@ -135,7 +132,8 @@ typedef sal_uInt64 SalExtStyle; #ifdef __cplusplus -using namespace rtl; +using ::rtl::OUString; +using ::rtl::OString; // ------------ // - SalFrame - @@ -250,6 +248,15 @@ public: virtual SalPointerState GetPointerState() = 0; + struct SalIndicatorState + { + sal_uInt16 mnState; + }; + + virtual SalIndicatorState GetIndicatorState() = 0; + + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) = 0; + // set new parent window virtual void SetParent( SalFrame* pNewParent ) = 0; // reparent window to act as a plugin; implementation @@ -260,6 +267,8 @@ public: // move the frame to a new screen virtual void SetScreenNumber( unsigned int nScreen ) = 0; + virtual void SetApplicationID( const rtl::OUString &rApplicationID) = 0; + // shaped system windows // set clip region to none (-> rectangular windows, normal state) virtual void ResetClipRegion() = 0; @@ -290,3 +299,5 @@ public: #endif // __cplusplus #endif // _SV_SALFRAME_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 1a9b9ccaea59..f2aa64a9549a 100755..100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,9 +34,10 @@ #include "vcl/sv.h" #include "vcl/dllapi.h" #include "vcl/salgtype.hxx" -#include "vos/thread.hxx" +#include "osl/thread.hxx" #include "vcl/outdev.hxx" #include "vcl/salnativewidgets.hxx" +#include "sallayout.hxx" #include <map> @@ -197,7 +199,7 @@ public: // get device resolution virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) = 0; // get the depth of the device - virtual sal_uInt16 GetBitCount() = 0; + virtual sal_uInt16 GetBitCount() const = 0; // get the width of the device virtual long GetGraphicsWidth() const = 0; @@ -233,6 +235,8 @@ public: virtual sal_uLong GetKernPairs( sal_uLong nMaxPairCount, ImplKernPairData* ) = 0; // get the repertoire of the current font virtual const ImplFontCharMap* GetImplFontCharMap() const = 0; + // get the layout capabilities of the current font + virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0; // graphics must fill supplied font list virtual void GetDevFontList( ImplDevFontList* ) = 0; // graphics should call ImplAddDevFontSubstitute on supplied @@ -295,8 +299,8 @@ public: Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ) = 0; - virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ) = 0; - virtual sal_Bool GetGlyphOutline( long nIndex, basegfx::B2DPolyPolygon& ) = 0; + virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ) = 0; + virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ) = 0; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0; virtual void DrawServerFontLayout( const ServerFontLayout& ) = 0; @@ -484,3 +488,5 @@ public: }; #endif // _SV_SALGDI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salgeom.hxx b/vcl/inc/salgeom.hxx index 3d59e6199fa7..c512d0a195fa 100644 --- a/vcl/inc/salgeom.hxx +++ b/vcl/inc/salgeom.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,3 +50,5 @@ typedef struct _SalFrameGeometry { } SalFrameGeometry; #endif // _SV_SALGEOM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salimestatus.hxx b/vcl/inc/salimestatus.hxx index 20184a059d9a..13362c20071d 100644 --- a/vcl/inc/salimestatus.hxx +++ b/vcl/inc/salimestatus.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,3 +44,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index 51f1f5b3b4e0..d878dd7fea80 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -64,8 +65,6 @@ struct SystemGraphicsData; struct SystemWindowData; class Menu; -namespace vos { class IMutex; } - // --------------- // - SalInstance - // --------------- @@ -123,7 +122,7 @@ public: virtual SalBitmap* CreateSalBitmap() = 0; // YieldMutex - virtual vos::IMutex* GetYieldMutex() = 0; + virtual osl::SolarMutex* GetYieldMutex() = 0; virtual sal_uLong ReleaseYieldMutex() = 0; virtual void AcquireYieldMutex( sal_uLong nCount ) = 0; // return true, if yield mutex is owned by this thread, else false @@ -167,6 +166,11 @@ public: virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource(); virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) = 0; + + // callbacks for printer updates + virtual void updatePrinterUpdate() {} + virtual void jobStartedPrinterUpdate() {} + virtual void jobEndedPrinterUpdate() {} }; // called from SVMain @@ -196,6 +200,8 @@ void DeInitSalMain(); // ---------- // Callbacks (indepen in \sv\source\app\svmain.cxx) -VCL_DLLPUBLIC sal_Bool SVMain(); +VCL_DLLPUBLIC int SVMain(); #endif // _SV_SALINST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index bb5c6e829a70..b91185769b27 100755..100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -388,3 +389,5 @@ private: #undef SalGraphics #endif // _SV_SALLAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salmenu.hxx b/vcl/inc/salmenu.hxx index 030952388dfb..63fb12ee4a84 100644 --- a/vcl/inc/salmenu.hxx +++ b/vcl/inc/salmenu.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -99,3 +100,4 @@ public: #endif // _SV_SALMENU_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salobj.hxx b/vcl/inc/salobj.hxx index 5ece9e93613d..d83379d3a09a 100644 --- a/vcl/inc/salobj.hxx +++ b/vcl/inc/salobj.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,6 +72,8 @@ public: virtual void SetBackground() = 0; virtual void SetBackground( SalColor nSalColor ) = 0; + virtual void SetForwardKey( sal_Bool /*bEnable*/ ) {} + virtual const SystemEnvData* GetSystemData() const = 0; virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ) = 0; @@ -90,3 +93,5 @@ public: }; #endif // _SV_SALOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx index 572b766ea909..e820614e4cdd 100644 --- a/vcl/inc/salprn.hxx +++ b/vcl/inc/salprn.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -135,3 +136,5 @@ public: // public for Sal Implementation }; #endif // _SV_SALPRN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salptype.hxx b/vcl/inc/salptype.hxx index 136821b76855..ca47f599271c 100644 --- a/vcl/inc/salptype.hxx +++ b/vcl/inc/salptype.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,3 +59,5 @@ class SalPrinter; typedef long (*SALPRNABORTPROC)( void* pInst, SalPrinter* pPrinter ); #endif // _SV_SALPTYPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salsession.hxx b/vcl/inc/salsession.hxx index c11054a79eef..c912565a920c 100644 --- a/vcl/inc/salsession.hxx +++ b/vcl/inc/salsession.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -115,3 +116,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salsys.hxx b/vcl/inc/salsys.hxx index da16d8d5b656..2f2f6d08e9e6 100644 --- a/vcl/inc/salsys.hxx +++ b/vcl/inc/salsys.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -144,3 +145,5 @@ public: SalSystem* ImplGetSalSystem(); #endif // _SV_SALSYS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx index 6bf4b820a176..68ed56a901d8 100644 --- a/vcl/inc/salvd.hxx +++ b/vcl/inc/salvd.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,3 +57,5 @@ public: // public for Sal Implementation }; #endif // _SV_SALVD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index 55753465a860..d8bd6c527f85 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -344,3 +345,5 @@ struct SalInputContext typedef void (*SALTIMERPROC)(); #endif // _SV_SALWTYPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx index 7758545dd37c..3f9dbcfc1af2 100644 --- a/vcl/inc/sft.hxx +++ b/vcl/inc/sft.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -72,6 +73,8 @@ #include <vector> +#include "vcl/fontcapabilities.hxx" + namespace vcl { @@ -113,7 +116,6 @@ namespace vcl }; /** Value of the width member of the TTGlobalFontInfo struct */ -#ifndef OS2 enum WidthClass { FWIDTH_ULTRA_CONDENSED = 1, /**< 50% of normal */ FWIDTH_EXTRA_CONDENSED = 2, /**< 62.5% of normal */ @@ -125,7 +127,6 @@ namespace vcl FWIDTH_EXTRA_EXPANDED = 8, /**< 150% of normal */ FWIDTH_ULTRA_EXPANDED = 9 /**< 200% of normal */ }; -#endif // OS2 #endif /* FW_THIN */ /** Type of the 'kern' table, stored in _TrueTypeFont::kerntype */ @@ -289,7 +290,7 @@ namespace vcl * @ingroup sft */ int VCL_DLLPUBLIC OpenTTFontBuffer(void* pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTypeFont** ttf); /*FOLD01*/ -#if !defined(WIN32) && !defined(OS2) +#if !defined(WIN32) /** * TrueTypeFont constructor. * Reads the font file and allocates the memory for the structure. @@ -302,6 +303,12 @@ namespace vcl int VCL_DLLPUBLIC OpenTTFontFile(const char *fname, sal_uInt32 facenum, TrueTypeFont** ttf); #endif + void getTTScripts(std::vector< sal_uInt32 > &rScriptTags, const unsigned char* pTable, size_t nLength); + bool getTTCoverage( + boost::dynamic_bitset<sal_uInt32> &rUnicodeCoverage, + boost::dynamic_bitset<sal_uInt32> &rCodePageCoverage, + const unsigned char* pTable, size_t nLength); + /** * TrueTypeFont destructor. Deallocates the memory. * @ingroup sft @@ -540,24 +547,6 @@ namespace vcl */ void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info); -#ifdef TEST5 -/** - * Returns kerning information for an array of glyphs. - * Kerning is not cumulative. - * kern[i] contains kerning information for a pair of glyphs at positions i and i+1 - * - * @param ttf pointer to a TrueTypeFont structure - * @param glyphs array of source glyphs - * @param nglyphs number of glyphs in the array - * @param wmode writing mode: 0 - horizontal, 1 - vertical - * @param kern array of KernData structures. It should contain nglyphs-1 elements - * @see KernData - * @ingroup sft - * - */ - void KernGlyphs(TrueTypeFont *ttf, sal_uInt16 *glyphs, int nglyphs, int wmode, KernData *kern); -#endif - /** * Returns nonzero if font is a symbol encoded font */ @@ -630,3 +619,5 @@ namespace vcl } // namespace vcl #endif /* __SUBFONT_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/subedit.hxx b/vcl/inc/subedit.hxx index 3ea1eaffa864..17b22e2b5587 100644 --- a/vcl/inc/subedit.hxx +++ b/vcl/inc/subedit.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,3 +47,5 @@ public: }; #endif // _SV_SUBEDIT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 5dba6441cd1c..21e46ae22629 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,15 +29,14 @@ #ifndef _SV_SVDATA_HXX #define _SV_SVDATA_HXX -#include "rtl/ref.hxx" +#include <osl/thread.hxx> +#include <rtl/ref.hxx> -#include "vos/thread.hxx" - -#include "tools/string.hxx" #include "tools/gen.hxx" #include "tools/shl.hxx" #include "tools/link.hxx" #include "tools/fldunit.hxx" +#include "tools/string.hxx" #include "tools/color.hxx" #include "tools/debug.hxx" @@ -50,7 +50,7 @@ #include "com/sun/star/uno/Reference.hxx" -#include <hash_map> +#include <boost/unordered_map.hpp> namespace com { namespace sun { @@ -73,7 +73,6 @@ class Point; class Rectangle; class ImpResMgr; class ResMgr; -class UniqueIndex; class ImplAccelManager; class ImplDevFontList; class ImplFontCache; @@ -117,8 +116,6 @@ class SalI18NImeStatus; class DockingManager; class VclEventListeners2; -namespace vos { class OMutex; } -namespace vos { class OCondition; } namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; } namespace utl { class DefaultFontConfiguration; class FontSubstConfiguration; } @@ -184,7 +181,7 @@ struct ImplSVAppData */ ImeStatusWindowMode meShowImeStatusWindow; - DECL_STATIC_LINK( ImplSVAppData, ImplQuitMsg, void* ); + DECL_STATIC_LINK( ImplSVAppData, ImplQuitMsg, void* ); }; @@ -241,7 +238,6 @@ struct ImplSVWinData Window* mpTrackWin; // window, that is in tracking mode AutoTimer* mpTrackTimer; // tracking timer ImageList* mpMsgBoxImgList; // ImageList for MessageBox - ImageList* mpMsgBoxHCImgList; // ImageList for MessageBox (high contrast mode) Window* mpAutoScrollWin; // window, that is in AutoScrollMode mode sal_uInt16 mnTrackFlags; // tracking flags sal_uInt16 mnAutoScrollFlags; // auto scroll flags @@ -267,9 +263,7 @@ struct ImplSVCtrlData 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 sal_uInt16 mnCheckStyle; // CheckBox-Style for ImageList-Update sal_uInt16 mnRadioStyle; // Radio-Style for ImageList-Update @@ -367,14 +361,14 @@ struct ImplSVData DockingManager* mpDockingManager; sal_Bool mbIsTestTool; - vos::OThread::TThreadIdentifier mnMainThreadId; + oslThreadIdentifier mnMainThreadId; rtl::Reference< vcl::DisplayConnection > mxDisplayConnection; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxAccessBridge; com::sun::star::uno::Reference< com::sun::star::frame::XSessionManagerClient > xSMClient; ::vcl::SettingsConfigItem* mpSettingsConfigItem; std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList; - std::hash_map< int, rtl::OUString >* mpPaperNames; + boost::unordered_map< int, rtl::OUString >* mpPaperNames; }; void ImplInitSVData(); @@ -418,8 +412,6 @@ FieldUnitStringList* ImplGetCleanedFieldUnits(); inline const String& ImplGetSVEmptyStr() { return String::EmptyString(); } -inline const ByteString& ImplGetSVEmptyByteStr() - { return ByteString::EmptyString(); } // ----------------------------------------------------------------------- @@ -468,3 +460,5 @@ struct ImplSVEvent }; #endif // _SV_SVDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc index 61622bcabade..bc76c70e1ebe 100644 --- a/vcl/inc/svids.hrc +++ b/vcl/inc/svids.hrc @@ -39,7 +39,6 @@ #define SV_RESID_BITMAP_RADIO 1010 #define SV_RESID_BITMAP_MSGBOX 1020 -#define SV_RESID_BITMAP_MSGBOX_HC 1021 #define SV_RESID_BITMAP_PIN 1030 @@ -51,12 +50,9 @@ #define SV_RESID_BITMAP_SCROLLMSK 1050 #define SV_RESID_BITMAP_SCROLLBMP 1051 #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 RID_STR_PAPERNAMES 1070 @@ -142,8 +138,6 @@ #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 @@ -235,8 +229,6 @@ #define SV_ICON_LARGE_START 24000 #define SV_ICON_SMALL_START 25000 -#define SV_ICON_LARGE_HC_START 26000 -#define SV_ICON_SMALL_HC_START 27000 #define SV_ICON_ID_OFFICE 1 #define SV_ICON_ID_TEXT 2 diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx index 183cb5ac9b0f..5902573f8746 100755..100644 --- a/vcl/inc/textlayout.hxx +++ b/vcl/inc/textlayout.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -134,3 +135,5 @@ namespace vcl //........................................................................ #endif // VCL_TEXTLAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h index 4fd3238647d0..aec0c11cf790 100644 --- a/vcl/inc/toolbox.h +++ b/vcl/inc/toolbox.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -180,3 +181,5 @@ struct ImplToolBoxPrivateData #endif // _SV_TOOLBOX_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/XIM.h b/vcl/inc/unx/XIM.h index b00634090b5d..9a061edd1ed4 100644 --- a/vcl/inc/unx/XIM.h +++ b/vcl/inc/unx/XIM.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -135,3 +136,5 @@ typedef struct _XIMSwitchIMNotifyCallbackStruct { #define XNLookupDoneCallback "lookupDoneCallback" #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/cdeint.hxx b/vcl/inc/unx/cdeint.hxx index 572f358955c1..c2b7d578b137 100644 --- a/vcl/inc/unx/cdeint.hxx +++ b/vcl/inc/unx/cdeint.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,3 +43,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/saltimer.h b/vcl/inc/unx/desktops.hxx index 069e97755d05..de4ebb8eab01 100644 --- a/vcl/os2/inc/saltimer.h +++ b/vcl/inc/unx/desktops.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,20 +26,18 @@ * ************************************************************************/ -#ifndef _SV_SALTIMER_H -#define _SV_SALTIMER_H +#ifndef INCLUDED_VCL_DESKTOPS_HXX +#define INCLUDED_VCL_DESKTOPS_HXX -#include <vcl/saltimer.hxx> +enum DesktopType { + DESKTOP_NONE, // headless, i.e. no X connection at all + DESKTOP_UNKNOWN, // unknown desktop, simple WM, etc. + DESKTOP_GNOME, + DESKTOP_KDE, + DESKTOP_KDE4, + DESKTOP_CDE +}; // keep in sync with desktop_strings[] in salplug.cxx -class Os2SalTimer : public SalTimer -{ -public: - Os2SalTimer() {} - virtual ~Os2SalTimer(); +#endif // INCLUDED_VCL_DESKTOPS_HXX - // overload all pure virtual methods - void Start( ULONG nMS ); - void Stop(); -}; - -#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/dtint.hxx b/vcl/inc/unx/dtint.hxx index 6e6cf13575ed..010a0417d89b 100644 --- a/vcl/inc/unx/dtint.hxx +++ b/vcl/inc/unx/dtint.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -69,3 +70,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/atkbridge.hxx b/vcl/inc/unx/gtk/atkbridge.hxx index 9d51ed0cc194..b54c0a517914 100644 --- a/vcl/inc/unx/gtk/atkbridge.hxx +++ b/vcl/inc/unx/gtk/atkbridge.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,3 +35,5 @@ bool VCLPLUG_GTK_PUBLIC InitAtkBridge(void); void VCLPLUG_GTK_PUBLIC DeInitAtkBridge(void); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index bba4399b76c5..307a3f2b3e01 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,6 +41,39 @@ #include <list> +inline GdkWindow * widget_get_window(GtkWidget *widget) +{ +#if GTK_CHECK_VERSION(3,0,0) + return gtk_widget_get_window(widget); +#else + return widget->window; +#endif +} + +inline void widget_set_can_focus(GtkWidget *widget, gboolean can_focus) +{ +#if GTK_CHECK_VERSION(3,0,0) + return gtk_widget_set_can_focus(widget, can_focus); +#else + if (can_focus) + GTK_WIDGET_SET_FLAGS( widget, GTK_CAN_FOCUS ); + else + GTK_WIDGET_UNSET_FLAGS( widget, GTK_CAN_FOCUS ); +#endif +} + +inline void widget_set_can_default(GtkWidget *widget, gboolean can_default) +{ +#if GTK_CHECK_VERSION(3,0,0) + return gtk_widget_set_can_default(widget, can_default); +#else + if (can_default) + GTK_WIDGET_SET_FLAGS( widget, GTK_CAN_DEFAULT ); + else + GTK_WIDGET_UNSET_FLAGS( widget, GTK_CAN_DEFAULT ); +#endif +} + class GtkData : public X11SalData { public: @@ -61,7 +95,7 @@ class GtkSalDisplay : public SalDisplay bool m_bStartupCompleted; std::vector< int > m_aXineramaScreenIndexMap; - GdkCursor* getFromXPM( const char *pBitmap, const char *pMask, + GdkCursor* getFromXPM( const unsigned char *pBitmap, const unsigned char *pMask, int nWidth, int nHeight, int nXHot, int nYHot ); public: GtkSalDisplay( GdkDisplay* pDisplay ); @@ -77,9 +111,8 @@ public: virtual int GetDefaultMonitorNumber() const; - static GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event, - GdkEvent* event, - gpointer data ); + GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event, + GdkEvent* event ); inline bool HasMoreEvents() { return m_aUserEvents.size() > 1; } inline void EventGuardAcquire() { osl_acquireMutex( hEventGuard_ ); } inline void EventGuardRelease() { osl_releaseMutex( hEventGuard_ ); } @@ -91,3 +124,5 @@ public: #endif // _VCL_GTKDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index d03537361056..6caf39dc9644 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,9 +30,12 @@ #define _VCL_GTKFRAME_HXX #include <tools/prex.h> -#include <gtk/gtk.h> #include <gdk/gdk.h> #include <gdk/gdkx.h> +#include <gtk/gtk.h> +#if GTK_CHECK_VERSION(3,0,0) +# include <gtk/gtkx.h> +#endif #include <gdk/gdkkeysyms.h> #include <tools/postx.h> @@ -46,6 +50,13 @@ class GtkSalGraphics; class GtkSalDisplay; +#if GTK_CHECK_VERSION(3,0,0) +typedef XLIB_Window GdkNativeWindow; +#define GDK_WINDOW_XWINDOW(o) GDK_WINDOW_XID(o) +#define gdk_set_sm_client_id(i) gdk_x11_set_sm_client_id(i) +#define gdk_window_foreign_new_for_display(a,b) gdk_x11_window_foreign_new_for_display(a,b) +#endif + class GtkSalFrame : public SalFrame { static const int nMaxGraphics = 2; @@ -117,11 +128,12 @@ class GtkSalFrame : public SalFrame return (event != NULL) && (event->window == window) && (event->send_event == send_event) - && (event->state == state) + // ignore non-Gdk state bits, e.g., these used by IBus + && ((event->state & GDK_MODIFIER_MASK) == (state & GDK_MODIFIER_MASK)) && (event->keyval == keyval) && (event->hardware_keycode == hardware_keycode) && (event->group == group) - && (event->time - time < 3) + && (event->time - time < 300) ; } }; @@ -183,13 +195,13 @@ class GtkSalFrame : public SalFrame guint m_nGSMCookie; int m_nWorkArea; bool m_bFullscreen; - bool m_bSingleAltPress; bool m_bDefaultPos; bool m_bDefaultSize; bool m_bSendModChangeOnRelease; bool m_bWindowIsGtkPlug; bool m_bSetFocusOnMap; String m_aTitle; + rtl::OUString m_sWMClass; IMHandler* m_pIMHandler; @@ -197,7 +209,11 @@ class GtkSalFrame : public SalFrame Size m_aMinSize; Rectangle m_aRestorePosSize; +#if GTK_CHECK_VERSION(3,0,0) + cairo_region_t* m_pRegion; +#else GdkRegion* m_pRegion; +#endif void Init( SalFrame* pParent, sal_uLong nStyle ); void Init( SystemParentData* pSysData ); @@ -206,6 +222,7 @@ class GtkSalFrame : public SalFrame // signals static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer ); static void signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer ); + static gboolean signalDraw( GtkWidget*, cairo_t *cr, gpointer ); static gboolean signalExpose( GtkWidget*, GdkEventExpose*, gpointer ); static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer ); static gboolean signalMap( GtkWidget*, GdkEvent*, gpointer ); @@ -218,7 +235,7 @@ class GtkSalFrame : public SalFrame static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer ); static gboolean signalCrossing( GtkWidget*, GdkEventCrossing*, gpointer ); static gboolean signalVisibility( GtkWidget*, GdkEventVisibility*, gpointer ); - static void signalDestroy( GtkObject*, gpointer ); + static void signalDestroy( GtkWidget*, gpointer ); void Center(); void SetDefaultSize(); @@ -268,6 +285,8 @@ class GtkSalFrame : public SalFrame void createNewWindow( XLIB_Window aParent, bool bXEmbed, int nScreen ); void askForXEmbedFocus( sal_Int32 nTimecode ); + void updateWMClass(); + DECL_LINK( ImplDelayedFullScreenHdl, void* ); public: GtkSalFrame( SalFrame* pParent, sal_uLong nStyle ); @@ -371,6 +390,10 @@ public: // get current modifier and button mask virtual SalPointerState GetPointerState(); + virtual SalIndicatorState GetIndicatorState(); + + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ); + // set new parent window virtual void SetParent( SalFrame* pNewParent ); // reparent window to act as a plugin; implementation @@ -381,6 +404,7 @@ public: virtual void SetBackgroundBitmap( SalBitmap* ); virtual void SetScreenNumber( unsigned int ); + virtual void SetApplicationID( const rtl::OUString &rWMClass ); // shaped system windows // set clip region to none (-> rectangular windows, normal state) @@ -405,3 +429,5 @@ GType ooo_fixed_get_type( void ); } // extern "C" #endif //_VCL_GTKFRAME_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index bc16e94f832e..41e500c49027 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,13 +37,25 @@ #include <unx/salgdi.h> +#if GTK_CHECK_VERSION(3,0,0) + +// Disabled for gtk3 - use legacy theming code +#define GTK_GRAPHICS_DISABLED +class GtkSalFrame; +class GtkSalGraphics : public X11SalGraphics { +public: + GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ); +}; + +#else + class GtkSalGraphics : public X11SalGraphics { GtkWidget *m_pWindow; Region m_aClipRegion; public: - GtkSalGraphics( GtkWidget *window ) + GtkSalGraphics( GtkSalFrame *, GtkWidget *window ) : m_pWindow( window ), m_aClipRegion( REGION_NULL ) {} @@ -94,6 +107,11 @@ protected: GdkPixmap* NWGetPixmapFromScreen( Rectangle srcRect ); sal_Bool NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect ); + sal_Bool NWPaintGTKButtonReal( GtkWidget* button, GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + const Rectangle& rControlRectangle, + const clipList& rClipList, + ControlState nState, const ImplControlValue& aValue, + const OUString& rCaption ); sal_Bool NWPaintGTKButton( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, @@ -177,4 +195,8 @@ protected: const OUString& rCaption ); }; +#endif // !gtk3 + #endif // _VCL_GTKGDI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index 40e18b41f7dc..506c78191115 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -103,3 +104,5 @@ public: }; #endif // _VCL_GTKINST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkobject.hxx b/vcl/inc/unx/gtk/gtkobject.hxx index 18c2fa95d13d..69768743db50 100644 --- a/vcl/inc/unx/gtk/gtkobject.hxx +++ b/vcl/inc/unx/gtk/gtkobject.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,12 +38,16 @@ class GtkSalObject : public SalObject { SystemChildData m_aSystemData; GtkWidget* m_pSocket; +#if GTK_CHECK_VERSION(3,0,0) + cairo_region_t* m_pRegion; +#else GdkRegion* m_pRegion; +#endif // signals static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer ); static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer ); - static void signalDestroy( GtkObject*, gpointer ); + static void signalDestroy( GtkWidget*, gpointer ); public: GtkSalObject( GtkSalFrame* pParent, sal_Bool bShow = sal_True ); virtual ~GtkSalObject(); @@ -62,9 +67,13 @@ public: virtual void SetBackground(); virtual void SetBackground( SalColor nSalColor ); + virtual void SetForwardKey( sal_Bool bEnable ); + virtual const SystemEnvData* GetSystemData() const; virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); }; #endif // _SV_SALOBJ_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/i18n_cb.hxx b/vcl/inc/unx/i18n_cb.hxx index 3a84aa2667c1..43b76615e8ed 100644 --- a/vcl/inc/unx/i18n_cb.hxx +++ b/vcl/inc/unx/i18n_cb.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -93,3 +94,5 @@ typedef struct { } preedit_data_t; #endif /* _SAL_I18N_CALLBACK_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/i18n_ic.hxx b/vcl/inc/unx/i18n_ic.hxx index 977d7f3e3a6f..b038d179f4a2 100644 --- a/vcl/inc/unx/i18n_ic.hxx +++ b/vcl/inc/unx/i18n_ic.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -98,3 +99,4 @@ private: #endif // _SAL_I18N_INPUTCONTEXT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/i18n_im.hxx b/vcl/inc/unx/i18n_im.hxx index c54749772dd3..e363a47d0c85 100644 --- a/vcl/inc/unx/i18n_im.hxx +++ b/vcl/inc/unx/i18n_im.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,3 +64,4 @@ public: #endif // _SAL_I18N_INPUTMETHOD_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/i18n_keysym.hxx b/vcl/inc/unx/i18n_keysym.hxx index 641d00dc02c0..e34d80900b79 100644 --- a/vcl/inc/unx/i18n_keysym.hxx +++ b/vcl/inc/unx/i18n_keysym.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -69,3 +70,4 @@ sal_Unicode KeysymToUnicode (KeySym nKeySym); #endif /* _SAL_I18N_KEYSYM_HXX */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/i18n_status.hxx b/vcl/inc/unx/i18n_status.hxx index 46e4e48f76e1..0b88d778e966 100644 --- a/vcl/inc/unx/i18n_status.hxx +++ b/vcl/inc/unx/i18n_status.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,6 @@ #include <tools/gen.hxx> #include <rtl/ustring.hxx> - #include <salimestatus.hxx> #include <vector> @@ -122,3 +122,5 @@ public: } // namespace #endif // _SAL_I18N_STATUS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/i18n_xkb.hxx b/vcl/inc/unx/i18n_xkb.hxx index 2d75ea6f7d23..c1a1a2864861 100644 --- a/vcl/inc/unx/i18n_xkb.hxx +++ b/vcl/inc/unx/i18n_xkb.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -113,3 +114,4 @@ SalI18N_KeyboardExtension::GetEventBase() const #endif // _SAL_I18N_XKBDEXTENSION_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/kde/kde_headers.h b/vcl/inc/unx/kde/kde_headers.h new file mode 100644 index 000000000000..7ec45fdc383d --- /dev/null +++ b/vcl/inc/unx/kde/kde_headers.h @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_VCL_KDE_HEADERS_H +#define INCLUDED_VCL_KDE_HEADERS_H + +/* ********* Suppress warnings if needed */ +#include "sal/config.h" + +#include <cstddef> + +#if defined __GNUC__ +#pragma GCC system_header +#endif + + +/* ********* Hack, but needed because of conflicting types... */ +#define Region QtXRegion + + +/* ********* Qt headers */ +#include <qaccessible.h> +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qfont.h> +#include <qframe.h> +#include <qlineedit.h> +#include <qlistview.h> +#include <qmainwindow.h> +#include <qmenudata.h> +#include <qpaintdevice.h> +#include <qpainter.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qrangecontrol.h> +#include <qstring.h> +#include <qtabbar.h> +#include <qtabwidget.h> +#include <qtoolbar.h> +#include <qtoolbutton.h> +#include <qwidget.h> +#include <qprogressbar.h> + +/* ********* See hack on top of this file */ +#undef Region + + +/* ********* KDE base headers */ +#include <kaboutdata.h> +#include <kapplication.h> +#include <kcmdlineargs.h> +#include <kconfig.h> +#include <kdeversion.h> +#include <kemailsettings.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <klocale.h> +#include <kmainwindow.h> +#include <kmenubar.h> +#include <kprotocolmanager.h> +#include <kstartupinfo.h> +#include <kstyle.h> + + +/* ********* KDE address book connectivity headers */ +#include <kabc/addressbook.h> +#include <kabc/addressee.h> +#include <kabc/field.h> +#include <kabc/stdaddressbook.h> + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/kde/kdedata.hxx b/vcl/inc/unx/kde/kdedata.hxx index 1f23da40a3f8..6f04d0a01220 100644 --- a/vcl/inc/unx/kde/kdedata.hxx +++ b/vcl/inc/unx/kde/kdedata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -108,3 +109,5 @@ public: }; #endif // _VCL_KDEDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/pspgraphics.h b/vcl/inc/unx/pspgraphics.h index 7b39ec80537c..1715ce38eb2c 100644 --- a/vcl/inc/unx/pspgraphics.h +++ b/vcl/inc/unx/pspgraphics.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,8 @@ #include "vclpluginapi.h" #include "salgdi.hxx" -#include "sallayout.hxx" +#include "vcl/vclenum.hxx" +#include <sallayout.hxx> namespace psp { struct JobData; class PrinterGfx; } @@ -76,15 +78,10 @@ public: static ImplDevFontAttributes Info2DevFontAttributes( const psp::FastPrintFontInfo& ); static void AnnounceFonts( ImplDevFontList*, const psp::FastPrintFontInfo& ); - static FontWidth ToFontWidth (psp::width::type eWidth); - static FontWeight ToFontWeight (psp::weight::type eWeight); - static FontPitch ToFontPitch (psp::pitch::type ePitch); - static FontItalic ToFontItalic (psp::italic::type eItalic); - static FontFamily ToFontFamily (psp::family::type eFamily); // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual sal_uInt16 GetBitCount(); + virtual sal_uInt16 GetBitCount() const; virtual long GetGraphicsWidth() const; virtual void ResetClipRegion(); @@ -103,6 +100,7 @@ public: virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); virtual sal_uLong GetKernPairs( sal_uLong nMaxPairs, ImplKernPairData* ); virtual const ImplFontCharMap* GetImplFontCharMap() const; + virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); @@ -125,8 +123,8 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual sal_Bool GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); + virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); + virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; @@ -189,3 +187,5 @@ public: }; #endif // _VCL_PSPGRAPHICS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h index d5ecdec34961..a389195308d3 100644 --- a/vcl/inc/unx/salbmp.h +++ b/vcl/inc/unx/salbmp.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,7 +58,8 @@ private: int nScreen, long nDrawableDepth, long nX, long nY, - long nWidth, long nHeight ); + long nWidth, long nHeight, + bool bGrey ); public: @@ -78,6 +80,7 @@ private: BitmapBuffer* mpDIB; ImplSalDDB* mpDDB; + bool mbGrey; public: @@ -110,6 +113,9 @@ public: SalGraphics* pGraphics ); virtual bool Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount ); + virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, + Size& rSize, + bool bMask = false ); virtual void Destroy(); @@ -235,3 +241,4 @@ public: +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx index ac26f81548b4..7bce61cc9ce7 100644 --- a/vcl/inc/unx/saldata.hxx +++ b/vcl/inc/unx/saldata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,9 +35,7 @@ #include <salframe.hxx> #include <unx/salinst.h> #include <saldatabasic.hxx> -#ifndef _OSL_MODULE_H #include <osl/module.h> -#endif #include <vclpluginapi.h> // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -46,9 +45,8 @@ class SalPrinter; // -=-= typedefs -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -DECLARE_LIST( SalDisplays, SalDisplay* ) - -#if defined SCO || defined LINUX || defined NETBSD || defined AIX || defined HPUX || defined FREEBSD +#if defined LINUX || defined NETBSD || defined AIX || \ + defined FREEBSD || defined OPENBSD || defined DRAGONFLY #include <pthread.h> #else typedef unsigned int pthread_t; @@ -89,8 +87,7 @@ public: inline void StopTimer(); void Timeout() const; - const rtl::OUString& GetLocalHostName() const - { return maLocalHostName; } + const rtl::OUString& GetLocalHostName(); rtl::OUString& GetUnicodeAccumulator() { return maUnicodeAccumulator; } static int XErrorHdl( Display*, XErrorEvent* ); @@ -132,3 +129,4 @@ inline YieldMutexReleaser::~YieldMutexReleaser() #endif // _SV_SALDATA_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index b97044f8036d..6687762c1e9d 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,16 +38,12 @@ class SalXLib; // -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #include <unx/salunx.h> #include <vcl/salgtype.hxx> -#ifndef _SV_PTRSTYLE_HXX #include <vcl/ptrstyle.hxx> -#endif #include <sal/types.h> -#ifndef _OSL_MUTEX_H #include <osl/mutex.h> -#endif #include <vector> #include <list> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <tools/gen.hxx> #include <salwtype.hxx> @@ -249,9 +246,9 @@ public: virtual void Remove( int fd ); void XError( Display *pDisp, XErrorEvent *pEvent ); - bool HasXErrorOccured() const { return m_aXErrorHandlerStack.back().m_bWas; } + bool HasXErrorOccurred() const { return m_aXErrorHandlerStack.back().m_bWas; } unsigned int GetLastXErrorRequestCode() const { return m_aXErrorHandlerStack.back().m_nLastErrorRequest; } - void ResetXErrorOccured() { m_aXErrorHandlerStack.back().m_bWas = false; } + void ResetXErrorOccurred() { m_aXErrorHandlerStack.back().m_bWas = false; } void PushXErrorLevel( bool bIgnore ); void PopXErrorLevel(); @@ -291,7 +288,7 @@ public: RenderEntry() : m_aPixmap( 0 ), m_aPicture( 0 ) {} }; - typedef std::hash_map<int,RenderEntry> RenderEntryMap; + typedef boost::unordered_map<int,RenderEntry> RenderEntryMap; struct ScreenData { @@ -382,6 +379,7 @@ protected: bool m_bXinerama; std::vector< Rectangle > m_aXineramaScreens; + std::vector< int > m_aXineramaScreenIndexMap; std::list<SalFrame*> m_aFrames; std::list<SalObject*> m_aSalObjects; @@ -396,7 +394,7 @@ protected: int processRandREvent( XEvent* ); void doDestruct(); - int addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ); + void addXineramaScreenUnique( int i, long i_nX, long i_nY, long i_nWidth, long i_nHeight ); public: static SalDisplay *GetSalDisplay( Display* display ); static sal_Bool BestVisual( Display *pDisp, @@ -428,6 +426,8 @@ public: void Beep() const; void ModifierMapping(); + void SimulateKeyPress( sal_uInt16 nKeyCode ); + sal_uInt16 GetIndicatorState() const; String GetKeyNameFromKeySym( KeySym keysym ) const; XubString GetKeyName( sal_uInt16 nKeyCode ) const; sal_uInt16 GetKeyCode( KeySym keysym, char*pcPrintable ) const; @@ -494,7 +494,7 @@ public: { mpInputMethod = pInputMethod; } void SetKbdExtension(SalI18N_KeyboardExtension *pKbdExtension) { mpKbdExtension = pKbdExtension; } - const char* GetKeyboardName( sal_Bool bRefresh = sal_False ); + const char* GetKeyboardName( bool bRefresh = false ); ::vcl_sal::WMAdaptor* getWMAdaptor() const { return m_pWMAdaptor; } DtIntegrator* getDtIntegrator() const { return m_pDtIntegrator; } bool IsXinerama() const { return m_bXinerama; } @@ -549,3 +549,5 @@ namespace vcl_sal { #endif // _SV_SALDISP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salfont.h b/vcl/inc/unx/salfont.h deleted file mode 100644 index b3fbe93137f3..000000000000 --- a/vcl/inc/unx/salfont.h +++ /dev/null @@ -1,180 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALFONT_H -#define _SV_SALFONT_H - -// -=-= exports =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -class SalFontCache; -struct SalFontDimension; -class SalFontFamily; -class SalFontFamilyList; -class SalFontStruct; -class SalFontStructList; -class SalFonts; - -// -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -#include <salstd.hxx> -#include <vcl/outfont.hxx> - -// -=-= forwards =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -typedef ULONG XFP_FLAGS; - -class SalDisplay; -class SalFontCacheItem; - -// -=-= SalFontCache -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -DECLARE_LIST( SalFontCache, SalFontCacheItem* ) - -// -=-= SalFontDimension -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -struct SalFontDimension -{ - USHORT nHeight_; // [pixel] - USHORT nPtHeight_; // [point/10] - USHORT nAverage_; // [pixel/10] - USHORT nXRes_; // [dpi] - USHORT nYRes_; // [dpi] - USHORT nSlant_; // [pixel] -// size_t nUnderlineThickness_; // [pixel] -// size_t nUnderlinePosition_; // [pixel] -// size_t nStrikeoutAscent_; // [pixel] -// size_t nStrikeoutDescent_; // [pixel] -// Subscript, Superscript, Capital, Space ... - - inline SalFontDimension( USHORT nA = 0, USHORT nH = 0 ); - - inline BOOL IsScalable() const; - inline USHORT GetWidth() const { return (nAverage_ + 5) / 10; } - inline Size GetSize() const; - inline void SetSize( const Size & rSize ); - inline BOOL operator == ( const SalFontDimension &r ) const; - inline BOOL operator != ( const SalFontDimension &r ) const; - inline BOOL operator >= ( const SalFontDimension &r ) const; -}; - -inline SalFontDimension::SalFontDimension( USHORT nA, USHORT nH ) - : nHeight_( nH ), nAverage_( nA ) -{ nPtHeight_ = nXRes_ = nYRes_ = nSlant_ = 0; } - -inline BOOL SalFontDimension::IsScalable() const -{ return !nHeight_ && !nPtHeight_ && !nAverage_; } - -inline Size SalFontDimension::GetSize() const -{ return Size( (nAverage_ + 5) / 10, nHeight_ ); } - -inline void SalFontDimension::SetSize( const Size & rSize ) -{ nAverage_ = (USHORT)rSize.Width() * 10; nHeight_ = (USHORT)rSize.Height(); } - -inline BOOL SalFontDimension::operator == ( const SalFontDimension &r ) const -{ return nHeight_ == r.nHeight_ && (!r.nAverage_ || nAverage_ == r.nAverage_); } - -inline BOOL SalFontDimension::operator != ( const SalFontDimension &r ) const -{ return !(*this == r); } - -inline BOOL SalFontDimension::operator >= ( const SalFontDimension &r ) const -{ return nHeight_ > r.nHeight_ - || (nHeight_ == r.nHeight_ && nAverage_ >= r.nAverage_); } - -// -=-= SalFontStruct =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -class SalFontStruct : public ImplFontMetricData -{ - friend class SalDisplay; - friend class SalGraphicsData; - - SalFontCacheItem*pCache_; - -#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL - ByteString aFontName_; -#endif - USHORT nHeightCount_; // Anzahl der Hoehen-Eintraege - SalFontDimension*pDimensions_; // Hoehen-Array - USHORT nWeight_; - - USHORT nFoundry_; // properties indexies - USHORT nFamily_; - USHORT nWeightName_; - USHORT nSlant_; - USHORT nSetWidthName_; - ByteString aAddStyleName_; - USHORT nSpacing_; - USHORT nCharSet_; - USHORT nFaceName_; - BOOL mbValidFontDescription; // valid xlfd entries - - void Init(); - BOOL Init( SalDisplay* pDisp, - const char* pFontName, - SalFontDimension& rDim ); - - ByteString GetXFontName( const SalFontDimension& ); - - inline void SetFoundry( USHORT n ) - { nFoundry_ = n; } - inline void SetFamily( USHORT n ) - { meFamily = sal_FamilyToSal( nFamily_ = n ); } - inline void SetWeightName( USHORT n ) - { meWeight = sal_WeightToSal( nWeightName_ = n ); } - inline void SetSlant( USHORT n ) - { meItalic = sal_ItalicToSal( nSlant_ = n ); } - inline void SetSetWidthName( USHORT n ) - { nSetWidthName_ = n; } - inline void SetAddStyleName( const ByteString& rAddStyle ) - { aAddStyleName_ = rAddStyle; aAddStyleName_.ToLowerAscii(); } - inline void SetSpacing( USHORT n ) - { mePitch = sal_PitchToSal( nSpacing_ = n ); } - inline void SetAverage( long n ) - { mnWidth = (n + 5) / 10; } - void SetCharSet( USHORT n ); - - SalFontStruct( const SalFontStruct& rFont ); -public: - SalFontStruct( SalDisplay* pDisp, - const char* pFontName, - SalFontDimension& rDim ); - - ~SalFontStruct(); - - inline void Cache( SalFontCacheItem *p ) { pCache_ = p; } - inline SalFontCacheItem*IsCache() const { return pCache_; } - inline BOOL IsScalable() const { return TYPE_SCALABLE==meType; } - inline SalFontDimension*GetDim() const { return pDimensions_; } - inline BOOL IsValid() const { return mbValidFontDescription; } -#ifdef DBG_UTIL - const ByteString& GetName() const { return aFontName_; } -#endif - - ImplFontData *GetDevFontData(); - SalFontCacheItem*Load( SalDisplay *pDisp, const SalFontDimension &rDim ); - CharSet GetCharSet() { return meCharSet; } - -}; - -// -=-= SalFontStructList =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -DECLARE_LIST( SalFontStructList, SalFontStruct* ) - -#endif // _SV_SALFONT_H - diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h index 02dc58f67d2b..4bfe8958d728 100644 --- a/vcl/inc/unx/salframe.h +++ b/vcl/inc/unx/salframe.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,7 +92,6 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame sal_uInt16 nKeyCode_; // last key code sal_uInt16 nKeyState_; // last key state int nCompose_; // compose state - bool mbKeyMenu; bool mbSendExtKeyModChange; sal_uInt16 mnExtKeyMod; @@ -130,6 +130,8 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame String m_aTitle; + rtl::OUString m_sWMClass; + SystemChildData maSystemChildData; SalI18N_InputContext *mpInputContext; @@ -139,6 +141,7 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame int m_nCurClipRect; int m_nMaxClipRect; + bool mPendingSizeEvent; void GetPosSize( Rectangle &rPosSize ); void SetSize ( const Size &rSize ); @@ -172,6 +175,8 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame void setXEmbedInfo(); void askForXEmbedFocus( sal_Int32 i_nTimeCode ); + + void updateWMClass(); public: X11SalFrame( SalFrame* pParent, sal_uIntPtr nSalFrameStyle, SystemParentData* pSystemParent = NULL ); virtual ~X11SalFrame(); @@ -259,11 +264,14 @@ public: virtual void Beep( SoundType eSoundType ); virtual const SystemEnvData* GetSystemData() const; virtual SalPointerState GetPointerState(); + virtual SalIndicatorState GetIndicatorState(); + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ); virtual void SetParent( SalFrame* pNewParent ); virtual bool SetPluginParent( SystemParentData* pNewParent ); virtual void SetBackgroundBitmap( SalBitmap* pBitmap ); virtual void SetScreenNumber( unsigned int ); + virtual void SetApplicationID( const rtl::OUString &rWMClass ); // shaped system windows // set clip region to none (-> rectangular windows, normal state) @@ -277,6 +285,9 @@ public: static void SaveYourselfDone( SalFrame* ); static Bool checkKeyReleaseForRepeat( Display*, XEvent*, XPointer pX11SalFrame ); + + /// @internal + void setPendingSizeEvent(); }; #ifdef _SV_SALDISP_HXX @@ -291,3 +302,4 @@ inline XLIB_Window X11SalFrame::GetDrawable() const #endif // _SV_SALFRAME_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index a6f30ee92930..1b048043dde1 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,14 +66,27 @@ namespace basegfx { class CairoFontsCache { +public: + struct CacheId + { + const void *mpFace; + const void *mpOptions; + bool mbEmbolden; + bool operator ==(const CacheId& rOther) const + { + return mpFace == rOther.mpFace && + mpOptions == rOther.mpOptions && + mbEmbolden == rOther.mbEmbolden; + } + }; private: static int mnRefCount; - typedef std::deque< std::pair<void *, void*> > LRUFonts; + typedef std::deque< std::pair<void *, CacheId> > LRUFonts; static LRUFonts maLRUFonts; public: CairoFontsCache(); - static void CacheFont(void *pFont, void *pId); - static void* FindCachedFont(void *pId); + static void CacheFont(void *pFont, const CacheId &rId); + static void* FindCachedFont(const CacheId &rId); ~CairoFontsCache(); }; @@ -88,8 +102,8 @@ protected: SalColormap *m_pDeleteColormap; Drawable hDrawable_; // use int m_nScreen; - void* m_pRenderFormat; - XID m_aRenderPicture; + mutable XRenderPictFormat* m_pXRenderFormat; + XID m_aXRenderPicture; CairoFontsCache m_aCairoFontsCache; XLIB_Region pPaintRegion_; @@ -217,8 +231,8 @@ public: inline Drawable GetDrawable() const { return hDrawable_; } void SetDrawable( Drawable d, int nScreen ); XID GetXRenderPicture(); - void* GetXRenderFormat() const { return m_pRenderFormat; } - inline void SetXRenderFormat( void* pRenderFormat ) { m_pRenderFormat = pRenderFormat; } + XRenderPictFormat* GetXRenderFormat() const; + inline void SetXRenderFormat( XRenderPictFormat* pXRenderFormat ) { m_pXRenderFormat = pXRenderFormat; } inline const SalColormap& GetColormap() const { return *m_pColormap; } using SalGraphics::GetPixel; inline Pixel GetPixel( SalColor nSalColor ) const; @@ -227,7 +241,7 @@ public: // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual sal_uInt16 GetBitCount(); + virtual sal_uInt16 GetBitCount() const; virtual long GetGraphicsWidth() const; virtual long GetGraphicsHeight() const; @@ -250,6 +264,7 @@ public: virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); virtual sal_uLong GetKernPairs( sal_uLong nMaxPairs, ImplKernPairData* ); virtual const ImplFontCharMap* GetImplFontCharMap() const; + virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); @@ -272,8 +287,8 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual sal_Bool GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); + virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); + virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; @@ -386,3 +401,4 @@ inline Pixel X11SalGraphics::GetPixel( SalColor nSalColor ) const #endif // _SV_SALGDI_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h index 31da4b1a86bd..4d264f7c9f45 100644 --- a/vcl/inc/unx/salinst.h +++ b/vcl/inc/unx/salinst.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,20 +31,16 @@ #define _SV_SALINST_H #include <vcl/sv.h> -#ifndef _VOS_MUTEX_HXX -#include <vos/mutex.hxx> -#endif -#ifndef _VOS_THREAD_HXX -#include <vos/thread.hxx> -#endif +#include <osl/thread.hxx> #include <vclpluginapi.h> #include <salinst.hxx> +#include <vcl/solarmutex.hxx> -class VCLPLUG_GEN_PUBLIC SalYieldMutex : public vos::OMutex +class VCLPLUG_GEN_PUBLIC SalYieldMutex : public vcl::SolarMutexObject { protected: sal_uIntPtr mnCount; - vos::OThread::TThreadIdentifier mnThreadId; + oslThreadIdentifier mnThreadId; public: SalYieldMutex(); @@ -53,7 +50,7 @@ public: virtual sal_Bool tryToAcquire(); sal_uIntPtr GetAcquireCount() const { return mnCount; } - vos::OThread::TThreadIdentifier GetThreadId() const { return mnThreadId; } + oslThreadIdentifier GetThreadId() const { return mnThreadId; } }; // -=-= SalInstanceData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -99,7 +96,7 @@ public: virtual SalBitmap* CreateSalBitmap(); virtual SalSession* CreateSalSession(); - virtual vos::IMutex* GetYieldMutex(); + virtual osl::SolarMutex* GetYieldMutex(); virtual sal_uIntPtr ReleaseYieldMutex(); virtual void AcquireYieldMutex( sal_uIntPtr nCount ); virtual bool CheckYieldMutex(); @@ -117,6 +114,9 @@ public: virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); + virtual void updatePrinterUpdate(); + virtual void jobStartedPrinterUpdate(); + virtual void jobEndedPrinterUpdate(); bool isPrinterInit() const { @@ -126,3 +126,4 @@ public: #endif // _SV_SALINST_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salmenu.h b/vcl/inc/unx/salmenu.h index 09a753ff1d98..e7b5effed653 100644 --- a/vcl/inc/unx/salmenu.h +++ b/vcl/inc/unx/salmenu.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,3 +64,4 @@ public: #endif // _SV_SALMENU_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salobj.h b/vcl/inc/unx/salobj.h index c9c6bfe4a8e7..5f10027a0d8b 100644 --- a/vcl/inc/unx/salobj.h +++ b/vcl/inc/unx/salobj.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -103,3 +104,5 @@ public: }; #endif // _SV_SALOBJ_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salprn.h b/vcl/inc/unx/salprn.h index 3f23836828d8..e51a4b6d50f5 100644 --- a/vcl/inc/unx/salprn.h +++ b/vcl/inc/unx/salprn.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,7 +37,7 @@ class PspGraphics; -class PspSalInfoPrinter : public SalInfoPrinter +class VCLPLUG_GEN_PUBLIC PspSalInfoPrinter : public SalInfoPrinter { public: PspGraphics* m_pGraphics; @@ -63,7 +64,7 @@ public: virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ); }; -class PspSalPrinter : public SalPrinter +class VCLPLUG_GEN_PUBLIC PspSalPrinter : public SalPrinter { public: String m_aFileName; @@ -85,7 +86,6 @@ public: virtual ~PspSalPrinter(); // overload all pure virtual methods - using SalPrinter::StartJob; virtual sal_Bool StartJob( const XubString* pFileName, const XubString& rJobName, const XubString& rAppName, @@ -105,23 +105,7 @@ public: virtual sal_uIntPtr GetErrorCode(); }; -class Timer; - -namespace vcl_sal { -class VCLPLUG_GEN_PUBLIC PrinterUpdate -{ - static Timer* pPrinterUpdateTimer; - static int nActiveJobs; - - static void doUpdate(); - DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* ); -public: - static void update(); - static void jobStarted() { nActiveJobs++; } - static void jobEnded(); -}; -} - #endif // _SV_SALPRN_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salstd.hxx b/vcl/inc/unx/salstd.hxx index cc03b3fb35a4..07056a91bdec 100644 --- a/vcl/inc/unx/salstd.hxx +++ b/vcl/inc/unx/salstd.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -75,3 +76,4 @@ struct XWindowChanges; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salsys.h b/vcl/inc/unx/salsys.h index 3b21985b8282..e4ce898e9550 100644 --- a/vcl/inc/unx/salsys.h +++ b/vcl/inc/unx/salsys.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,12 +31,8 @@ #define _SV_SALSYS_H #include <vcl/sv.h> -#ifndef _VOS_MUTEX_HXX -#include <vos/mutex.hxx> -#endif -#ifndef _VOS_THREAD_HXX -#include <vos/thread.hxx> -#endif +#include <osl/mutex.hxx> +#include <osl/thread.hxx> #include <salsys.hxx> #include <vclpluginapi.h> @@ -65,3 +62,5 @@ public: }; #endif // _SV_SALSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/saltimer.h b/vcl/inc/unx/saltimer.h index f92c6df7c8a5..f5c889cabe6e 100644 --- a/vcl/inc/unx/saltimer.h +++ b/vcl/inc/unx/saltimer.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,3 +43,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salunx.h b/vcl/inc/unx/salunx.h index 8e82258e51a2..f022f43ce028 100644 --- a/vcl/inc/unx/salunx.h +++ b/vcl/inc/unx/salunx.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,8 @@ #define _SALUNX_H // -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -#if defined SCO || defined LINUX || defined HPUX || defined FREEBSD || defined NETBSD +#if defined LINUX || defined FREEBSD || \ + defined NETBSD || defined OPENBSD || defined DRAGONFLY #include <sys/time.h> #elif defined AIX #include <time.h> @@ -126,3 +128,4 @@ inline timeval operator - ( const timeval &t1, const timeval &t2 ) } #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h index d5f6b0988147..42ce192ea76f 100644 --- a/vcl/inc/unx/salvd.h +++ b/vcl/inc/unx/salvd.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,7 +62,7 @@ public: sal_uInt16 nBitCount, int nScreen, Pixmap hDrawable = None, - void* pRenderFormat = NULL ); + XRenderPictFormat* pXRenderFormat = NULL ); inline void InitGraphics( X11SalVirtualDevice *pVD ); inline Display *GetXDisplay() const; @@ -99,3 +100,4 @@ inline sal_Bool X11SalVirtualDevice::IsDisplay() const #endif // _SV_SALVD_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/sm.hxx b/vcl/inc/unx/sm.hxx index f5123f3e7ae0..de3ac5a04f6c 100644 --- a/vcl/inc/unx/sm.hxx +++ b/vcl/inc/unx/sm.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,6 +28,7 @@ #ifndef _VCL_SM_HXX #define _VCL_SM_HXX +#include <rtl/string.hxx> #include "tools/link.hxx" #include "unx/salunx.h" #include <X11/SM/SMlib.h> @@ -36,7 +38,7 @@ class SessionManagerClient { static SmcConn aSmcConnection; - static ByteString aClientID; + static rtl::OString m_aClientID; static bool bDocSaveDone; static void SaveYourselfProc( SmcConn connection, @@ -54,7 +56,7 @@ class SessionManagerClient static void InteractProc( SmcConn connection, SmPointer clientData ); - static const ByteString& getPreviousSessionID(); + static const rtl::OString& getPreviousSessionID(); DECL_STATIC_LINK( SessionManagerClient, ShutDownHdl, void* ); DECL_STATIC_LINK( SessionManagerClient, ShutDownCancelHdl, void* ); @@ -69,8 +71,8 @@ public: static void saveDone(); static void interactionDone( bool bCancelShutdown ); - static String getExecName(); - static VCLPLUG_GEN_PUBLIC const ByteString& getSessionID(); + static rtl::OUString getExecName(); + static VCLPLUG_GEN_PUBLIC const rtl::OString& getSessionID(); }; class SalFrame; @@ -90,3 +92,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/soicon.hxx b/vcl/inc/unx/soicon.hxx index 4efaea4e736f..cb3302cb777b 100644 --- a/vcl/inc/unx/soicon.hxx +++ b/vcl/inc/unx/soicon.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,3 +36,5 @@ sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen, sal_uInt16 nIcon, sal_uInt16 iconSize, Pixmap& icon_pixmap, Pixmap& icon_mask ); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/strhelper.hxx b/vcl/inc/unx/strhelper.hxx index cd0220b77e05..78db60567133 100644 --- a/vcl/inc/unx/strhelper.hxx +++ b/vcl/inc/unx/strhelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,5 @@ int GetCommandLineTokenCount( const String& ); String WhitespaceToSpace( const String&, BOOL bProtect = TRUE ); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/svsys.h b/vcl/inc/unx/svsys.h index a2ee16f7091d..0adc3e423329 100644 --- a/vcl/inc/unx/svsys.h +++ b/vcl/inc/unx/svsys.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,3 +31,5 @@ #include <unx/svunx.h> #endif // _SV_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/svunx.h b/vcl/inc/unx/svunx.h index e7d6150b79f4..e3ea4cc3e790 100644 --- a/vcl/inc/unx/svunx.h +++ b/vcl/inc/unx/svunx.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,3 +34,4 @@ #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/wmadaptor.hxx b/vcl/inc/unx/wmadaptor.hxx index 88f0e62024a9..dc0fe65f290b 100644 --- a/vcl/inc/unx/wmadaptor.hxx +++ b/vcl/inc/unx/wmadaptor.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #ifndef _VCL_WMADAPTOR_HXX_ #define _VCL_WMADAPTOR_HXX_ -#ifndef _TL_STRING_HXX #include <tools/string.hxx> -#endif #include <tools/gen.hxx> #ifndef _PREX_H #include <tools/prex.h> @@ -352,3 +351,5 @@ public: } // namespace #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/airbrush_curs.h b/vcl/inc/unx/x11_cursors/airbrush_curs.h index 293c9757e77b..a78666bb243d 100644 --- a/vcl/inc/unx/x11_cursors/airbrush_curs.h +++ b/vcl/inc/unx/x11_cursors/airbrush_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define airbrush_curs_height 32 #define airbrush_curs_x_hot 5 #define airbrush_curs_y_hot 22 -static char airbrush_curs_bits[] = { +static unsigned char airbrush_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x78,0x00,0x00,0x00, 0x7c,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x1f,0x00,0x00,0x98,0x0f,0x00,0x00, @@ -38,3 +39,5 @@ static char airbrush_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/airbrush_mask.h b/vcl/inc/unx/x11_cursors/airbrush_mask.h index 811ea2819669..82d70f05bbb7 100644 --- a/vcl/inc/unx/x11_cursors/airbrush_mask.h +++ b/vcl/inc/unx/x11_cursors/airbrush_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define airbrush_mask_height 32 #define airbrush_mask_x_hot 5 #define airbrush_mask_y_hot 22 -static char airbrush_mask_bits[] = { +static unsigned char airbrush_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x78,0x00,0x00,0x00, 0x7c,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x1f,0x00,0x00,0x98,0x0f,0x00,0x00, @@ -38,3 +39,5 @@ static char airbrush_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/ase_curs.h b/vcl/inc/unx/x11_cursors/ase_curs.h index 52b67f56d2ae..0a7c9bfd29c2 100644 --- a/vcl/inc/unx/x11_cursors/ase_curs.h +++ b/vcl/inc/unx/x11_cursors/ase_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define ase_curs_height 32 #define ase_curs_x_hot 19 #define ase_curs_y_hot 16 -static char ase_curs_bits[] = { +static unsigned char ase_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char ase_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/ase_mask.h b/vcl/inc/unx/x11_cursors/ase_mask.h index 5dbd5c134dbf..4ded0773a72a 100644 --- a/vcl/inc/unx/x11_cursors/ase_mask.h +++ b/vcl/inc/unx/x11_cursors/ase_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define ase_mask_height 32 #define ase_mask_x_hot 19 #define ase_mask_y_hot 16 -static char ase_mask_bits[] = { +static unsigned char ase_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char ase_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asn_curs.h b/vcl/inc/unx/x11_cursors/asn_curs.h index 3b5f4364b5e2..68ab521de1a5 100644 --- a/vcl/inc/unx/x11_cursors/asn_curs.h +++ b/vcl/inc/unx/x11_cursors/asn_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asn_curs_height 32 #define asn_curs_x_hot 16 #define asn_curs_y_hot 12 -static char asn_curs_bits[] = { +static unsigned char asn_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x80,0x03, 0x00,0x00,0xc0,0x07,0x00,0x00,0xc0,0x07,0x00,0x00,0xe0,0x0f,0x00,0x00,0x20, 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x00, @@ -38,3 +39,5 @@ static char asn_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asn_mask.h b/vcl/inc/unx/x11_cursors/asn_mask.h index 902fe80df8a1..0e7a30e5a190 100644 --- a/vcl/inc/unx/x11_cursors/asn_mask.h +++ b/vcl/inc/unx/x11_cursors/asn_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asn_mask_height 32 #define asn_mask_x_hot 16 #define asn_mask_y_hot 12 -static char asn_mask_bits[] = { +static unsigned char asn_mask_bits[] = { 0x00,0x00,0x01,0x00,0x00,0x80,0x03,0x00,0x00,0x80,0x03,0x00,0x00,0xc0,0x07, 0x00,0x00,0xe0,0x0f,0x00,0x00,0xe0,0x0f,0x00,0x00,0xf0,0x1f,0x00,0x00,0xf0, 0x1f,0x00,0x00,0x20,0x08,0x00,0x00,0x80,0x03,0x00,0x00,0xc0,0x07,0x00,0x00, @@ -38,3 +39,5 @@ static char asn_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asne_curs.h b/vcl/inc/unx/x11_cursors/asne_curs.h index 0939b1d07e4b..8ba58f9639e2 100644 --- a/vcl/inc/unx/x11_cursors/asne_curs.h +++ b/vcl/inc/unx/x11_cursors/asne_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asne_curs_height 32 #define asne_curs_x_hot 21 #define asne_curs_y_hot 10 -static char asne_curs_bits[] = { +static unsigned char asne_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x80, 0x3f,0x00,0x00,0xc0,0x3f,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x1c,0x00,0x00, 0x00,0x1c,0x00,0x00,0x70,0x18,0x00,0x00,0xf8,0x08,0x00,0x00,0xf8,0x00,0x00, @@ -38,3 +39,5 @@ static char asne_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asne_mask.h b/vcl/inc/unx/x11_cursors/asne_mask.h index 9ab55c293218..6408f127b1f4 100644 --- a/vcl/inc/unx/x11_cursors/asne_mask.h +++ b/vcl/inc/unx/x11_cursors/asne_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asne_mask_height 32 #define asne_mask_x_hot 21 #define asne_mask_y_hot 10 -static char asne_mask_bits[] = { +static unsigned char asne_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x80,0x7f,0x00,0x00,0xc0, 0x7f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xc0,0x7f,0x00,0x00,0x00,0x3f,0x00,0x00, 0x70,0x3e,0x00,0x00,0xf8,0x3c,0x00,0x00,0xfc,0x1d,0x00,0x00,0xfc,0x09,0x00, @@ -38,3 +39,5 @@ static char asne_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asns_curs.h b/vcl/inc/unx/x11_cursors/asns_curs.h index fef8fe2f4ab5..3e039241ba61 100644 --- a/vcl/inc/unx/x11_cursors/asns_curs.h +++ b/vcl/inc/unx/x11_cursors/asns_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asns_curs_height 32 #define asns_curs_x_hot 15 #define asns_curs_y_hot 15 -static char asns_curs_bits[] = { +static unsigned char asns_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0, 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,0x07,0x00,0x00,0x10,0x04,0x00,0x00, @@ -38,3 +39,5 @@ static char asns_curs_bits[] = { 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asns_mask.h b/vcl/inc/unx/x11_cursors/asns_mask.h index f90cb95ee721..2a753501bc9d 100644 --- a/vcl/inc/unx/x11_cursors/asns_mask.h +++ b/vcl/inc/unx/x11_cursors/asns_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asns_mask_height 32 #define asns_mask_x_hot 15 #define asns_mask_y_hot 15 -static char asns_mask_bits[] = { +static unsigned char asns_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, 0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0, 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00, @@ -38,3 +39,5 @@ static char asns_mask_bits[] = { 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00, 0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asnswe_curs.h b/vcl/inc/unx/x11_cursors/asnswe_curs.h index fd6ddaca65cb..599511e1d433 100644 --- a/vcl/inc/unx/x11_cursors/asnswe_curs.h +++ b/vcl/inc/unx/x11_cursors/asnswe_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asnswe_curs_height 32 #define asnswe_curs_x_hot 15 #define asnswe_curs_y_hot 15 -static char asnswe_curs_bits[] = { +static unsigned char asnswe_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0, 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,0x07,0x00,0x00,0x10,0x04,0x00,0x00, @@ -38,3 +39,5 @@ static char asnswe_curs_bits[] = { 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asnswe_mask.h b/vcl/inc/unx/x11_cursors/asnswe_mask.h index e48da90e3de5..a0bcb3c5310e 100644 --- a/vcl/inc/unx/x11_cursors/asnswe_mask.h +++ b/vcl/inc/unx/x11_cursors/asnswe_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asnswe_mask_height 32 #define asnswe_mask_x_hot 15 #define asnswe_mask_y_hot 15 -static char asnswe_mask_bits[] = { +static unsigned char asnswe_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, 0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0, 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00, @@ -38,3 +39,5 @@ static char asnswe_mask_bits[] = { 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00, 0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asnw_curs.h b/vcl/inc/unx/x11_cursors/asnw_curs.h index cb3a35d793c7..139cd4e2ea5e 100644 --- a/vcl/inc/unx/x11_cursors/asnw_curs.h +++ b/vcl/inc/unx/x11_cursors/asnw_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asnw_curs_height 32 #define asnw_curs_x_hot 10 #define asnw_curs_y_hot 10 -static char asnw_curs_bits[] = { +static unsigned char asnw_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0xfc,0x01,0x00, 0x00,0xfc,0x03,0x00,0x00,0xfc,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0x00, 0x00,0x00,0x18,0x0e,0x00,0x00,0x10,0x1f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char asnw_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asnw_mask.h b/vcl/inc/unx/x11_cursors/asnw_mask.h index e583957c4bae..6f7da9a88661 100644 --- a/vcl/inc/unx/x11_cursors/asnw_mask.h +++ b/vcl/inc/unx/x11_cursors/asnw_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asnw_mask_height 32 #define asnw_mask_x_hot 10 #define asnw_mask_y_hot 10 -static char asnw_mask_bits[] = { +static unsigned char asnw_mask_bits[] = { 0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0xfe,0x01,0x00,0x00,0xfe,0x03,0x00, 0x00,0xfe,0x07,0x00,0x00,0xfe,0x03,0x00,0x00,0xfc,0x00,0x00,0x00,0x7c,0x0e, 0x00,0x00,0x3c,0x1f,0x00,0x00,0xb8,0x3f,0x00,0x00,0x90,0x3f,0x00,0x00,0x80, @@ -38,3 +39,5 @@ static char asnw_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/ass_curs.h b/vcl/inc/unx/x11_cursors/ass_curs.h index ea942cefe942..ea98bf5b0404 100644 --- a/vcl/inc/unx/x11_cursors/ass_curs.h +++ b/vcl/inc/unx/x11_cursors/ass_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define ass_curs_height 32 #define ass_curs_x_hot 15 #define ass_curs_y_hot 19 -static char ass_curs_bits[] = { +static unsigned char ass_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char ass_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x04,0x00,0x00,0xf0,0x07,0x00,0x00, 0xe0,0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00, 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/ass_mask.h b/vcl/inc/unx/x11_cursors/ass_mask.h index b35298183cb1..ccb91615d34a 100644 --- a/vcl/inc/unx/x11_cursors/ass_mask.h +++ b/vcl/inc/unx/x11_cursors/ass_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define ass_mask_height 32 #define ass_mask_x_hot 15 #define ass_mask_y_hot 19 -static char ass_mask_bits[] = { +static unsigned char ass_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char ass_mask_bits[] = { 0x01,0x00,0x00,0x10,0x04,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00, 0xf0,0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00, 0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asse_curs.h b/vcl/inc/unx/x11_cursors/asse_curs.h index 4b30e81882ff..0df55658c10a 100644 --- a/vcl/inc/unx/x11_cursors/asse_curs.h +++ b/vcl/inc/unx/x11_cursors/asse_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asse_curs_height 32 #define asse_curs_x_hot 21 #define asse_curs_y_hot 21 -static char asse_curs_bits[] = { +static unsigned char asse_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char asse_curs_bits[] = { 0xf8,0x08,0x00,0x00,0x70,0x18,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x1c,0x00, 0x00,0x00,0x3f,0x00,0x00,0xc0,0x3f,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x3c, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asse_mask.h b/vcl/inc/unx/x11_cursors/asse_mask.h index ad74b0cf724a..1835e939f275 100644 --- a/vcl/inc/unx/x11_cursors/asse_mask.h +++ b/vcl/inc/unx/x11_cursors/asse_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asse_mask_height 32 #define asse_mask_x_hot 21 #define asse_mask_y_hot 21 -static char asse_mask_bits[] = { +static unsigned char asse_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char asse_mask_bits[] = { 0xfc,0x1d,0x00,0x00,0xf8,0x3c,0x00,0x00,0x70,0x3e,0x00,0x00,0x00,0x3f,0x00, 0x00,0xc0,0x7f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xc0,0x7f,0x00,0x00,0x80,0x7f, 0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/assw_curs.h b/vcl/inc/unx/x11_cursors/assw_curs.h index d26c36e79ed4..5956aa5bf40b 100644 --- a/vcl/inc/unx/x11_cursors/assw_curs.h +++ b/vcl/inc/unx/x11_cursors/assw_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define assw_curs_height 32 #define assw_curs_x_hot 21 #define assw_curs_y_hot 21 -static char assw_curs_bits[] = { +static unsigned char assw_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char assw_curs_bits[] = { 0x00,0x00,0x18,0x0e,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0xfc, 0x00,0x00,0x00,0xfc,0x03,0x00,0x00,0xfc,0x01,0x00,0x00,0x3c,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/assw_mask.h b/vcl/inc/unx/x11_cursors/assw_mask.h index ea47a3ee27e9..3023b2a6061f 100644 --- a/vcl/inc/unx/x11_cursors/assw_mask.h +++ b/vcl/inc/unx/x11_cursors/assw_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define assw_mask_height 32 #define assw_mask_x_hot 21 #define assw_mask_y_hot 21 -static char assw_mask_bits[] = { +static unsigned char assw_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char assw_mask_bits[] = { 0x00,0x00,0x18,0x0e,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0xfc, 0x00,0x00,0x00,0xfc,0x03,0x00,0x00,0xfc,0x01,0x00,0x00,0x3c,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asw_curs.h b/vcl/inc/unx/x11_cursors/asw_curs.h index 7b9b2199955a..8064570cb8fe 100644 --- a/vcl/inc/unx/x11_cursors/asw_curs.h +++ b/vcl/inc/unx/x11_cursors/asw_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asw_curs_height 32 #define asw_curs_x_hot 12 #define asw_curs_y_hot 15 -static char asw_curs_bits[] = { +static unsigned char asw_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char asw_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asw_mask.h b/vcl/inc/unx/x11_cursors/asw_mask.h index df934399fe91..245c42e7d790 100644 --- a/vcl/inc/unx/x11_cursors/asw_mask.h +++ b/vcl/inc/unx/x11_cursors/asw_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define asw_mask_height 32 #define asw_mask_x_hot 12 #define asw_mask_y_hot 15 -static char asw_mask_bits[] = { +static unsigned char asw_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0, @@ -38,3 +39,5 @@ static char asw_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/aswe_curs.h b/vcl/inc/unx/x11_cursors/aswe_curs.h index f06d2140559e..ed83d450c269 100644 --- a/vcl/inc/unx/x11_cursors/aswe_curs.h +++ b/vcl/inc/unx/x11_cursors/aswe_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define aswe_curs_height 32 #define aswe_curs_x_hot 15 #define aswe_curs_y_hot 15 -static char aswe_curs_bits[] = { +static unsigned char aswe_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char aswe_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/aswe_mask.h b/vcl/inc/unx/x11_cursors/aswe_mask.h index c04dbf5deafb..d2a97d7fa4c8 100644 --- a/vcl/inc/unx/x11_cursors/aswe_mask.h +++ b/vcl/inc/unx/x11_cursors/aswe_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define aswe_mask_height 32 #define aswe_mask_x_hot 15 #define aswe_mask_y_hot 15 -static char aswe_mask_bits[] = { +static unsigned char aswe_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char aswe_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chain_curs.h b/vcl/inc/unx/x11_cursors/chain_curs.h index 95b4fbe66c2e..ea319fb6b128 100644 --- a/vcl/inc/unx/x11_cursors/chain_curs.h +++ b/vcl/inc/unx/x11_cursors/chain_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define chain_curs_height 32 #define chain_curs_x_hot 0 #define chain_curs_y_hot 2 -static char chain_curs_bits[] = { +static unsigned char chain_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00, 0x00,0x05,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x21,0x00, 0x00,0x00,0x41,0x00,0x00,0x00,0x81,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x01, @@ -38,3 +39,5 @@ static char chain_curs_bits[] = { 0x91,0x28,0x80,0x24,0x91,0x28,0x80,0x24,0x91,0x24,0x80,0x98,0x4f,0x23,0x00, 0x41,0x20,0x10,0x00,0x3e,0xde,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chain_mask.h b/vcl/inc/unx/x11_cursors/chain_mask.h index 91d89bbed3c6..688835ecbd3e 100644 --- a/vcl/inc/unx/x11_cursors/chain_mask.h +++ b/vcl/inc/unx/x11_cursors/chain_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define chain_mask_width 32 #define chain_mask_height 32 -static char chain_mask_bits[] = { +static unsigned char chain_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00, 0x00,0x07,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x3f,0x00, 0x00,0x00,0x7f,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x01,0x00,0x00,0xff, @@ -36,3 +37,5 @@ static char chain_mask_bits[] = { 0xf1,0x38,0x80,0xe7,0xf1,0x38,0x80,0xe7,0xf1,0x3c,0x80,0xff,0xff,0x3f,0x00, 0x7f,0xff,0x1f,0x00,0x3e,0xde,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chainnot_curs.h b/vcl/inc/unx/x11_cursors/chainnot_curs.h index 841e2efdec63..e327586e3110 100644 --- a/vcl/inc/unx/x11_cursors/chainnot_curs.h +++ b/vcl/inc/unx/x11_cursors/chainnot_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define chainnot_curs_height 32 #define chainnot_curs_x_hot 2 #define chainnot_curs_y_hot 2 -static char chainnot_curs_bits[] = { +static unsigned char chainnot_curs_bits[] = { 0x00,0x00,0x00,0x00,0x80,0x1f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xf0,0xf0,0x00, 0x00,0x38,0xc0,0x01,0x00,0x7c,0x80,0x03,0x00,0xec,0x00,0x03,0x00,0xce,0x01, 0x07,0x00,0x86,0x03,0x06,0x00,0x06,0x07,0x06,0x00,0x06,0x0e,0x06,0x00,0x06, @@ -38,3 +39,5 @@ static char chainnot_curs_bits[] = { 0x44,0xa2,0x00,0x92,0x44,0xa2,0x00,0x92,0x44,0x92,0x00,0x62,0x3e,0x8d,0x00, 0x04,0x81,0x40,0x00,0xf8,0x78,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chainnot_mask.h b/vcl/inc/unx/x11_cursors/chainnot_mask.h index 9fbed6408c54..6666599ad64c 100644 --- a/vcl/inc/unx/x11_cursors/chainnot_mask.h +++ b/vcl/inc/unx/x11_cursors/chainnot_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define chainnot_mask_width 32 #define chainnot_mask_height 32 -static char chainnot_mask_bits[] = { +static unsigned char chainnot_mask_bits[] = { 0x80,0x1f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xf0,0xff,0x00,0x00,0xf8,0xff,0x01, 0x00,0xfc,0xf0,0x03,0x00,0xfe,0xc0,0x07,0x00,0xfe,0x81,0x07,0x00,0xff,0x83, 0x0f,0x00,0xcf,0x07,0x0f,0x00,0x8f,0x0f,0x0f,0x00,0x0f,0x1f,0x0f,0x00,0x0f, @@ -36,3 +37,5 @@ static char chainnot_mask_bits[] = { 0xc7,0xe3,0x00,0x9e,0xc7,0xe3,0x00,0x9e,0xc7,0xf3,0x00,0xfe,0xff,0xff,0x00, 0xfc,0xfd,0x7f,0x00,0xf8,0x78,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chart_curs.h b/vcl/inc/unx/x11_cursors/chart_curs.h index 9346fbd8f2c0..f1fbd5557ad4 100644 --- a/vcl/inc/unx/x11_cursors/chart_curs.h +++ b/vcl/inc/unx/x11_cursors/chart_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define chart_curs_height 32 #define chart_curs_x_hot 15 #define chart_curs_y_hot 16 -static char chart_curs_bits[] = { +static unsigned char chart_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00, @@ -38,3 +39,5 @@ static char chart_curs_bits[] = { 0x10,0x00,0x00,0x80,0x00,0x06,0x00,0x00,0x10,0x06,0x00,0x00,0x00,0x06,0x00, 0x00,0x10,0x36,0x00,0x00,0xc0,0x36,0x00,0x00,0xd0,0x36,0x00,0x00,0xc0,0x36, 0x00,0x00,0xf0,0x7f,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chart_mask.h b/vcl/inc/unx/x11_cursors/chart_mask.h index d4804fb6c85b..53f4ae125bda 100644 --- a/vcl/inc/unx/x11_cursors/chart_mask.h +++ b/vcl/inc/unx/x11_cursors/chart_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define chart_mask_height 32 #define chart_mask_x_hot 15 #define chart_mask_y_hot 16 -static char chart_mask_bits[] = { +static unsigned char chart_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00, @@ -38,3 +39,5 @@ static char chart_mask_bits[] = { 0x39,0x0f,0x00,0xc0,0x39,0x0f,0x00,0xc0,0x39,0x0f,0x00,0x00,0x38,0x7f,0x00, 0x00,0xf8,0x7f,0x00,0x00,0xf8,0x7f,0x00,0x00,0xf8,0x7f,0x00,0x00,0xf8,0xff, 0x00,0x00,0xf8,0xff,0x00,0x00,0xf8,0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copydata_curs.h b/vcl/inc/unx/x11_cursors/copydata_curs.h index e3d0e3e76530..a882a541a6d7 100644 --- a/vcl/inc/unx/x11_cursors/copydata_curs.h +++ b/vcl/inc/unx/x11_cursors/copydata_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copydata_curs_height 32 #define copydata_curs_x_hot 1 #define copydata_curs_y_hot 1 -static char copydata_curs_bits[] = { +static unsigned char copydata_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copydata_curs_bits[] = { 0xa8, 0xf2, 0x1e, 0x00, 0x50, 0x35, 0x18, 0x00, 0x00, 0xf0, 0x1e, 0x00, 0x00, 0xf0, 0x1e, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copydata_mask.h b/vcl/inc/unx/x11_cursors/copydata_mask.h index f25b0863d807..9cd73b08d106 100644 --- a/vcl/inc/unx/x11_cursors/copydata_mask.h +++ b/vcl/inc/unx/x11_cursors/copydata_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copydata_mask_height 32 #define copydata_mask_x_hot 1 #define copydata_mask_y_hot 1 -static char copydata_mask_bits[] = { +static unsigned char copydata_mask_bits[] = { 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copydata_mask_bits[] = { 0xfc, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copydlnk_curs.h b/vcl/inc/unx/x11_cursors/copydlnk_curs.h index 8e22a5bee37b..353297212083 100644 --- a/vcl/inc/unx/x11_cursors/copydlnk_curs.h +++ b/vcl/inc/unx/x11_cursors/copydlnk_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copydlnk_curs_height 32 #define copydlnk_curs_x_hot 1 #define copydlnk_curs_y_hot 1 -static char copydlnk_curs_bits[] = { +static unsigned char copydlnk_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copydlnk_curs_bits[] = { 0xf0, 0xf1, 0x1e, 0x00, 0x00, 0x34, 0x18, 0x00, 0x00, 0xf0, 0x1e, 0x00, 0x00, 0xf0, 0x1e, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copydlnk_mask.h b/vcl/inc/unx/x11_cursors/copydlnk_mask.h index 02ee5db5fbc1..b6ac40003814 100644 --- a/vcl/inc/unx/x11_cursors/copydlnk_mask.h +++ b/vcl/inc/unx/x11_cursors/copydlnk_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copydlnk_mask_height 32 #define copydlnk_mask_x_hot 1 #define copydlnk_mask_y_hot 1 -static char copydlnk_mask_bits[] = { +static unsigned char copydlnk_mask_bits[] = { 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copydlnk_mask_bits[] = { 0xf8, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyfile_curs.h b/vcl/inc/unx/x11_cursors/copyfile_curs.h index c74a1da26b66..da1366c71c6c 100644 --- a/vcl/inc/unx/x11_cursors/copyfile_curs.h +++ b/vcl/inc/unx/x11_cursors/copyfile_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copyfile_curs_height 32 #define copyfile_curs_x_hot 9 #define copyfile_curs_y_hot 9 -static char copyfile_curs_bits[] = { +static unsigned char copyfile_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x04, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copyfile_curs_bits[] = { 0x00, 0x80, 0xe1, 0x3d, 0x00, 0x00, 0x63, 0x30, 0x00, 0x00, 0xe3, 0x3d, 0x00, 0x00, 0xe0, 0x3d, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyfile_mask.h b/vcl/inc/unx/x11_cursors/copyfile_mask.h index c13089abaea5..5679ee8c2da8 100644 --- a/vcl/inc/unx/x11_cursors/copyfile_mask.h +++ b/vcl/inc/unx/x11_cursors/copyfile_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copyfile_mask_height 32 #define copyfile_mask_x_hot 9 #define copyfile_mask_y_hot 9 -static char copyfile_mask_bits[] = { +static unsigned char copyfile_mask_bits[] = { 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copyfile_mask_bits[] = { 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyfiles_curs.h b/vcl/inc/unx/x11_cursors/copyfiles_curs.h index e6a9b7a668af..c761f67ae370 100644 --- a/vcl/inc/unx/x11_cursors/copyfiles_curs.h +++ b/vcl/inc/unx/x11_cursors/copyfiles_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copyfiles_curs_height 32 #define copyfiles_curs_x_hot 8 #define copyfiles_curs_y_hot 9 -static char copyfiles_curs_bits[] = { +static unsigned char copyfiles_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xe0, 0x2f, 0x00, 0x00, 0xe8, 0x0f, 0x00, 0x00, 0xe8, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, 0x6a, 0x7e, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copyfiles_curs_bits[] = { 0x00, 0xc0, 0xe0, 0x3d, 0x00, 0x80, 0x61, 0x30, 0x00, 0x80, 0xe1, 0x3d, 0x00, 0x00, 0xe0, 0x3d, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyfiles_mask.h b/vcl/inc/unx/x11_cursors/copyfiles_mask.h index f904b7848f64..e6be0c5f105d 100644 --- a/vcl/inc/unx/x11_cursors/copyfiles_mask.h +++ b/vcl/inc/unx/x11_cursors/copyfiles_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copyfiles_mask_height 32 #define copyfiles_mask_x_hot 8 #define copyfiles_mask_y_hot 9 -static char copyfiles_mask_bits[] = { +static unsigned char copyfiles_mask_bits[] = { 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copyfiles_mask_bits[] = { 0x00, 0xe0, 0xf3, 0x7f, 0x00, 0xe0, 0xf3, 0x7f, 0x00, 0xc0, 0xf3, 0x7f, 0x00, 0xc0, 0xf3, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyflnk_curs.h b/vcl/inc/unx/x11_cursors/copyflnk_curs.h index b76368923f31..9fdf78685365 100644 --- a/vcl/inc/unx/x11_cursors/copyflnk_curs.h +++ b/vcl/inc/unx/x11_cursors/copyflnk_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copyflnk_curs_height 32 #define copyflnk_curs_x_hot 9 #define copyflnk_curs_y_hot 9 -static char copyflnk_curs_bits[] = { +static unsigned char copyflnk_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copyflnk_curs_bits[] = { 0x00, 0x80, 0xe1, 0x3d, 0x00, 0x00, 0x63, 0x30, 0x00, 0x00, 0xe3, 0x3d, 0x00, 0x00, 0xe0, 0x3d, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyflnk_mask.h b/vcl/inc/unx/x11_cursors/copyflnk_mask.h index b8fac92fdd75..3b678164e0c6 100644 --- a/vcl/inc/unx/x11_cursors/copyflnk_mask.h +++ b/vcl/inc/unx/x11_cursors/copyflnk_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copyflnk_mask_height 32 #define copyflnk_mask_x_hot 9 #define copyflnk_mask_y_hot 9 -static char copyflnk_mask_bits[] = { +static unsigned char copyflnk_mask_bits[] = { 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copyflnk_mask_bits[] = { 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/crook_curs.h b/vcl/inc/unx/x11_cursors/crook_curs.h index 6e4d5f613959..97db1feaa394 100644 --- a/vcl/inc/unx/x11_cursors/crook_curs.h +++ b/vcl/inc/unx/x11_cursors/crook_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define crook_curs_height 32 #define crook_curs_x_hot 15 #define crook_curs_y_hot 14 -static char crook_curs_bits[] = { +static unsigned char crook_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7c, 0x3e, 0xff, 0x7f, 0xbb, 0xdd, 0xfe, @@ -40,3 +41,5 @@ static char crook_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/crook_mask.h b/vcl/inc/unx/x11_cursors/crook_mask.h index 7493f3a501dc..534ad6da53fd 100644 --- a/vcl/inc/unx/x11_cursors/crook_mask.h +++ b/vcl/inc/unx/x11_cursors/crook_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define crook_mask_width 32 #define crook_mask_height 32 -static char crook_mask_bits[] = { +static unsigned char crook_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0xc1, 0x00, 0x80, 0xc7, 0xe3, 0x01, 0xc0, 0xef, 0xf7, 0x03, @@ -38,3 +39,5 @@ static char crook_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/crop_curs.h b/vcl/inc/unx/x11_cursors/crop_curs.h index a546ce6c1ba8..5647de80b196 100644 --- a/vcl/inc/unx/x11_cursors/crop_curs.h +++ b/vcl/inc/unx/x11_cursors/crop_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define crop_curs_height 32 #define crop_curs_x_hot 9 #define crop_curs_y_hot 9 -static char crop_curs_bits[] = { +static unsigned char crop_curs_bits[] = { 0xff, 0x0f, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff, 0x07, 0x60, 0xf8, 0xff, 0xf7, 0x6f, 0xfb, 0xff, 0xf7, 0x6f, 0xfb, 0xff, 0x37, 0x60, 0xf8, 0xff, 0xb7, 0x6f, 0xff, 0xff, 0xb7, 0x6f, 0xff, 0xff, @@ -40,3 +41,5 @@ static char crop_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/crop_mask.h b/vcl/inc/unx/x11_cursors/crop_mask.h index 5a10726cf36c..f7d3c87201c3 100644 --- a/vcl/inc/unx/x11_cursors/crop_mask.h +++ b/vcl/inc/unx/x11_cursors/crop_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define crop_mask_width 32 #define crop_mask_height 32 -static char crop_mask_bits[] = { +static unsigned char crop_mask_bits[] = { 0x00, 0xf8, 0x01, 0x00, 0x00, 0xf8, 0x01, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xf8, 0x01, 0x00, @@ -38,3 +39,5 @@ static char crop_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/detective_curs.h b/vcl/inc/unx/x11_cursors/detective_curs.h index 9d8a0d6a1c47..b2e3e2a375b9 100644 --- a/vcl/inc/unx/x11_cursors/detective_curs.h +++ b/vcl/inc/unx/x11_cursors/detective_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define detective_curs_height 32 #define detective_curs_x_hot 12 #define detective_curs_y_hot 13 -static char detective_curs_bits[] = { +static unsigned char detective_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x38,0x00, 0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c, 0x00,0x00,0x00,0x83,0x01,0x00,0x80,0x00,0x02,0x00,0x80,0x10,0x02,0x00,0x40, @@ -38,3 +39,5 @@ static char detective_curs_bits[] = { 0x70,0x00,0x00,0x10,0x60,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/detective_mask.h b/vcl/inc/unx/x11_cursors/detective_mask.h index 14402a37b641..e731aff3c989 100644 --- a/vcl/inc/unx/x11_cursors/detective_mask.h +++ b/vcl/inc/unx/x11_cursors/detective_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define detective_mask_height 32 #define detective_mask_x_hot 12 #define detective_mask_y_hot 13 -static char detective_mask_bits[] = { +static unsigned char detective_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x38,0x00, 0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c, 0x00,0x00,0x00,0xff,0x01,0x00,0x80,0xff,0x03,0x00,0x80,0xff,0x03,0x00,0xc0, @@ -38,3 +39,5 @@ static char detective_mask_bits[] = { 0x70,0x00,0x00,0x10,0x60,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawarc_curs.h b/vcl/inc/unx/x11_cursors/drawarc_curs.h index daea116e186e..08a3e324dae6 100644 --- a/vcl/inc/unx/x11_cursors/drawarc_curs.h +++ b/vcl/inc/unx/x11_cursors/drawarc_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawarc_curs_height 32 #define drawarc_curs_x_hot 7 #define drawarc_curs_y_hot 7 -static char drawarc_curs_bits[] = { +static unsigned char drawarc_curs_bits[] = { 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -40,3 +41,5 @@ static char drawarc_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawarc_mask.h b/vcl/inc/unx/x11_cursors/drawarc_mask.h index c9e2b6dd8737..b4e42dc824c6 100644 --- a/vcl/inc/unx/x11_cursors/drawarc_mask.h +++ b/vcl/inc/unx/x11_cursors/drawarc_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawarc_mask_width 32 #define drawarc_mask_height 32 -static char drawarc_mask_bits[] = { +static unsigned char drawarc_mask_bits[] = { 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, @@ -38,3 +39,5 @@ static char drawarc_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawbezier_curs.h b/vcl/inc/unx/x11_cursors/drawbezier_curs.h index ea677d4734aa..a84a2da70333 100644 --- a/vcl/inc/unx/x11_cursors/drawbezier_curs.h +++ b/vcl/inc/unx/x11_cursors/drawbezier_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawbezier_curs_height 32 #define drawbezier_curs_x_hot 7 #define drawbezier_curs_y_hot 7 -static char drawbezier_curs_bits[] = { +static unsigned char drawbezier_curs_bits[] = { 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -40,3 +41,5 @@ static char drawbezier_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawbezier_mask.h b/vcl/inc/unx/x11_cursors/drawbezier_mask.h index 17c1075d07a7..13bac21a4594 100644 --- a/vcl/inc/unx/x11_cursors/drawbezier_mask.h +++ b/vcl/inc/unx/x11_cursors/drawbezier_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawbezier_mask_width 32 #define drawbezier_mask_height 32 -static char drawbezier_mask_bits[] = { +static unsigned char drawbezier_mask_bits[] = { 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, @@ -38,3 +39,5 @@ static char drawbezier_mask_bits[] = { 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcaption_curs.h b/vcl/inc/unx/x11_cursors/drawcaption_curs.h index 3fe104f3673e..9905c240002d 100644 --- a/vcl/inc/unx/x11_cursors/drawcaption_curs.h +++ b/vcl/inc/unx/x11_cursors/drawcaption_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawcaption_curs_height 32 #define drawcaption_curs_x_hot 8 #define drawcaption_curs_y_hot 8 -static char drawcaption_curs_bits[] = { +static unsigned char drawcaption_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0x02, 0xff, 0xff, @@ -40,3 +41,5 @@ static char drawcaption_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcaption_mask.h b/vcl/inc/unx/x11_cursors/drawcaption_mask.h index 70b39e37b65e..98c0bc5aaf38 100644 --- a/vcl/inc/unx/x11_cursors/drawcaption_mask.h +++ b/vcl/inc/unx/x11_cursors/drawcaption_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawcaption_mask_width 32 #define drawcaption_mask_height 32 -static char drawcaption_mask_bits[] = { +static unsigned char drawcaption_mask_bits[] = { 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, @@ -38,3 +39,5 @@ static char drawcaption_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcirclecut_curs.h b/vcl/inc/unx/x11_cursors/drawcirclecut_curs.h index dc632873dd3b..c36720ad659e 100644 --- a/vcl/inc/unx/x11_cursors/drawcirclecut_curs.h +++ b/vcl/inc/unx/x11_cursors/drawcirclecut_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawcirclecut_curs_height 32 #define drawcirclecut_curs_x_hot 7 #define drawcirclecut_curs_y_hot 7 -static char drawcirclecut_curs_bits[] = { +static unsigned char drawcirclecut_curs_bits[] = { 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -40,3 +41,5 @@ static char drawcirclecut_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcirclecut_mask.h b/vcl/inc/unx/x11_cursors/drawcirclecut_mask.h index 1f96be33b86a..885c210bda34 100644 --- a/vcl/inc/unx/x11_cursors/drawcirclecut_mask.h +++ b/vcl/inc/unx/x11_cursors/drawcirclecut_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawcirclecut_mask_width 32 #define drawcirclecut_mask_height 32 -static char drawcirclecut_mask_bits[] = { +static unsigned char drawcirclecut_mask_bits[] = { 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, @@ -38,3 +39,5 @@ static char drawcirclecut_mask_bits[] = { 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawconnect_curs.h b/vcl/inc/unx/x11_cursors/drawconnect_curs.h index 994f34b96e0e..40f4e6dc3905 100644 --- a/vcl/inc/unx/x11_cursors/drawconnect_curs.h +++ b/vcl/inc/unx/x11_cursors/drawconnect_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawconnect_curs_height 32 #define drawconnect_curs_x_hot 7 #define drawconnect_curs_y_hot 7 -static char drawconnect_curs_bits[] = { +static unsigned char drawconnect_curs_bits[] = { 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -40,3 +41,5 @@ static char drawconnect_curs_bits[] = { 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawconnect_mask.h b/vcl/inc/unx/x11_cursors/drawconnect_mask.h index 187cf31cfd1a..270cdbac3fe6 100644 --- a/vcl/inc/unx/x11_cursors/drawconnect_mask.h +++ b/vcl/inc/unx/x11_cursors/drawconnect_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawconnect_mask_width 32 #define drawconnect_mask_height 32 -static char drawconnect_mask_bits[] = { +static unsigned char drawconnect_mask_bits[] = { 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, @@ -38,3 +39,5 @@ static char drawconnect_mask_bits[] = { 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcrook_curs.h b/vcl/inc/unx/x11_cursors/drawcrook_curs.h index 4fdba0e8442a..e89e91322432 100644 --- a/vcl/inc/unx/x11_cursors/drawcrook_curs.h +++ b/vcl/inc/unx/x11_cursors/drawcrook_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawcrook_curs_height 32 #define drawcrook_curs_x_hot 15 #define drawcrook_curs_y_hot 14 -static char drawcrook_curs_bits[] = { +static unsigned char drawcrook_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7c, 0x3e, 0xff, 0x7f, 0xbb, 0xdd, 0xfe, @@ -40,3 +41,5 @@ static char drawcrook_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcrook_mask.h b/vcl/inc/unx/x11_cursors/drawcrook_mask.h index 657fcff2b4fd..b42d2591d123 100644 --- a/vcl/inc/unx/x11_cursors/drawcrook_mask.h +++ b/vcl/inc/unx/x11_cursors/drawcrook_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawcrook_mask_width 32 #define drawcrook_mask_height 32 -static char drawcrook_mask_bits[] = { +static unsigned char drawcrook_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0xc1, 0x00, 0x80, 0xc7, 0xe3, 0x01, 0xc0, 0xef, 0xf7, 0x03, @@ -38,3 +39,5 @@ static char drawcrook_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcrop_curs.h b/vcl/inc/unx/x11_cursors/drawcrop_curs.h index 7f574e1ab351..903c5b314418 100644 --- a/vcl/inc/unx/x11_cursors/drawcrop_curs.h +++ b/vcl/inc/unx/x11_cursors/drawcrop_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawcrop_curs_height 32 #define drawcrop_curs_x_hot 9 #define drawcrop_curs_y_hot 9 -static char drawcrop_curs_bits[] = { +static unsigned char drawcrop_curs_bits[] = { 0xff, 0x0f, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff, 0x07, 0x60, 0xf8, 0xff, 0xf7, 0x6f, 0xfb, 0xff, 0xf7, 0x6f, 0xfb, 0xff, 0x37, 0x60, 0xf8, 0xff, 0xb7, 0x6f, 0xff, 0xff, 0xb7, 0x6f, 0xff, 0xff, @@ -40,3 +41,5 @@ static char drawcrop_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcrop_mask.h b/vcl/inc/unx/x11_cursors/drawcrop_mask.h index ac2e8885bdbb..eea6b4448146 100644 --- a/vcl/inc/unx/x11_cursors/drawcrop_mask.h +++ b/vcl/inc/unx/x11_cursors/drawcrop_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawcrop_mask_width 32 #define drawcrop_mask_height 32 -static char drawcrop_mask_bits[] = { +static unsigned char drawcrop_mask_bits[] = { 0x00, 0xf8, 0x01, 0x00, 0x00, 0xf8, 0x01, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xf8, 0x01, 0x00, @@ -38,3 +39,5 @@ static char drawcrop_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawellipse_curs.h b/vcl/inc/unx/x11_cursors/drawellipse_curs.h index bddc330d71d2..5928139b81f3 100644 --- a/vcl/inc/unx/x11_cursors/drawellipse_curs.h +++ b/vcl/inc/unx/x11_cursors/drawellipse_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawellipse_curs_height 32 #define drawellipse_curs_x_hot 7 #define drawellipse_curs_y_hot 7 -static char drawellipse_curs_bits[] = { +static unsigned char drawellipse_curs_bits[] = { 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -40,3 +41,5 @@ static char drawellipse_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawellipse_mask.h b/vcl/inc/unx/x11_cursors/drawellipse_mask.h index 0ac5f200eab1..72ceedfb57ee 100644 --- a/vcl/inc/unx/x11_cursors/drawellipse_mask.h +++ b/vcl/inc/unx/x11_cursors/drawellipse_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawellipse_mask_width 32 #define drawellipse_mask_height 32 -static char drawellipse_mask_bits[] = { +static unsigned char drawellipse_mask_bits[] = { 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, @@ -38,3 +39,5 @@ static char drawellipse_mask_bits[] = { 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawfreehand_curs.h b/vcl/inc/unx/x11_cursors/drawfreehand_curs.h index 75795c088c8e..644d5bbb639d 100644 --- a/vcl/inc/unx/x11_cursors/drawfreehand_curs.h +++ b/vcl/inc/unx/x11_cursors/drawfreehand_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawfreehand_curs_height 32 #define drawfreehand_curs_x_hot 8 #define drawfreehand_curs_y_hot 8 -static char drawfreehand_curs_bits[] = { +static unsigned char drawfreehand_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xfd, 0x00, 0x00, @@ -40,3 +41,5 @@ static char drawfreehand_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawfreehand_mask.h b/vcl/inc/unx/x11_cursors/drawfreehand_mask.h index 29edf44a9999..959a54e827fe 100644 --- a/vcl/inc/unx/x11_cursors/drawfreehand_mask.h +++ b/vcl/inc/unx/x11_cursors/drawfreehand_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawfreehand_mask_width 32 #define drawfreehand_mask_height 32 -static char drawfreehand_mask_bits[] = { +static unsigned char drawfreehand_mask_bits[] = { 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, @@ -38,3 +39,5 @@ static char drawfreehand_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawline_curs.h b/vcl/inc/unx/x11_cursors/drawline_curs.h index 2d2aa162fac6..84f78ccec876 100644 --- a/vcl/inc/unx/x11_cursors/drawline_curs.h +++ b/vcl/inc/unx/x11_cursors/drawline_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawline_curs_height 32 #define drawline_curs_x_hot 7 #define drawline_curs_y_hot 7 -static char drawline_curs_bits[] = { +static unsigned char drawline_curs_bits[] = { 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -40,3 +41,5 @@ static char drawline_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawline_mask.h b/vcl/inc/unx/x11_cursors/drawline_mask.h index d66b0fd09aaa..80784ca860b6 100644 --- a/vcl/inc/unx/x11_cursors/drawline_mask.h +++ b/vcl/inc/unx/x11_cursors/drawline_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawline_mask_width 32 #define drawline_mask_height 32 -static char drawline_mask_bits[] = { +static unsigned char drawline_mask_bits[] = { 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00, 0xbf, 0xfe, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00, @@ -38,3 +39,5 @@ static char drawline_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawmirror_curs.h b/vcl/inc/unx/x11_cursors/drawmirror_curs.h index 3f61e751befb..b68907138e42 100644 --- a/vcl/inc/unx/x11_cursors/drawmirror_curs.h +++ b/vcl/inc/unx/x11_cursors/drawmirror_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawmirror_curs_height 32 #define drawmirror_curs_x_hot 14 #define drawmirror_curs_y_hot 12 -static char drawmirror_curs_bits[] = { +static unsigned char drawmirror_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0x03, 0xf8, 0xf5, 0xff, 0xfb, 0xfb, 0xee, 0xff, 0x0b, 0xfa, 0xf5, 0xff, 0xeb, 0xfa, 0xfa, 0xff, 0xeb, 0xfa, 0xfa, 0xff, 0xeb, 0x7a, 0xfd, 0xff, 0xeb, 0x7a, 0xfd, 0xff, @@ -40,3 +41,5 @@ static char drawmirror_curs_bits[] = { 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawmirror_mask.h b/vcl/inc/unx/x11_cursors/drawmirror_mask.h index 5394dd74576a..231f109a24ae 100644 --- a/vcl/inc/unx/x11_cursors/drawmirror_mask.h +++ b/vcl/inc/unx/x11_cursors/drawmirror_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawmirror_mask_width 32 #define drawmirror_mask_height 32 -static char drawmirror_mask_bits[] = { +static unsigned char drawmirror_mask_bits[] = { 0x00, 0x00, 0x04, 0x00, 0xfe, 0x0f, 0x0e, 0x00, 0xfe, 0x0f, 0x1f, 0x00, 0xfe, 0x8f, 0x3f, 0x00, 0xfe, 0x0f, 0x1f, 0x00, 0xfe, 0x8f, 0x0f, 0x00, 0xbe, 0x8f, 0x0f, 0x00, 0xbe, 0xcf, 0x07, 0x00, 0xbe, 0xcf, 0x87, 0x00, @@ -38,3 +39,5 @@ static char drawmirror_mask_bits[] = { 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawpie_curs.h b/vcl/inc/unx/x11_cursors/drawpie_curs.h index 327b15258d3d..1cc5933c88b3 100644 --- a/vcl/inc/unx/x11_cursors/drawpie_curs.h +++ b/vcl/inc/unx/x11_cursors/drawpie_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawpie_curs_height 32 #define drawpie_curs_x_hot 7 #define drawpie_curs_y_hot 7 -static char drawpie_curs_bits[] = { +static unsigned char drawpie_curs_bits[] = { 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -40,3 +41,5 @@ static char drawpie_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawpie_mask.h b/vcl/inc/unx/x11_cursors/drawpie_mask.h index 6b5e5ac4ff0d..880be6043497 100644 --- a/vcl/inc/unx/x11_cursors/drawpie_mask.h +++ b/vcl/inc/unx/x11_cursors/drawpie_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawpie_mask_width 32 #define drawpie_mask_height 32 -static char drawpie_mask_bits[] = { +static unsigned char drawpie_mask_bits[] = { 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, @@ -38,3 +39,5 @@ static char drawpie_mask_bits[] = { 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawpolygon_curs.h b/vcl/inc/unx/x11_cursors/drawpolygon_curs.h index ee68c707444c..a101b1bff576 100644 --- a/vcl/inc/unx/x11_cursors/drawpolygon_curs.h +++ b/vcl/inc/unx/x11_cursors/drawpolygon_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawpolygon_curs_height 32 #define drawpolygon_curs_x_hot 7 #define drawpolygon_curs_y_hot 7 -static char drawpolygon_curs_bits[] = { +static unsigned char drawpolygon_curs_bits[] = { 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -40,3 +41,5 @@ static char drawpolygon_curs_bits[] = { 0x00, 0x00, 0x89, 0x03, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawpolygon_mask.h b/vcl/inc/unx/x11_cursors/drawpolygon_mask.h index 8b82e237233c..660bee287c09 100644 --- a/vcl/inc/unx/x11_cursors/drawpolygon_mask.h +++ b/vcl/inc/unx/x11_cursors/drawpolygon_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawpolygon_mask_width 32 #define drawpolygon_mask_height 32 -static char drawpolygon_mask_bits[] = { +static unsigned char drawpolygon_mask_bits[] = { 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, @@ -38,3 +39,5 @@ static char drawpolygon_mask_bits[] = { 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x0e, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawrect_curs.h b/vcl/inc/unx/x11_cursors/drawrect_curs.h index c2508d37fad5..553df540aa29 100644 --- a/vcl/inc/unx/x11_cursors/drawrect_curs.h +++ b/vcl/inc/unx/x11_cursors/drawrect_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawrect_curs_height 32 #define drawrect_curs_x_hot 7 #define drawrect_curs_y_hot 7 -static char drawrect_curs_bits[] = { +static unsigned char drawrect_curs_bits[] = { 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -40,3 +41,5 @@ static char drawrect_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawrect_mask.h b/vcl/inc/unx/x11_cursors/drawrect_mask.h index 955152f312c9..3bb39e1d98a8 100644 --- a/vcl/inc/unx/x11_cursors/drawrect_mask.h +++ b/vcl/inc/unx/x11_cursors/drawrect_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawrect_mask_width 32 #define drawrect_mask_height 32 -static char drawrect_mask_bits[] = { +static unsigned char drawrect_mask_bits[] = { 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, @@ -38,3 +39,5 @@ static char drawrect_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawtext_curs.h b/vcl/inc/unx/x11_cursors/drawtext_curs.h index c5049670b9ec..67726d6e5a2d 100644 --- a/vcl/inc/unx/x11_cursors/drawtext_curs.h +++ b/vcl/inc/unx/x11_cursors/drawtext_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define drawtext_curs_height 32 #define drawtext_curs_x_hot 8 #define drawtext_curs_y_hot 8 -static char drawtext_curs_bits[] = { +static unsigned char drawtext_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xfd, 0x00, 0x00, @@ -40,3 +41,5 @@ static char drawtext_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawtext_mask.h b/vcl/inc/unx/x11_cursors/drawtext_mask.h index e27ce2514306..ce1fc2c41053 100644 --- a/vcl/inc/unx/x11_cursors/drawtext_mask.h +++ b/vcl/inc/unx/x11_cursors/drawtext_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define drawtext_mask_width 32 #define drawtext_mask_height 32 -static char drawtext_mask_bits[] = { +static unsigned char drawtext_mask_bits[] = { 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, @@ -38,3 +39,5 @@ static char drawtext_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/fill_curs.h b/vcl/inc/unx/x11_cursors/fill_curs.h index 792ea50e4f00..c8dfbb274f13 100644 --- a/vcl/inc/unx/x11_cursors/fill_curs.h +++ b/vcl/inc/unx/x11_cursors/fill_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define fill_curs_height 32 #define fill_curs_x_hot 10 #define fill_curs_y_hot 22 -static char fill_curs_bits[] = { +static unsigned char fill_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x80,0x02,0x00,0x00,0x5c,0x0c,0x00,0x00, @@ -38,3 +39,5 @@ static char fill_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/fill_mask.h b/vcl/inc/unx/x11_cursors/fill_mask.h index 67681f243f7b..32b25ae67660 100644 --- a/vcl/inc/unx/x11_cursors/fill_mask.h +++ b/vcl/inc/unx/x11_cursors/fill_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define fill_mask_height 32 #define fill_mask_x_hot 10 #define fill_mask_y_hot 22 -static char fill_mask_bits[] = { +static unsigned char fill_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x80,0x03,0x00,0x00,0xdc,0x0f,0x00,0x00, @@ -38,3 +39,5 @@ static char fill_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/hshear_curs.h b/vcl/inc/unx/x11_cursors/hshear_curs.h index 7f6092b648de..edaa9fe7958b 100644 --- a/vcl/inc/unx/x11_cursors/hshear_curs.h +++ b/vcl/inc/unx/x11_cursors/hshear_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define hshear_curs_height 32 #define hshear_curs_x_hot 15 #define hshear_curs_y_hot 15 -static char hshear_curs_bits[] = { +static unsigned char hshear_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -40,3 +41,5 @@ static char hshear_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/hshear_mask.h b/vcl/inc/unx/x11_cursors/hshear_mask.h index 6d09b3b0af01..5c6f9a017e5a 100644 --- a/vcl/inc/unx/x11_cursors/hshear_mask.h +++ b/vcl/inc/unx/x11_cursors/hshear_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define hshear_mask_width 32 #define hshear_mask_height 32 -static char hshear_mask_bits[] = { +static unsigned char hshear_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -38,3 +39,5 @@ static char hshear_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/invert50.h b/vcl/inc/unx/x11_cursors/invert50.h index 7c0d00ce8fa4..b1f4c1e86d18 100644 --- a/vcl/inc/unx/x11_cursors/invert50.h +++ b/vcl/inc/unx/x11_cursors/invert50.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define invert50_width 32 #define invert50_height 32 -static char invert50_bits[] = { +static unsigned char invert50_bits[] = { #if 1 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, @@ -63,3 +64,5 @@ static char invert50_bits[] = { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, #endif }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/linkdata_curs.h b/vcl/inc/unx/x11_cursors/linkdata_curs.h index c60edc3b99d0..054ef55ef2bb 100644 --- a/vcl/inc/unx/x11_cursors/linkdata_curs.h +++ b/vcl/inc/unx/x11_cursors/linkdata_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define linkdata_curs_height 32 #define linkdata_curs_x_hot 1 #define linkdata_curs_y_hot 1 -static char linkdata_curs_bits[] = { +static unsigned char linkdata_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, @@ -40,3 +41,5 @@ static char linkdata_curs_bits[] = { 0xa8, 0x72, 0x18, 0x00, 0x50, 0x35, 0x1a, 0x00, 0x00, 0x30, 0x1f, 0x00, 0x00, 0xb0, 0x1f, 0x00, 0x00, 0x70, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/linkdata_mask.h b/vcl/inc/unx/x11_cursors/linkdata_mask.h index cf0f89f63b1b..429c603066dc 100644 --- a/vcl/inc/unx/x11_cursors/linkdata_mask.h +++ b/vcl/inc/unx/x11_cursors/linkdata_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define linkdata_mask_height 32 #define linkdata_mask_x_hot 1 #define linkdata_mask_y_hot 1 -static char linkdata_mask_bits[] = { +static unsigned char linkdata_mask_bits[] = { 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, @@ -40,3 +41,5 @@ static char linkdata_mask_bits[] = { 0xfc, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/linkfile_curs.h b/vcl/inc/unx/x11_cursors/linkfile_curs.h index fb676ae2a04b..5f68af135810 100644 --- a/vcl/inc/unx/x11_cursors/linkfile_curs.h +++ b/vcl/inc/unx/x11_cursors/linkfile_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define linkfile_curs_height 32 #define linkfile_curs_x_hot 9 #define linkfile_curs_y_hot 9 -static char linkfile_curs_bits[] = { +static unsigned char linkfile_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x04, 0x00, 0x00, @@ -40,3 +41,5 @@ static char linkfile_curs_bits[] = { 0x00, 0x80, 0xe1, 0x30, 0x00, 0x00, 0x63, 0x34, 0x00, 0x00, 0x63, 0x3e, 0x00, 0x00, 0x60, 0x3f, 0x00, 0x00, 0xe0, 0x3e, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/linkfile_mask.h b/vcl/inc/unx/x11_cursors/linkfile_mask.h index 28ff46c4fae4..fad8d6ad7624 100644 --- a/vcl/inc/unx/x11_cursors/linkfile_mask.h +++ b/vcl/inc/unx/x11_cursors/linkfile_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define linkfile_mask_height 32 #define linkfile_mask_x_hot 9 #define linkfile_mask_y_hot 9 -static char linkfile_mask_bits[] = { +static unsigned char linkfile_mask_bits[] = { 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, @@ -40,3 +41,5 @@ static char linkfile_mask_bits[] = { 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/magnify_curs.h b/vcl/inc/unx/x11_cursors/magnify_curs.h index 76114ca410d5..4db8bb382b15 100644 --- a/vcl/inc/unx/x11_cursors/magnify_curs.h +++ b/vcl/inc/unx/x11_cursors/magnify_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define magnify_curs_height 32 #define magnify_curs_x_hot 12 #define magnify_curs_y_hot 13 -static char magnify_curs_bits[] = { +static unsigned char magnify_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x83, 0x01,0x00,0x80,0x00,0x02,0x00,0x40,0x00,0x04,0x00,0x40,0x00,0x04,0x00,0x20, @@ -38,3 +39,5 @@ static char magnify_curs_bits[] = { 0x70,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/magnify_mask.h b/vcl/inc/unx/x11_cursors/magnify_mask.h index db4213943b6e..a7b5b027362d 100644 --- a/vcl/inc/unx/x11_cursors/magnify_mask.h +++ b/vcl/inc/unx/x11_cursors/magnify_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define magnify_mask_width 32 #define magnify_mask_height 32 -static char magnify_mask_bits[] = { +static unsigned char magnify_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x80, 0xff, 0x03, 0x00, 0xc0, 0x83, 0x07, 0x00, @@ -38,3 +39,5 @@ static char magnify_mask_bits[] = { 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/mirror_curs.h b/vcl/inc/unx/x11_cursors/mirror_curs.h index 0f0f1b360224..c2488a6fd725 100644 --- a/vcl/inc/unx/x11_cursors/mirror_curs.h +++ b/vcl/inc/unx/x11_cursors/mirror_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define mirror_curs_height 32 #define mirror_curs_x_hot 14 #define mirror_curs_y_hot 12 -static char mirror_curs_bits[] = { +static unsigned char mirror_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0x03, 0xf8, 0xf5, 0xff, 0xfb, 0xfb, 0xee, 0xff, 0x0b, 0xfa, 0xf5, 0xff, 0xeb, 0xfa, 0xfa, 0xff, 0xeb, 0xfa, 0xfa, 0xff, 0xeb, 0x7a, 0xfd, 0xff, 0xeb, 0x7a, 0xfd, 0xff, @@ -40,3 +41,5 @@ static char mirror_curs_bits[] = { 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/mirror_mask.h b/vcl/inc/unx/x11_cursors/mirror_mask.h index da9c00435162..60e8f1593b2b 100644 --- a/vcl/inc/unx/x11_cursors/mirror_mask.h +++ b/vcl/inc/unx/x11_cursors/mirror_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define mirror_mask_width 32 #define mirror_mask_height 32 -static char mirror_mask_bits[] = { +static unsigned char mirror_mask_bits[] = { 0x00, 0x00, 0x04, 0x00, 0xfe, 0x0f, 0x0e, 0x00, 0xfe, 0x0f, 0x1f, 0x00, 0xfe, 0x8f, 0x3f, 0x00, 0xfe, 0x0f, 0x1f, 0x00, 0xfe, 0x8f, 0x0f, 0x00, 0xbe, 0x8f, 0x0f, 0x00, 0xbe, 0xcf, 0x07, 0x00, 0xbe, 0xcf, 0x87, 0x00, @@ -38,3 +39,5 @@ static char mirror_mask_bits[] = { 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movebezierweight_curs.h b/vcl/inc/unx/x11_cursors/movebezierweight_curs.h index a1ece2d925e9..df99aab7ea0f 100644 --- a/vcl/inc/unx/x11_cursors/movebezierweight_curs.h +++ b/vcl/inc/unx/x11_cursors/movebezierweight_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movebezierweight_curs_height 32 #define movebezierweight_curs_x_hot 0 #define movebezierweight_curs_y_hot 0 -static char movebezierweight_curs_bits[] = { +static unsigned char movebezierweight_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, @@ -40,3 +41,5 @@ static char movebezierweight_curs_bits[] = { 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movebezierweight_mask.h b/vcl/inc/unx/x11_cursors/movebezierweight_mask.h index 27e0d8c703db..831f427a9086 100644 --- a/vcl/inc/unx/x11_cursors/movebezierweight_mask.h +++ b/vcl/inc/unx/x11_cursors/movebezierweight_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define movebezierweight_mask_width 32 #define movebezierweight_mask_height 32 -static char movebezierweight_mask_bits[] = { +static unsigned char movebezierweight_mask_bits[] = { 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, @@ -38,3 +39,5 @@ static char movebezierweight_mask_bits[] = { 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movedata_curs.h b/vcl/inc/unx/x11_cursors/movedata_curs.h index b79412bc3f41..642bbd176e4b 100644 --- a/vcl/inc/unx/x11_cursors/movedata_curs.h +++ b/vcl/inc/unx/x11_cursors/movedata_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movedata_curs_height 32 #define movedata_curs_x_hot 1 #define movedata_curs_y_hot 1 -static char movedata_curs_bits[] = { +static unsigned char movedata_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, @@ -40,3 +41,5 @@ static char movedata_curs_bits[] = { 0xa8, 0xaa, 0x00, 0x00, 0x50, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movedata_mask.h b/vcl/inc/unx/x11_cursors/movedata_mask.h index e25d0837d8dc..f06c80f1728c 100644 --- a/vcl/inc/unx/x11_cursors/movedata_mask.h +++ b/vcl/inc/unx/x11_cursors/movedata_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movedata_mask_height 32 #define movedata_mask_x_hot 1 #define movedata_mask_y_hot 1 -static char movedata_mask_bits[] = { +static unsigned char movedata_mask_bits[] = { 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, @@ -40,3 +41,5 @@ static char movedata_mask_bits[] = { 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movedlnk_curs.h b/vcl/inc/unx/x11_cursors/movedlnk_curs.h index 56608b8153a6..c163488d8d26 100644 --- a/vcl/inc/unx/x11_cursors/movedlnk_curs.h +++ b/vcl/inc/unx/x11_cursors/movedlnk_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movedlnk_curs_height 32 #define movedlnk_curs_x_hot 1 #define movedlnk_curs_y_hot 1 -static char movedlnk_curs_bits[] = { +static unsigned char movedlnk_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, @@ -40,3 +41,5 @@ static char movedlnk_curs_bits[] = { 0xf0, 0xa9, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movedlnk_mask.h b/vcl/inc/unx/x11_cursors/movedlnk_mask.h index 2aa3eb4b277d..8f3fa3cb92f6 100644 --- a/vcl/inc/unx/x11_cursors/movedlnk_mask.h +++ b/vcl/inc/unx/x11_cursors/movedlnk_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movedlnk_mask_height 32 #define movedlnk_mask_x_hot 1 #define movedlnk_mask_y_hot 1 -static char movedlnk_mask_bits[] = { +static unsigned char movedlnk_mask_bits[] = { 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, @@ -40,3 +41,5 @@ static char movedlnk_mask_bits[] = { 0xf8, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x01, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movefile_curs.h b/vcl/inc/unx/x11_cursors/movefile_curs.h index ed3a11e7f49d..54c3ce91df96 100644 --- a/vcl/inc/unx/x11_cursors/movefile_curs.h +++ b/vcl/inc/unx/x11_cursors/movefile_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movefile_curs_height 32 #define movefile_curs_x_hot 9 #define movefile_curs_y_hot 9 -static char movefile_curs_bits[] = { +static unsigned char movefile_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x04, 0x00, 0x00, @@ -40,3 +41,5 @@ static char movefile_curs_bits[] = { 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movefile_mask.h b/vcl/inc/unx/x11_cursors/movefile_mask.h index 668d8d7e8015..566b3fdeb8de 100644 --- a/vcl/inc/unx/x11_cursors/movefile_mask.h +++ b/vcl/inc/unx/x11_cursors/movefile_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movefile_mask_height 32 #define movefile_mask_x_hot 9 #define movefile_mask_y_hot 9 -static char movefile_mask_bits[] = { +static unsigned char movefile_mask_bits[] = { 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, @@ -40,3 +41,5 @@ static char movefile_mask_bits[] = { 0x00, 0xc0, 0x07, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movefiles_curs.h b/vcl/inc/unx/x11_cursors/movefiles_curs.h index 148fe2e72a5e..95ec95bd8302 100644 --- a/vcl/inc/unx/x11_cursors/movefiles_curs.h +++ b/vcl/inc/unx/x11_cursors/movefiles_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movefiles_curs_height 32 #define movefiles_curs_x_hot 8 #define movefiles_curs_y_hot 9 -static char movefiles_curs_bits[] = { +static unsigned char movefiles_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xe0, 0x2f, 0x00, 0x00, 0xe8, 0x0f, 0x00, 0x00, 0xe8, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, 0x6a, 0x7e, 0x00, 0x00, @@ -40,3 +41,5 @@ static char movefiles_curs_bits[] = { 0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movefiles_mask.h b/vcl/inc/unx/x11_cursors/movefiles_mask.h index dc990dc5cb61..03a56a169218 100644 --- a/vcl/inc/unx/x11_cursors/movefiles_mask.h +++ b/vcl/inc/unx/x11_cursors/movefiles_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movefiles_mask_height 32 #define movefiles_mask_x_hot 8 #define movefiles_mask_y_hot 9 -static char movefiles_mask_bits[] = { +static unsigned char movefiles_mask_bits[] = { 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, @@ -40,3 +41,5 @@ static char movefiles_mask_bits[] = { 0x00, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/moveflnk_curs.h b/vcl/inc/unx/x11_cursors/moveflnk_curs.h index 7f48bc4506fc..1f1fea56dead 100644 --- a/vcl/inc/unx/x11_cursors/moveflnk_curs.h +++ b/vcl/inc/unx/x11_cursors/moveflnk_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define moveflnk_curs_height 32 #define moveflnk_curs_x_hot 9 #define moveflnk_curs_y_hot 9 -static char moveflnk_curs_bits[] = { +static unsigned char moveflnk_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, @@ -40,3 +41,5 @@ static char moveflnk_curs_bits[] = { 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/moveflnk_mask.h b/vcl/inc/unx/x11_cursors/moveflnk_mask.h index a25b7ee18960..f8312aba525e 100644 --- a/vcl/inc/unx/x11_cursors/moveflnk_mask.h +++ b/vcl/inc/unx/x11_cursors/moveflnk_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define moveflnk_mask_height 32 #define moveflnk_mask_x_hot 9 #define moveflnk_mask_y_hot 9 -static char moveflnk_mask_bits[] = { +static unsigned char moveflnk_mask_bits[] = { 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, @@ -40,3 +41,5 @@ static char moveflnk_mask_bits[] = { 0x00, 0xc0, 0x07, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movepoint_curs.h b/vcl/inc/unx/x11_cursors/movepoint_curs.h index e3b20bd8edf9..8ccf2d581455 100644 --- a/vcl/inc/unx/x11_cursors/movepoint_curs.h +++ b/vcl/inc/unx/x11_cursors/movepoint_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movepoint_curs_height 32 #define movepoint_curs_x_hot 0 #define movepoint_curs_y_hot 0 -static char movepoint_curs_bits[] = { +static unsigned char movepoint_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, @@ -40,3 +41,5 @@ static char movepoint_curs_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movepoint_mask.h b/vcl/inc/unx/x11_cursors/movepoint_mask.h index e4fae36c023c..547dfb03a87e 100644 --- a/vcl/inc/unx/x11_cursors/movepoint_mask.h +++ b/vcl/inc/unx/x11_cursors/movepoint_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define movepoint_mask_width 32 #define movepoint_mask_height 32 -static char movepoint_mask_bits[] = { +static unsigned char movepoint_mask_bits[] = { 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, @@ -38,3 +39,5 @@ static char movepoint_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/nodrop_curs.h b/vcl/inc/unx/x11_cursors/nodrop_curs.h index 8e208e32f293..5c501d3876c4 100644 --- a/vcl/inc/unx/x11_cursors/nodrop_curs.h +++ b/vcl/inc/unx/x11_cursors/nodrop_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define nodrop_curs_height 32 #define nodrop_curs_x_hot 9 #define nodrop_curs_y_hot 9 -static char nodrop_curs_bits[] = { +static unsigned char nodrop_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x7c, 0xf8, 0x00, 0x00, 0x1c, 0xfc, 0x00, 0x00, 0x1e, 0xfe, 0x01, 0x00, 0x0e, 0xdf, 0x01, 0x00, 0x8e, 0xcf, 0x01, 0x00, @@ -40,3 +41,5 @@ static char nodrop_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/nodrop_mask.h b/vcl/inc/unx/x11_cursors/nodrop_mask.h index 7cbecef2c60f..bd315dc28df1 100644 --- a/vcl/inc/unx/x11_cursors/nodrop_mask.h +++ b/vcl/inc/unx/x11_cursors/nodrop_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define nodrop_mask_height 32 #define nodrop_mask_x_hot 9 #define nodrop_mask_y_hot 9 -static char nodrop_mask_bits[] = { +static unsigned char nodrop_mask_bits[] = { 0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0xfc, 0xff, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x7e, 0xfe, 0x01, 0x00, 0x3f, 0xff, 0x03, 0x00, 0x9f, 0xff, 0x03, 0x00, 0xdf, 0xff, 0x03, 0x00, @@ -40,3 +41,5 @@ static char nodrop_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/null_curs.h b/vcl/inc/unx/x11_cursors/null_curs.h index 19d4130d4b5d..1f5687cbcf61 100644 --- a/vcl/inc/unx/x11_cursors/null_curs.h +++ b/vcl/inc/unx/x11_cursors/null_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,4 +29,6 @@ #define nullcurs_height 4 #define nullcurs_x_hot 2 #define nullcurs_y_hot 2 -static char nullcurs_bits[] = { 0x00, 0x00 }; +static unsigned char nullcurs_bits[] = { 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/null_mask.h b/vcl/inc/unx/x11_cursors/null_mask.h index a657cfa54af4..e7ff46805d41 100644 --- a/vcl/inc/unx/x11_cursors/null_mask.h +++ b/vcl/inc/unx/x11_cursors/null_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,4 +27,6 @@ ************************************************************************/ #define nullmask_width 4 #define nullmask_height 4 -static char nullmask_bits[] = { 0x00, 0x00 }; +static unsigned char nullmask_bits[] = { 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/paintbrush_curs.h b/vcl/inc/unx/x11_cursors/paintbrush_curs.h index 5dfd18a539a6..1e3cef066ddc 100644 --- a/vcl/inc/unx/x11_cursors/paintbrush_curs.h +++ b/vcl/inc/unx/x11_cursors/paintbrush_curs.h @@ -1,8 +1,11 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define paintbrush_curs_width 16 #define paintbrush_curs_height 16 #define paintbrush_curs_x_hot 0 #define paintbrush_curs_y_hot 10 -static char paintbrush_curs_bits[] = { +static unsigned char paintbrush_curs_bits[] = { 0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x90, 0x80, 0xcb, 0x60, 0x64, 0x90, 0x34, 0x08, 0x19, 0x06, 0x22, 0x11, 0x24, 0x09, 0x18, 0x46, 0x14, 0x24, 0x0a, 0x18, 0x05, 0x90, 0x02, 0xe0, 0x01 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/paintbrush_mask.h b/vcl/inc/unx/x11_cursors/paintbrush_mask.h index a5b5617b820f..4e3000d3b981 100644 --- a/vcl/inc/unx/x11_cursors/paintbrush_mask.h +++ b/vcl/inc/unx/x11_cursors/paintbrush_mask.h @@ -1,7 +1,9 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define paintbrush_mask_width 16 #define paintbrush_mask_height 16 -static char paintbrush_mask_bits[] = { +static unsigned char paintbrush_mask_bits[] = { 0x00, 0x80, 0x00, 0xc0, 0x00, 0xe0, 0x00, 0xf0, 0x80, 0xfb, 0xe0, 0x7f, 0xf0, 0x3f, 0xf8, 0x1f, 0xfe, 0x3f, 0xff, 0x3f, 0xff, 0x1f, 0xfe, 0x1f, 0xfc, 0x0f, 0xf8, 0x07, 0xf0, 0x03, 0xe0, 0x01 }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotcol_curs.h b/vcl/inc/unx/x11_cursors/pivotcol_curs.h index 22873985daf0..dcd7e321fd2e 100644 --- a/vcl/inc/unx/x11_cursors/pivotcol_curs.h +++ b/vcl/inc/unx/x11_cursors/pivotcol_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define pivotcol_curs_height 32 #define pivotcol_curs_x_hot 7 #define pivotcol_curs_y_hot 5 -static char pivotcol_curs_bits[] = { +static unsigned char pivotcol_curs_bits[] = { 0xff, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x55, 0x01, 0x00, 0x00, 0x29, 0x01, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, 0x95, 0x01, 0x00, 0x00, 0xa9, 0x02, 0x00, 0x00, 0x95, 0x04, 0x00, 0x00, @@ -40,3 +41,5 @@ static char pivotcol_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotcol_mask.h b/vcl/inc/unx/x11_cursors/pivotcol_mask.h index 911eede87ed4..b5537c03ec9f 100644 --- a/vcl/inc/unx/x11_cursors/pivotcol_mask.h +++ b/vcl/inc/unx/x11_cursors/pivotcol_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define pivotcol_mask_height 32 #define pivotcol_mask_x_hot 7 #define pivotcol_mask_y_hot 5 -static char pivotcol_mask_bits[] = { +static unsigned char pivotcol_mask_bits[] = { 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, @@ -40,3 +41,5 @@ static char pivotcol_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotdel_curs.h b/vcl/inc/unx/x11_cursors/pivotdel_curs.h index e0dcbc14a6d6..18348b9e21df 100644 --- a/vcl/inc/unx/x11_cursors/pivotdel_curs.h +++ b/vcl/inc/unx/x11_cursors/pivotdel_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define pivotdel_curs_height 32 #define pivotdel_curs_x_hot 9 #define pivotdel_curs_y_hot 8 -static char pivotdel_curs_bits[] = { +static unsigned char pivotdel_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x80, 0x01, 0x00, 0x3c, 0xc0, 0x00, 0x00, 0x73, 0x6f, 0x07, 0x00, 0xe1, 0x30, 0x04, 0x00, 0xc1, 0x1d, 0x04, 0x00, 0x81, 0x0f, 0x04, 0x00, 0x01, 0x07, 0x04, 0x00, @@ -40,3 +41,5 @@ static char pivotdel_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotdel_mask.h b/vcl/inc/unx/x11_cursors/pivotdel_mask.h index 147bc2da410d..bf2e2379f194 100644 --- a/vcl/inc/unx/x11_cursors/pivotdel_mask.h +++ b/vcl/inc/unx/x11_cursors/pivotdel_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define pivotdel_mask_height 32 #define pivotdel_mask_x_hot 9 #define pivotdel_mask_y_hot 8 -static char pivotdel_mask_bits[] = { +static unsigned char pivotdel_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x80, 0x01, 0x00, 0x3c, 0xc0, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, @@ -40,3 +41,5 @@ static char pivotdel_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotfld_curs.h b/vcl/inc/unx/x11_cursors/pivotfld_curs.h index 1daf4f553275..424179cbfe16 100644 --- a/vcl/inc/unx/x11_cursors/pivotfld_curs.h +++ b/vcl/inc/unx/x11_cursors/pivotfld_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define pivotfld_curs_height 32 #define pivotfld_curs_x_hot 8 #define pivotfld_curs_y_hot 7 -static char pivotfld_curs_bits[] = { +static unsigned char pivotfld_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x01, 0x04, 0x00, 0x01, 0x03, 0x04, 0x00, @@ -40,3 +41,5 @@ static char pivotfld_curs_bits[] = { 0x00, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotfld_mask.h b/vcl/inc/unx/x11_cursors/pivotfld_mask.h index 6d62d8bbda46..e768b4b26889 100644 --- a/vcl/inc/unx/x11_cursors/pivotfld_mask.h +++ b/vcl/inc/unx/x11_cursors/pivotfld_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define pivotfld_mask_height 32 #define pivotfld_mask_x_hot 8 #define pivotfld_mask_y_hot 7 -static char pivotfld_mask_bits[] = { +static unsigned char pivotfld_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, @@ -40,3 +41,5 @@ static char pivotfld_mask_bits[] = { 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotrow_curs.h b/vcl/inc/unx/x11_cursors/pivotrow_curs.h index 75f4965f2582..1b6060ea5b8b 100644 --- a/vcl/inc/unx/x11_cursors/pivotrow_curs.h +++ b/vcl/inc/unx/x11_cursors/pivotrow_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define pivotrow_curs_height 32 #define pivotrow_curs_x_hot 8 #define pivotrow_curs_y_hot 7 -static char pivotrow_curs_bits[] = { +static unsigned char pivotrow_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0x01, 0x00, 0x04, 0x00, 0x55, 0x55, 0x07, 0x00, 0xa9, 0xaa, 0x06, 0x00, 0x55, 0x54, 0x07, 0x00, 0x29, 0xa9, 0x06, 0x00, 0x55, 0x53, 0x07, 0x00, @@ -40,3 +41,5 @@ static char pivotrow_curs_bits[] = { 0x00, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotrow_mask.h b/vcl/inc/unx/x11_cursors/pivotrow_mask.h index a8896d0975f9..f6ea09498aa0 100644 --- a/vcl/inc/unx/x11_cursors/pivotrow_mask.h +++ b/vcl/inc/unx/x11_cursors/pivotrow_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define pivotrow_mask_height 32 #define pivotrow_curs_x_hot 8 #define pivotrow_curs_y_hot 7 -static char pivotrow_mask_bits[] = { +static unsigned char pivotrow_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, @@ -40,3 +41,5 @@ static char pivotrow_mask_bits[] = { 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/rotate_curs.h b/vcl/inc/unx/x11_cursors/rotate_curs.h index f9c57674dfb2..c6550475c989 100644 --- a/vcl/inc/unx/x11_cursors/rotate_curs.h +++ b/vcl/inc/unx/x11_cursors/rotate_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define rotate_curs_height 32 #define rotate_curs_x_hot 15 #define rotate_curs_y_hot 15 -static char rotate_curs_bits[] = { +static unsigned char rotate_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xd8, 0x00, 0x00, @@ -40,3 +41,5 @@ static char rotate_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/rotate_mask.h b/vcl/inc/unx/x11_cursors/rotate_mask.h index 9fcff18925f0..12790cca4beb 100644 --- a/vcl/inc/unx/x11_cursors/rotate_mask.h +++ b/vcl/inc/unx/x11_cursors/rotate_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define rotate_mask_width 32 #define rotate_mask_height 32 -static char rotate_mask_bits[] = { +static unsigned char rotate_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0xfc, 0x01, 0x00, @@ -38,3 +39,5 @@ static char rotate_mask_bits[] = { 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblsele_curs.h b/vcl/inc/unx/x11_cursors/tblsele_curs.h index 7ad1314d1957..21bcfd1fdd9f 100644 --- a/vcl/inc/unx/x11_cursors/tblsele_curs.h +++ b/vcl/inc/unx/x11_cursors/tblsele_curs.h @@ -1,8 +1,11 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define tblsele_curs_width 16 #define tblsele_curs_height 16 #define tblsele_curs_x_hot 14 #define tblsele_curs_y_hot 8 -static char tblsele_curs_bits[] = { +static unsigned char tblsele_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x1c, 0xfc, 0x3f, 0xfc, 0x7f, 0xfc, 0x3f, 0x00, 0x1c, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblsele_mask.h b/vcl/inc/unx/x11_cursors/tblsele_mask.h index bb35c22c97cb..2a555e83d884 100644 --- a/vcl/inc/unx/x11_cursors/tblsele_mask.h +++ b/vcl/inc/unx/x11_cursors/tblsele_mask.h @@ -1,7 +1,9 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define tblsele_mask_width 16 #define tblsele_mask_height 16 -static char tblsele_mask_bits[] = { +static unsigned char tblsele_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0xfe, 0x3f, 0xfe, 0x7f, 0xfe, 0xff, 0xfe, 0x7f, 0xfe, 0x3f, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00 }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblsels_curs.h b/vcl/inc/unx/x11_cursors/tblsels_curs.h index 0bf38d4b3fdb..fb739951e9f4 100644 --- a/vcl/inc/unx/x11_cursors/tblsels_curs.h +++ b/vcl/inc/unx/x11_cursors/tblsels_curs.h @@ -1,9 +1,11 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define tblsels_curs_width 16 #define tblsels_curs_height 16 #define tblsels_curs_x_hot 7 #define tblsels_curs_y_hot 14 -static char tblsels_curs_bits[] = { +static unsigned char tblsels_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x00 }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblsels_mask.h b/vcl/inc/unx/x11_cursors/tblsels_mask.h index 9ba3b51d8d76..5a75aabe4c51 100644 --- a/vcl/inc/unx/x11_cursors/tblsels_mask.h +++ b/vcl/inc/unx/x11_cursors/tblsels_mask.h @@ -1,7 +1,9 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define tblsels_mask_width 16 #define tblsels_mask_height 16 -static char tblsels_mask_bits[] = { +static unsigned char tblsels_mask_bits[] = { 0x00, 0x00, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xfc, 0x1f, 0xfc, 0x1f, 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00 }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselse_curs.h b/vcl/inc/unx/x11_cursors/tblselse_curs.h index 208c7c59dc2d..fb34ff02b574 100644 --- a/vcl/inc/unx/x11_cursors/tblselse_curs.h +++ b/vcl/inc/unx/x11_cursors/tblselse_curs.h @@ -1,8 +1,11 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define tblselse_curs_width 16 #define tblselse_curs_height 16 #define tblselse_curs_x_hot 14 #define tblselse_curs_y_hot 14 -static char tblselse_curs_bits[] = { +static unsigned char tblselse_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xf0, 0x00, 0xf0, 0x01, 0xe0, 0x03, 0xc0, 0x47, 0x80, 0x6f, 0x00, 0x7f, 0x00, 0x7e, 0x00, 0x7c, 0x00, 0x7e, 0x00, 0x7f, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselse_mask.h b/vcl/inc/unx/x11_cursors/tblselse_mask.h index 4c4c97ad4ccf..fc289854e3ea 100644 --- a/vcl/inc/unx/x11_cursors/tblselse_mask.h +++ b/vcl/inc/unx/x11_cursors/tblselse_mask.h @@ -1,7 +1,9 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define tblselse_mask_width 16 #define tblselse_mask_height 16 -static char tblselse_mask_bits[] = { +static unsigned char tblselse_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xf0, 0x00, 0xf8, 0x01, 0xf8, 0x03, 0xf0, 0xc7, 0xe0, 0xef, 0xc0, 0xff, 0x80, 0xff, 0x00, 0xff, 0x00, 0xfe, 0x00, 0xff, 0x80, 0xff, 0x80, 0xff }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselsw_curs.h b/vcl/inc/unx/x11_cursors/tblselsw_curs.h index a3166a27ca52..a421a18b815d 100644 --- a/vcl/inc/unx/x11_cursors/tblselsw_curs.h +++ b/vcl/inc/unx/x11_cursors/tblselsw_curs.h @@ -1,8 +1,11 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define tblselsw_curs_width 16 #define tblselsw_curs_height 16 #define tblselsw_curs_x_hot 1 #define tblselsw_curs_y_hot 14 -static char tblselsw_curs_bits[] = { +static unsigned char tblselsw_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0f, 0x80, 0x0f, 0xc0, 0x07, 0xe2, 0x03, 0xf6, 0x01, 0xfe, 0x00, 0x7e, 0x00, 0x3e, 0x00, 0x7e, 0x00, 0xfe, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselsw_mask.h b/vcl/inc/unx/x11_cursors/tblselsw_mask.h index 3981cbaa884d..14b49a9863fb 100644 --- a/vcl/inc/unx/x11_cursors/tblselsw_mask.h +++ b/vcl/inc/unx/x11_cursors/tblselsw_mask.h @@ -1,7 +1,9 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define tblselsw_mask_width 16 #define tblselsw_mask_height 16 -static char tblselsw_mask_bits[] = { +static unsigned char tblselsw_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0f, 0x80, 0x1f, 0xc0, 0x1f, 0xe3, 0x0f, 0xf7, 0x07, 0xff, 0x03, 0xff, 0x01, 0xff, 0x00, 0x7f, 0x00, 0xff, 0x00, 0xff, 0x01, 0xff, 0x01 }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselw_curs.h b/vcl/inc/unx/x11_cursors/tblselw_curs.h index 9d802d094ef8..2ee9a0d4af20 100644 --- a/vcl/inc/unx/x11_cursors/tblselw_curs.h +++ b/vcl/inc/unx/x11_cursors/tblselw_curs.h @@ -1,8 +1,11 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define tblselw_curs_width 16 #define tblselw_curs_height 16 #define tblselw_curs_x_hot 1 #define tblselw_curs_y_hot 8 -static char tblselw_curs_bits[] = { +static unsigned char tblselw_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x30, 0x00, 0x38, 0x00, 0xfc, 0x3f, 0xfe, 0x3f, 0xfc, 0x3f, 0x38, 0x00, 0x30, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselw_mask.h b/vcl/inc/unx/x11_cursors/tblselw_mask.h index 940668e3db7f..8fa5be7c724a 100644 --- a/vcl/inc/unx/x11_cursors/tblselw_mask.h +++ b/vcl/inc/unx/x11_cursors/tblselw_mask.h @@ -1,6 +1,9 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define tblselw_mask_width 16 #define tblselw_mask_height 16 -static char tblselw_mask_bits[] = { +static unsigned char tblselw_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x70, 0x00, 0x78, 0x00, 0xfc, 0x7f, 0xfe, 0x7f, 0xff, 0x7f, 0xfe, 0x7f, 0xfc, 0x7f, 0x78, 0x00, 0x70, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/timemove_curs.h b/vcl/inc/unx/x11_cursors/timemove_curs.h index 252a702caf77..ce5e2b6914b5 100644 --- a/vcl/inc/unx/x11_cursors/timemove_curs.h +++ b/vcl/inc/unx/x11_cursors/timemove_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define timemove_curs_height 32 #define timemove_curs_x_hot 16 #define timemove_curs_y_hot 16 -static char timemove_curs_bits[] = { +static unsigned char timemove_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x80,0x03,0x00,0x00,0xc0,0x07,0x00,0x00, @@ -38,3 +39,5 @@ static char timemove_curs_bits[] = { 0x07,0x00,0x00,0x80,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/timemove_mask.h b/vcl/inc/unx/x11_cursors/timemove_mask.h index b7a9542a64c6..42664e6998fb 100644 --- a/vcl/inc/unx/x11_cursors/timemove_mask.h +++ b/vcl/inc/unx/x11_cursors/timemove_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define timemove_mask_height 32 #define timemove_mask_x_hot 16 #define timemove_mask_y_hot 16 -static char timemove_mask_bits[] = { +static unsigned char timemove_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x00,0x00,0x80,0x03,0x00,0x00,0xc0,0x07,0x00,0x00,0xe0,0x0f,0x00,0x00, @@ -38,3 +39,5 @@ static char timemove_mask_bits[] = { 0x0f,0x00,0x00,0xc0,0x07,0x00,0x00,0x80,0x03,0x00,0x00,0x00,0x01,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/timesize_curs.h b/vcl/inc/unx/x11_cursors/timesize_curs.h index 61e53971290e..99c75d4affb1 100644 --- a/vcl/inc/unx/x11_cursors/timesize_curs.h +++ b/vcl/inc/unx/x11_cursors/timesize_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define timesize_curs_height 32 #define timesize_curs_x_hot 16 #define timesize_curs_y_hot 16 -static char timesize_curs_bits[] = { +static unsigned char timesize_curs_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xff,0xff,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00, @@ -38,3 +39,5 @@ static char timesize_curs_bits[] = { 0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/timesize_mask.h b/vcl/inc/unx/x11_cursors/timesize_mask.h index 3c4333c5e7b8..68d03c95057f 100644 --- a/vcl/inc/unx/x11_cursors/timesize_mask.h +++ b/vcl/inc/unx/x11_cursors/timesize_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define timesize_mask_height 32 #define timesize_mask_x_hot 16 #define timesize_mask_y_hot 16 -static char timesize_mask_bits[] = { +static unsigned char timesize_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff, 0xff,0x03,0x80,0xff,0xff,0x03,0x80,0xff,0xff,0x03,0x80,0xff,0xff,0x03,0x80, @@ -38,3 +39,5 @@ static char timesize_mask_bits[] = { 0x07,0x00,0x00,0x80,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/vertcurs_curs.h b/vcl/inc/unx/x11_cursors/vertcurs_curs.h index d67251a1743d..5f8cfde93a8d 100644 --- a/vcl/inc/unx/x11_cursors/vertcurs_curs.h +++ b/vcl/inc/unx/x11_cursors/vertcurs_curs.h @@ -1,8 +1,11 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define vertcurs_curs_width 16 #define vertcurs_curs_height 16 #define vertcurs_curs_x_hot 8 #define vertcurs_curs_y_hot 8 -static char vertcurs_curs_bits[] = { +static unsigned char vertcurs_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x02, 0x40, 0x06, 0x60, 0xfc, 0x3f, 0x06, 0x60, 0x02, 0x40, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/vertcurs_mask.h b/vcl/inc/unx/x11_cursors/vertcurs_mask.h index 769d6966571f..05ac8246e52e 100644 --- a/vcl/inc/unx/x11_cursors/vertcurs_mask.h +++ b/vcl/inc/unx/x11_cursors/vertcurs_mask.h @@ -1,8 +1,11 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #define vertcurs_mask_width 16 #define vertcurs_mask_height 16 #define vertcurs_mask_x_hot 8 #define vertcurs_mask_y_hot 8 -static char vertcurs_mask_bits[] = { +static unsigned char vertcurs_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xe0, 0x07, 0xe0, 0x0f, 0xf0, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0x0f, 0xf0, 0x07, 0xe0, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/vshear_curs.h b/vcl/inc/unx/x11_cursors/vshear_curs.h index 87357c0a5027..c8f0f7dd4b8b 100644 --- a/vcl/inc/unx/x11_cursors/vshear_curs.h +++ b/vcl/inc/unx/x11_cursors/vshear_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define vshear_curs_height 32 #define vshear_curs_x_hot 15 #define vshear_curs_y_hot 15 -static char vshear_curs_bits[] = { +static unsigned char vshear_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x04, 0x00, @@ -40,3 +41,5 @@ static char vshear_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/vshear_mask.h b/vcl/inc/unx/x11_cursors/vshear_mask.h index be77728c13f9..70b777a18d2f 100644 --- a/vcl/inc/unx/x11_cursors/vshear_mask.h +++ b/vcl/inc/unx/x11_cursors/vshear_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,7 +27,7 @@ ************************************************************************/ #define vshear_mask_width 32 #define vshear_mask_height 32 -static char vshear_mask_bits[] = { +static unsigned char vshear_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x70, 0x0e, 0x00, @@ -38,3 +39,5 @@ static char vshear_mask_bits[] = { 0x00, 0x70, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/ImageListProvider.hxx b/vcl/inc/vcl/ImageListProvider.hxx index 5c0640d21ea4..7fc678b485fd 100644 --- a/vcl/inc/vcl/ImageListProvider.hxx +++ b/vcl/inc/vcl/ImageListProvider.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,3 +53,5 @@ namespace vcl } /* vcl */ #endif /* _SV_IMAGELISTPROVIDER_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/abstdlg.hxx b/vcl/inc/vcl/abstdlg.hxx index b3bdae9c7c13..012981fba7cf 100644 --- a/vcl/inc/vcl/abstdlg.hxx +++ b/vcl/inc/vcl/abstdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/accel.hxx b/vcl/inc/vcl/accel.hxx index 511737acc930..a7bf623cb20a 100644 --- a/vcl/inc/vcl/accel.hxx +++ b/vcl/inc/vcl/accel.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,7 +60,6 @@ private: sal_Bool mbIsCancel; sal_Bool* mpDel; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void ImplInit(); SAL_DLLPRIVATE void ImplCopyData( ImplAccelData& rAccelData ); SAL_DLLPRIVATE void ImplDeleteData(); @@ -67,7 +67,6 @@ private: sal_Bool bEnable, Accelerator* pAutoAccel ); SAL_DLLPRIVATE ImplAccelEntry* ImplGetAccelData( const KeyCode& rKeyCode ) const; -//#endif protected: SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); @@ -126,3 +125,5 @@ public: }; #endif // _SV_ACCEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/alpha.hxx b/vcl/inc/vcl/alpha.hxx index 9913458be0e4..c6f5dd8043fe 100644 --- a/vcl/inc/vcl/alpha.hxx +++ b/vcl/inc/vcl/alpha.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -99,6 +100,11 @@ public: BitmapWriteAccess* AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); } void ReleaseAccess( BitmapReadAccess* pAccess ); + typedef vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask, &AlphaMask::AcquireReadAccess > + ScopedReadAccess; + typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess > + ScopedWriteAccess; + public: sal_Bool Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True ) { return Bitmap::Read( rIStm, bFileHeader ); } @@ -109,3 +115,5 @@ public: }; #endif // _SV_ALPHA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/animate.hxx b/vcl/inc/vcl/animate.hxx index be3d8768661b..e53a51e0e932 100644 --- a/vcl/inc/vcl/animate.hxx +++ b/vcl/inc/vcl/animate.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -161,7 +162,6 @@ class VCL_DLLPUBLIC Animation sal_Bool mbLoopTerminated; sal_Bool mbIsWaiting; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void ImplRestartTimer( sal_uLong nTimeout ); DECL_DLLPRIVATE_LINK( ImplTimeoutHdl, Timer* ); @@ -172,7 +172,6 @@ public: SAL_DLLPRIVATE static void ImplDecAnimCount() { mnAnimCount--; } SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnPos; } -//#endif public: Animation(); @@ -252,3 +251,5 @@ public: }; #endif // _SV_ANIMATE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/apptypes.hxx b/vcl/inc/vcl/apptypes.hxx index c945209e5016..42273f6a292c 100644 --- a/vcl/inc/vcl/apptypes.hxx +++ b/vcl/inc/vcl/apptypes.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -77,3 +78,5 @@ public: #define USERACTIVE_ALL ((sal_uInt16)0xFFFF) #endif // _VCL_APPTYPES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/arrange.hxx b/vcl/inc/vcl/arrange.hxx index 327494b216e4..5568cc3b05d8 100644 --- a/vcl/inc/vcl/arrange.hxx +++ b/vcl/inc/vcl/arrange.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -457,3 +458,4 @@ namespace vcl #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx index cfcd863dfb85..e25bb482f53c 100644 --- a/vcl/inc/vcl/bitmap.hxx +++ b/vcl/inc/vcl/bitmap.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,6 +34,7 @@ #include <vcl/mapmod.hxx> #include <tools/rc.hxx> #include <vcl/region.hxx> +#include <vcl/scopedbitmapaccess.hxx> // ----------- // - Defines - @@ -144,14 +146,6 @@ enum BmpFilter // ------------------------------------------------------------------------ -enum BmpColorMode -{ - BMP_COLOR_NORMAL = 0, - BMP_COLOR_HIGHCONTRAST = 1, - BMP_COLOR_MONOCHROME_BLACK = 2, - BMP_COLOR_MONOCHROME_WHITE = 3 -}; - // -------------------- // - FilterParameters - // -------------------- @@ -237,7 +231,7 @@ class SalBitmap; struct BitmapSystemData { - #if defined( WNT ) || defined( OS2 ) + #if defined( WNT ) void* pDIB; // device independent byte buffer void* pDDB; // if not NULL then this is actually an HBITMAP #elif defined( QUARTZ ) @@ -257,7 +251,6 @@ private: MapMode maPrefMapMode; Size maPrefSize; -//#if 0 // _SOLAR__PRIVATE public: @@ -267,9 +260,9 @@ public: SAL_DLLPRIVATE void ImplSetImpBitmap( ImpBitmap* pImpBmp ); SAL_DLLPRIVATE void ImplAssignWithSize( const Bitmap& rBitmap ); - SAL_DLLPRIVATE static sal_Bool ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset ); + SAL_DLLPRIVATE static sal_Bool ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset, sal_Bool bMSOFormat = sal_False ); SAL_DLLPRIVATE static sal_Bool ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset ); - SAL_DLLPRIVATE static sal_Bool ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown ); + SAL_DLLPRIVATE static sal_Bool ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, sal_Bool bMSOFormat = sal_False ); SAL_DLLPRIVATE static sal_Bool ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, sal_Bool bQuad ); SAL_DLLPRIVATE static sal_Bool ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc, sal_Bool bTopDown ); SAL_DLLPRIVATE sal_Bool ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool bCompressed ) const; @@ -308,8 +301,6 @@ public: SAL_DLLPRIVATE sal_Bool ImplMosaic( const BmpFilterParam* pFilterParam, const Link* pProgress ); SAL_DLLPRIVATE sal_Bool ImplPopArt( const BmpFilterParam* pFilterParam, const Link* pProgress ); -//#endif // PRIVATE - public: Bitmap(); @@ -364,7 +355,7 @@ public: sal_uLong GetChecksum() const; Bitmap CreateDisplayBitmap( OutputDevice* pDisplay ); - Bitmap GetColorTransformedBitmap( BmpColorMode eColorMode ) const; + Bitmap GetColorTransformedBitmap() const; static const BitmapPalette& GetGreyPalette( int nEntries ); @@ -762,9 +753,14 @@ public: BitmapWriteAccess* AcquireWriteAccess(); void ReleaseAccess( BitmapReadAccess* pAccess ); + typedef vcl::ScopedBitmapAccess< BitmapReadAccess, Bitmap, &Bitmap::AcquireReadAccess > + ScopedReadAccess; + typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, Bitmap, &Bitmap::AcquireWriteAccess > + ScopedWriteAccess; + public: - sal_Bool Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True ); + sal_Bool Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True, sal_Bool bMSOFormat = sal_False ); sal_Bool Write( SvStream& rOStm, sal_Bool bCompressed = sal_True, sal_Bool bFileHeader = sal_True ) const; friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Bitmap& rBitmap ); @@ -852,3 +848,5 @@ inline sal_uLong Bitmap::GetSizeBytes() const } #endif // _SV_BITMAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/bitmapex.hxx b/vcl/inc/vcl/bitmapex.hxx index b977adae5c95..9a6259fa61eb 100644 --- a/vcl/inc/vcl/bitmapex.hxx +++ b/vcl/inc/vcl/bitmapex.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,13 +64,10 @@ private: public: -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE ImpBitmap* ImplGetBitmapImpBitmap() const { return aBitmap.ImplGetImpBitmap(); } SAL_DLLPRIVATE ImpBitmap* ImplGetMaskImpBitmap() const { return aMask.ImplGetImpBitmap(); } -//#endif // PRIVATE - public: BitmapEx(); @@ -107,7 +105,7 @@ public: Bitmap GetBitmap( const Color* pTransReplaceColor = NULL ) const; Bitmap GetMask() const; - BitmapEx GetColorTransformedBitmapEx( BmpColorMode eColorMode ) const; + BitmapEx GetColorTransformedBitmapEx() const; sal_Bool IsAlpha() const; AlphaMask GetAlpha() const; @@ -395,6 +393,9 @@ public: friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ); friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx ); + static BitmapEx AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize); }; #endif // _SV_BITMAPEX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/bmpacc.hxx b/vcl/inc/vcl/bmpacc.hxx index def83d9910b7..d98ff2cfe8dc 100644 --- a/vcl/inc/vcl/bmpacc.hxx +++ b/vcl/inc/vcl/bmpacc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,8 +34,6 @@ #include <vcl/salbtype.hxx> #include <vcl/bitmap.hxx> -//#if 0 // _SOLAR__PRIVATE - // -------------------- // - Access defines - // -------------------- @@ -69,7 +68,6 @@ case( BMP_FORMAT##Format ): \ } \ break; -//#endif // __PRIVATE // -------------------- // - Access functions - @@ -101,7 +99,6 @@ protected: FncSetPixel mFncSetPixel; sal_Bool mbModify; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void ImplCreate( Bitmap& rBitmap ); SAL_DLLPRIVATE void ImplDestroy(); @@ -128,8 +125,6 @@ SAL_DLLPRIVATE BitmapBuffer* ImplGetBitmapBuffer() const { return mpBuffer; } DECL_FORMAT( _32BIT_TC_BGRA ) DECL_FORMAT( _32BIT_TC_RGBA ) DECL_FORMAT( _32BIT_TC_MASK ) -//#endif // __PRIVATE - protected: BitmapReadAccess( Bitmap& rBitmap, sal_Bool bModify ); @@ -230,72 +225,6 @@ private: BitmapWriteAccess& operator=( const BitmapWriteAccess& ) { return *this; } }; -// ------------------- -// - Accessor Helper - -// ------------------- - -/** This template handles BitmapAccess the RAII way. - - Please don't use directly, but the ready-made typedefs for - BitmapReadAccess and BitmapWriteAccess below. - */ -template < class Access > class ScopedBitmapAccess -{ -public: - ScopedBitmapAccess( Access* pAccess, - Bitmap& rBitmap ) : - mpAccess( pAccess ), - mrBitmap( rBitmap ) - { - } - - ~ScopedBitmapAccess() - { - mrBitmap.ReleaseAccess( mpAccess ); - } - - Access* get() { return mpAccess; } - const Access* get() const { return mpAccess; } - - Access* operator->() { return mpAccess; } - const Access* operator->() const { return mpAccess; } - - Access& operator*() { return *mpAccess; } - const Access& operator*() const { return *mpAccess; } - -private: - Access* mpAccess; - Bitmap& mrBitmap; -}; - -/** This wrapper handles BitmapReadAccess the RAII way. - - Use as follows: - Bitmap aBitmap - ScopedBitmapReadAccess pReadAccess( aBitmap.AcquireReadAccess(), aBitmap ); - pReadAccess->SetPixel()... - - @attention for practical reasons, ScopedBitmapReadAccess stores a - reference to the provided bitmap, thus, make sure that the bitmap - specified at construction time lives at least as long as the - ScopedBitmapReadAccess. -*/ -typedef ScopedBitmapAccess< BitmapReadAccess > ScopedBitmapReadAccess; - -/** This wrapper handles BitmapWriteAccess the RAII way. - - Use as follows: - Bitmap aBitmap - ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(), aBitmap ); - pWriteAccess->SetPixel()... - - @attention for practical reasons, ScopedBitmapWriteAccess stores a - reference to the provided bitmap, thus, make sure that the bitmap - specified at construction time lives at least as long as the - ScopedBitmapWriteAccess. -*/ -typedef ScopedBitmapAccess< BitmapWriteAccess > ScopedBitmapWriteAccess; - // ----------- // - Inlines - // ----------- @@ -543,3 +472,5 @@ inline void BitmapWriteAccess::SetPixel( long nY, long nX, const BitmapColor& rB } #endif // _SV_BMPACC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/btndlg.hxx b/vcl/inc/vcl/btndlg.hxx index bbe7ae0a515f..ec537f517374 100644 --- a/vcl/inc/vcl/btndlg.hxx +++ b/vcl/inc/vcl/btndlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,13 @@ #ifndef _SV_BTNDLG_HXX #define _SV_BTNDLG_HXX +#include <boost/ptr_container/ptr_vector.hpp> + #include <vcl/sv.h> #include <vcl/dllapi.h> #include <vcl/dialog.hxx> struct ImplBtnDlgItem; -class ImplBtnDlgItemList; class PushButton; // ---------------------- @@ -55,7 +57,7 @@ class PushButton; class VCL_DLLPUBLIC ButtonDialog : public Dialog { private: - ImplBtnDlgItemList* mpItemList; + boost::ptr_vector<ImplBtnDlgItem> maItemList; Size maPageSize; Size maCtrlSize; long mnButtonSize; @@ -115,3 +117,5 @@ public: }; #endif // _SV_BTNDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index f6b030bd4f16..9205f9df7661 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -85,14 +86,14 @@ public: static XubString GetStandardText( StandardButtonType eButton ); static XubString GetStandardHelpText( StandardButtonType eButton ); - sal_Bool SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL ); - const Image GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; - sal_Bool HasImage() const; + sal_Bool SetModeImage( const Image& rImage ); + const Image GetModeImage( ) const; + sal_Bool HasImage() const; void SetImageAlign( ImageAlign eAlign ); ImageAlign GetImageAlign() const; - sal_Bool SetModeBitmap( const BitmapEx& rBitmap, BmpColorMode eMode = BMP_COLOR_NORMAL ); - BitmapEx GetModeBitmap( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + sal_Bool SetModeBitmap( const BitmapEx& rBitmap ); + BitmapEx GetModeBitmap( ) const; void EnableImageDisplay( sal_Bool bEnable ); sal_Bool IsImageDisplayEnabled(); @@ -296,7 +297,6 @@ private: Rectangle maStateRect; Rectangle maMouseRect; Image maImage; - Image maImageHC; sal_Bool mbChecked; sal_Bool mbSaveValue; sal_Bool mbRadioCheck; @@ -372,8 +372,8 @@ public: void EnableRadioCheck( sal_Bool bRadioCheck = sal_True ) { mbRadioCheck = bRadioCheck; } sal_Bool IsRadioCheckEnabled() const { return mbRadioCheck; } - sal_Bool SetModeRadioImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL ); - const Image& GetModeRadioImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + sal_Bool SetModeRadioImage( const Image& rImage ); + const Image& GetModeRadioImage( ) const; void SetState( sal_Bool bCheck ); void Check( sal_Bool bCheck = sal_True ); @@ -563,3 +563,5 @@ public: }; #endif // _SV_BUTTON_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/canvastools.hxx b/vcl/inc/vcl/canvastools.hxx index c6f1710cdae5..e82d397a92f0 100644 --- a/vcl/inc/vcl/canvastools.hxx +++ b/vcl/inc/vcl/canvastools.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -251,3 +252,5 @@ namespace vcl } #endif /* _VCL_CANVASTOOLS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/cmdevt.h b/vcl/inc/vcl/cmdevt.h index 4594da8b7d56..0ecf03ca22bb 100644 --- a/vcl/inc/vcl/cmdevt.h +++ b/vcl/inc/vcl/cmdevt.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,3 +62,4 @@ #endif // _VCL_CMDEVT_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/cmdevt.hxx b/vcl/inc/vcl/cmdevt.hxx index 30a6c0b953bf..c71160b3fce1 100644 --- a/vcl/inc/vcl/cmdevt.hxx +++ b/vcl/inc/vcl/cmdevt.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -157,7 +158,7 @@ public: sal_uInt16 GetModifier() const { return (mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); } - sal_Bool IsShift() const + bool IsShift() const { return ((mnCode & KEY_SHIFT) != 0); } sal_Bool IsMod1() const { return ((mnCode & KEY_MOD1) != 0); } @@ -278,7 +279,7 @@ public: CommandModKeyData(); CommandModKeyData( sal_uInt16 nCode ); - sal_Bool IsShift() const { return (mnCode & MODKEY_SHIFT) ? sal_True : sal_False; } + bool IsShift() const { return (mnCode & MODKEY_SHIFT) ? true : false; } sal_Bool IsMod1() const { return (mnCode & MODKEY_MOD1) ? sal_True : sal_False; } sal_Bool IsMod2() const { return (mnCode & MODKEY_MOD2) ? sal_True : sal_False; } sal_Bool IsMod3() const { return (mnCode & MODKEY_MOD3) ? sal_True : sal_False; } @@ -524,3 +525,5 @@ inline const CommandSelectionChangeData* CommandEvent::GetSelectionChangeData() #endif // _VCL_CMDEVT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/combobox.h b/vcl/inc/vcl/combobox.h index def55435ad1f..387c20d544be 100644 --- a/vcl/inc/vcl/combobox.h +++ b/vcl/inc/vcl/combobox.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,3 +36,5 @@ #define COMBOBOX_USERDRAW_SELECTED ((sal_uInt16)0x0001) #endif // _SV_COMBOBOX_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/combobox.hxx b/vcl/inc/vcl/combobox.hxx index e7ab69e75700..12385c9bd9e2 100644 --- a/vcl/inc/vcl/combobox.hxx +++ b/vcl/inc/vcl/combobox.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,7 +59,6 @@ private: Link maSelectHdl; Link maDoubleClickHdl; -//#if 0 // _SOLAR__PRIVATE private: SAL_DLLPRIVATE void ImplInitComboBoxData(); SAL_DLLPRIVATE void ImplUpdateFloatSelection(); @@ -78,7 +78,6 @@ protected: SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); SAL_DLLPRIVATE void ImplCalcEditHeight(); -//#endif protected: ComboBox( WindowType nType ); @@ -228,3 +227,5 @@ public: }; #endif // _COMBOBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/configsettings.hxx b/vcl/inc/vcl/configsettings.hxx index 779c6450e804..e9b85d30728e 100644 --- a/vcl/inc/vcl/configsettings.hxx +++ b/vcl/inc/vcl/configsettings.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,14 +33,14 @@ #include <unotools/configitem.hxx> #include <vcl/dllapi.h> -#include <hash_map> +#include <boost/unordered_map.hpp> //........................................................................ namespace vcl { //........................................................................ - typedef std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash > OUStrMap; + typedef boost::unordered_map< rtl::OUString, rtl::OUString, rtl::OUStringHash > OUStrMap; class SmallOUStrMap : public OUStrMap { public: SmallOUStrMap() : OUStrMap(1) {} }; //==================================================================== @@ -48,7 +49,7 @@ namespace vcl class VCL_DLLPUBLIC SettingsConfigItem : public ::utl::ConfigItem { - std::hash_map< rtl::OUString, SmallOUStrMap, rtl::OUStringHash > m_aSettings; + boost::unordered_map< rtl::OUString, SmallOUStrMap, rtl::OUStringHash > m_aSettings; virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames ); @@ -71,3 +72,4 @@ namespace vcl #endif // VCL_INC_CONFIGSETTINGS_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/controllayout.hxx b/vcl/inc/vcl/controllayout.hxx index 574d80ea9e02..0cad923c6b33 100644 --- a/vcl/inc/vcl/controllayout.hxx +++ b/vcl/inc/vcl/controllayout.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -83,3 +84,5 @@ struct VCL_DLLPUBLIC ControlLayoutData } // namespace vcl #endif // _VCL_CONTROLLAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/ctrl.hxx b/vcl/inc/vcl/ctrl.hxx index 3bf529ada48b..71d7d88d6003 100644 --- a/vcl/inc/vcl/ctrl.hxx +++ b/vcl/inc/vcl/ctrl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -109,7 +110,6 @@ protected: void ImplInitSettings( const sal_Bool _bFont, const sal_Bool _bForeground ); -//#if 0 // _SOLAR__PRIVATE public: SAL_DLLPRIVATE void ImplClearLayoutData() const; /** draws a frame around the give rectangle, onto the given device @@ -131,7 +131,6 @@ public: by the space occupied by the drawn pixels. */ SAL_DLLPRIVATE void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect ); -//#endif public: Control( Window* pParent, WinBits nWinStyle = 0 ); @@ -199,3 +198,5 @@ public: }; #endif // _SV_CTRL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/cursor.hxx b/vcl/inc/vcl/cursor.hxx index 11f00145c466..7fd95454945e 100644 --- a/vcl/inc/vcl/cursor.hxx +++ b/vcl/inc/vcl/cursor.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,15 +62,17 @@ private: Point maPos; // Position short mnOrientation; // Rotation sal_uInt16 mnStyle; // Style - sal_Bool mbVisible; // Ist Cursor sichtbar + bool mbVisible; // Ist Cursor sichtbar unsigned char mnDirection; // indicates direction public: SAL_DLLPRIVATE void ImplDraw(); SAL_DLLPRIVATE void ImplRestore(); DECL_DLLPRIVATE_LINK( ImplTimerHdl, AutoTimer* ); - SAL_DLLPRIVATE void ImplShow( bool bDrawDirect = true, bool bRestore = false ); - SAL_DLLPRIVATE bool ImplHide( bool bStopTimer ); + SAL_DLLPRIVATE void ImplShow( bool bDrawDirect = true ); + SAL_DLLPRIVATE void ImplHide(); + SAL_DLLPRIVATE void ImplResume( bool bRestore = false ); + SAL_DLLPRIVATE bool ImplSuspend(); SAL_DLLPRIVATE void ImplNew(); public: @@ -82,7 +85,7 @@ public: void Show(); void Hide(); - sal_Bool IsVisible() const { return mbVisible; } + bool IsVisible() const { return mbVisible; } void SetWindow( Window* pWindow ); Window* GetWindow() const { return mpWindow; } @@ -109,9 +112,15 @@ public: unsigned char GetDirection() const { return mnDirection; } Cursor& operator=( const Cursor& rCursor ); - sal_Bool operator==( const Cursor& rCursor ) const; - sal_Bool operator!=( const Cursor& rCursor ) const + bool operator==( const Cursor& rCursor ) const; + bool operator!=( const Cursor& rCursor ) const { return !(Cursor::operator==( rCursor )); } + +private: + void ImplDoShow( bool bDrawDirect, bool bRestore ); + bool ImplDoHide( bool bStop ); }; #endif // _SV_CURSOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/cvtgrf.hxx b/vcl/inc/vcl/cvtgrf.hxx index a84e98524276..50d766f5565c 100644 --- a/vcl/inc/vcl/cvtgrf.hxx +++ b/vcl/inc/vcl/cvtgrf.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,11 +47,9 @@ private: Link maFilterHdl; ConvertData* mpConvertData; -//#if 0 // _SOLAR__PRIVATE public: SAL_DLLPRIVATE sal_uLong ImplConvert( sal_uLong nInFormat, void* pInBuffer, sal_uLong nInBufSize, void** ppOutBuffer, sal_uLong nOutFormat ); -//#endif // __PRIVATE public: @@ -68,3 +67,4 @@ public: #endif // _SV_CVTGRF_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/cvtsvm.hxx b/vcl/inc/vcl/cvtsvm.hxx index ad4e38816830..de4158e08efc 100644 --- a/vcl/inc/vcl/cvtsvm.hxx +++ b/vcl/inc/vcl/cvtsvm.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -95,14 +96,12 @@ class Stack; class VCL_PLUGIN_PUBLIC SVMConverter { private: -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ); SAL_DLLPRIVATE void ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf ); SAL_DLLPRIVATE sal_uLong ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, VirtualDevice& rSaveVDev, sal_Bool& rRop_0_1, Color& rLineCol, Stack& rLineColStack, rtl_TextEncoding& rActualCharSet ); -//#endif public: SVMConverter( SvStream& rIStm, GDIMetaFile& rMtf, sal_uLong nConvertMode ); @@ -115,3 +114,5 @@ private: }; #endif // _SV_CVTMTF_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/decoview.hxx b/vcl/inc/vcl/decoview.hxx index 36c9882c0e36..63434bea2830 100644 --- a/vcl/inc/vcl/decoview.hxx +++ b/vcl/inc/vcl/decoview.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -108,3 +109,5 @@ public: }; #endif // _SV_DECOVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx index 3bce9c0497ac..7b8c3ac032f2 100644 --- a/vcl/inc/vcl/dialog.hxx +++ b/vcl/inc/vcl/dialog.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,11 +54,11 @@ private: sal_Bool mbOldSaveBack; sal_Bool mbInClose; sal_Bool mbModalMode; + sal_Int8 mnCancelClose; //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event SAL_DLLPRIVATE void ImplInitDialogData(); SAL_DLLPRIVATE void ImplInitSettings(); -//#if 0 // _SOLAR__PRIVATE // Copy assignment is forbidden and not implemented. SAL_DLLPRIVATE Dialog (const Dialog &); SAL_DLLPRIVATE Dialog & operator= (const Dialog &); @@ -71,7 +72,6 @@ protected: public: SAL_DLLPRIVATE sal_Bool IsInClose() const { return mbInClose; } -//#endif protected: Dialog( WindowType nType ); @@ -91,6 +91,9 @@ public: virtual short Execute(); sal_Bool IsInExecute() const { return mbInExecute; } + sal_Int8 GetCloseFlag() const { return mnCancelClose; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event + void SetCloseFlag( sal_Int8 nCancel ) { mnCancelClose = nCancel; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event + //////////////////////////////////////// // Dialog::Execute replacement API public: @@ -125,11 +128,9 @@ public: class VCL_DLLPUBLIC ModelessDialog : public Dialog { -//#if 0 // _SOLAR__PRIVATE // Copy assignment is forbidden and not implemented. SAL_DLLPRIVATE ModelessDialog (const ModelessDialog &); SAL_DLLPRIVATE ModelessDialog & operator= (const ModelessDialog &); -//#endif public: ModelessDialog( Window* pParent, WinBits nStyle = WB_STDMODELESS ); @@ -152,11 +153,11 @@ private: using Window::Hide; void Hide(); -//#if 0 // _SOLAR__PRIVATE // Copy assignment is forbidden and not implemented. SAL_DLLPRIVATE ModalDialog (const ModalDialog &); SAL_DLLPRIVATE ModalDialog & operator= (const ModalDialog &); -//#endif }; #endif // _SV_DIALOG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/dllapi.h b/vcl/inc/vcl/dllapi.h index 2c5c2c6801ac..3ec80dd0ec7d 100644 --- a/vcl/inc/vcl/dllapi.h +++ b/vcl/inc/vcl/dllapi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,3 +45,5 @@ #endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/dndhelp.hxx b/vcl/inc/vcl/dndhelp.hxx index 3929bc1ebafc..73adc8a4508a 100644 --- a/vcl/inc/vcl/dndhelp.hxx +++ b/vcl/inc/vcl/dndhelp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -124,3 +125,4 @@ public: #endif // _VCL_DNDHELP_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/dockingarea.hxx b/vcl/inc/vcl/dockingarea.hxx index dc7effa54c4e..7ba82d380f58 100644 --- a/vcl/inc/vcl/dockingarea.hxx +++ b/vcl/inc/vcl/dockingarea.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,3 +64,5 @@ public: }; #endif // _SV_SYSWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/dockwin.hxx b/vcl/inc/vcl/dockwin.hxx index 5fb9ab4d4c6d..5721d979b188 100644 --- a/vcl/inc/vcl/dockwin.hxx +++ b/vcl/inc/vcl/dockwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -287,7 +288,6 @@ private: mbDockBtn:1, mbHideBtn:1; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void ImplInitDockingWindowData(); // Copy assignment is forbidden and not implemented. @@ -302,7 +302,6 @@ protected: public: SAL_DLLPRIVATE sal_Bool ImplStartDocking( const Point& rPos ); -//#endif protected: DockingWindow( WindowType nType ); @@ -450,3 +449,5 @@ inline void DockingWindow::SetFloatingPos( const Point& rNewPos ) #endif // _SV_DOCKWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx index f9063356b187..0263daa5a427 100755..100644 --- a/vcl/inc/vcl/edit.hxx +++ b/vcl/inc/vcl/edit.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -262,3 +263,5 @@ inline sal_uLong Edit::IsUpdateDataEnabled() const } #endif // _SV_EDIT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/event.hxx b/vcl/inc/vcl/event.hxx index 33d43ddf2053..9e8666ea7c78 100644 --- a/vcl/inc/vcl/event.hxx +++ b/vcl/inc/vcl/event.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -167,7 +168,7 @@ public: sal_uInt16 GetModifier() const { return (mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); } - sal_Bool IsShift() const + bool IsShift() const { return ((mnCode & KEY_SHIFT) != 0); } sal_Bool IsMod1() const { return ((mnCode & KEY_MOD1) != 0); } @@ -477,3 +478,4 @@ inline const AllSettings* DataChangedEvent::GetOldSettings() const #endif // _SV_EVENT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/evntpost.hxx b/vcl/inc/vcl/evntpost.hxx index 287328d274a4..90a165506c65 100644 --- a/vcl/inc/vcl/evntpost.hxx +++ b/vcl/inc/vcl/evntpost.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,9 +46,7 @@ namespace vcl sal_uLong m_nId; Link m_aLink; -//#if 0 // _SOLAR__PRIVATE DECL_DLLPRIVATE_LINK( DoEvent_Impl, UserEvent* ); -//#endif public: EventPoster( const Link& rLink ); @@ -57,3 +56,5 @@ namespace vcl } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/extoutdevdata.hxx b/vcl/inc/vcl/extoutdevdata.hxx index cfe7b74533d8..28f9a05c5b9f 100644 --- a/vcl/inc/vcl/extoutdevdata.hxx +++ b/vcl/inc/vcl/extoutdevdata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,3 +46,5 @@ public: } #endif // _VCL_PDFWRITER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/field.hxx b/vcl/inc/vcl/field.hxx index 715725898180..fd0ce90cb0d7 100644 --- a/vcl/inc/vcl/field.hxx +++ b/vcl/inc/vcl/field.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -255,7 +256,7 @@ public: virtual void CustomConvert() = 0; virtual void Reformat(); - void SetUnit( FieldUnit meUnit ); + virtual void SetUnit( FieldUnit meUnit ); FieldUnit GetUnit() const { return meUnit; } void SetCustomUnitText( const XubString& rStr ); const XubString& GetCustomUnitText() const { return maCustomUnitText; } @@ -569,6 +570,8 @@ public: virtual void Last(); virtual void CustomConvert(); + virtual void SetUnit( FieldUnit meUnit ); + void SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit ); inline void SetFirst(sal_Int64 first) { SetFirst(first, FUNIT_NONE); } sal_Int64 GetFirst( FieldUnit eOutUnit ) const; @@ -882,3 +885,5 @@ public: }; #endif // _SV_FIELD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/fixbrd.hxx b/vcl/inc/vcl/fixbrd.hxx index dec13b4e2874..e091f68d4fad 100644 --- a/vcl/inc/vcl/fixbrd.hxx +++ b/vcl/inc/vcl/fixbrd.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,3 +81,5 @@ public: }; #endif // _SV_FIXBRD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx index 0aaa12e39394..3912f19e778a 100644 --- a/vcl/inc/vcl/fixed.hxx +++ b/vcl/inc/vcl/fixed.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,7 +43,6 @@ class UserDrawEvent; class VCL_DLLPUBLIC FixedText : public Control { -//#if 0 // _SOLAR__PRIVATE private: using Control::ImplInitSettings; using Window::ImplInit; @@ -53,7 +53,6 @@ private: const Point& rPos, const Size& rSize, bool bFillLayout = false ) const; public: SAL_DLLPRIVATE static sal_uInt16 ImplGetTextStyle( WinBits nWinBits ); -//#endif protected: virtual void FillLayoutData() const; virtual const Font& @@ -119,7 +118,6 @@ class VCL_DLLPUBLIC FixedBitmap : public Control { private: Bitmap maBitmap; - Bitmap maBitmapHC; using Control::ImplInitSettings; using Window::ImplInit; @@ -146,8 +144,8 @@ public: void SetBitmap( const Bitmap& rBitmap ); using OutputDevice::GetBitmap; const Bitmap& GetBitmap() const { return maBitmap; } - sal_Bool SetModeBitmap( const Bitmap& rBitmap, BmpColorMode eMode = BMP_COLOR_NORMAL ); - const Bitmap& GetModeBitmap( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + sal_Bool SetModeBitmap( const Bitmap& rBitmap ); + const Bitmap& GetModeBitmap( ) const; }; // -------------- @@ -158,7 +156,6 @@ class VCL_DLLPUBLIC FixedImage : public Control { private: Image maImage; - Image maImageHC; sal_Bool mbInUserDraw; private: @@ -189,11 +186,13 @@ public: void SetImage( const Image& rImage ); const Image& GetImage() const { return maImage; } - sal_Bool SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL ); - const Image& GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + sal_Bool SetModeImage( const Image& rImage ); + const Image& GetModeImage( ) const; Point CalcImagePos( const Point& rPos, const Size& rObjSize, const Size& rWinSize ); }; #endif // _SV_FIXED_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/floatwin.hxx b/vcl/inc/vcl/floatwin.hxx index cdb1531ee89a..e6a5b58eea32 100644 --- a/vcl/inc/vcl/floatwin.hxx +++ b/vcl/inc/vcl/floatwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,7 +66,8 @@ class PopupModeEvent; #define FLOATWIN_TITLE_NORMAL ((sal_uInt16)0x0001) #define FLOATWIN_TITLE_TEAROFF ((sal_uInt16)0x0002) -#define FLOATWIN_TITLE_NONE ((sal_uInt16)0x0004) +#define FLOATWIN_TITLE_POPUP ((sal_uInt16)0x0004) +#define FLOATWIN_TITLE_NONE ((sal_uInt16)0x0008) // ------------------ // - FloatingWindow - @@ -93,7 +95,6 @@ private: sal_Bool mbInCleanUp; Link maPopupModeEndHdl; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void ImplCallPopupModeEnd(); DECL_DLLPRIVATE_LINK( ImplEndPopupModeHdl, void* ); @@ -122,7 +123,6 @@ public: SAL_DLLPRIVATE void ImplEndPopupMode( sal_uInt16 nFlags = 0, sal_uLong nFocusId = 0 ); SAL_DLLPRIVATE Rectangle& ImplGetItemEdgeClipRect(); SAL_DLLPRIVATE sal_Bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; } -//#endif public: FloatingWindow( Window* pParent, WinBits nStyle = WB_STDFLOATWIN ); @@ -159,3 +159,5 @@ public: }; #endif // _SV_FLOATWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/fntstyle.hxx b/vcl/inc/vcl/fntstyle.hxx index 6b9c4c29275f..82c8c8ad5932 100644 --- a/vcl/inc/vcl/fntstyle.hxx +++ b/vcl/inc/vcl/fntstyle.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,3 +52,5 @@ typedef sal_uInt8 FontKerning; #define KERNING_ASIAN ((FontKerning)0x02) #endif // _VCL_FNTSTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/font.hxx b/vcl/inc/vcl/font.hxx index 7a5152a04a1d..8ca4ba5bbb87 100644 --- a/vcl/inc/vcl/font.hxx +++ b/vcl/inc/vcl/font.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -138,3 +139,5 @@ public: }; #endif // _VCL_FONT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/fontcapabilities.hxx b/vcl/inc/vcl/fontcapabilities.hxx new file mode 100644 index 000000000000..09eddf4e3a5b --- /dev/null +++ b/vcl/inc/vcl/fontcapabilities.hxx @@ -0,0 +1,221 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#ifndef _VCLFONTCAPABILITIES_HXX +#define _VCLFONTCAPABILITIES_HXX + +#include <boost/dynamic_bitset.hpp> +#include <vector> + +namespace vcl +{ + struct UnicodeCoverage + { + enum + { + BASIC_LATIN = 0, + LATIN_1_SUPPLEMENT = 1, + LATIN_EXTENDED_A = 2, + LATIN_EXTENDED_B = 3, + IPA_EXTENSIONS = 4, + SPACING_MODIFIER_LETTERS = 5, + COMBINING_DIACRITICAL_MARKS = 6, + GREEK_AND_COPTIC = 7, + COPTIC = 8, + CYRILLIC = 9, + ARMENIAN = 10, + HEBREW = 11, + VAI = 12, + ARABIC = 13, + NKO = 14, + DEVANAGARI = 15, + BENGALI = 16, + GURMUKHI = 17, + GUJARATI = 18, + ORIYA = 19, + TAMIL = 20, + TELUGU = 21, + KANNADA = 22, + MALAYALAM = 23, + THAI = 24, + LAO = 25, + GEORGIAN = 26, + BALINESE = 27, + HANGUL_JAMO = 28, + LATIN_EXTENDED_ADDITIONAL = 29, + GREEK_EXTENDED = 30, + GENERAL_PUNCTUATION = 31, + SUPERSCRIPTS_AND_SUBSCRIPTS = 32, + CURRENCY_SYMBOLS = 33, + COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS = 34, + LETTERLIKE_SYMBOLS = 35, + NUMBER_FORMS = 36, + ARROWS = 37, + MATHEMATICAL_OPERATORS = 38, + MISCELLANEOUS_TECHNICAL = 39, + CONTROL_PICTURES = 40, + OPTICAL_CHARACTER_RECOGNITION = 41, + ENCLOSED_ALPHANUMERICS = 42, + BOX_DRAWING = 43, + BLOCK_ELEMENTS = 44, + GEOMETRIC_SHAPES = 45, + MISCELLANEOUS_SYMBOLS = 46, + DINGBATS = 47, + CJK_SYMBOLS_AND_PUNCTUATION = 48, + HIRAGANA = 49, + KATAKANA = 50, + BOPOMOFO = 51, + HANGUL_COMPATIBILITY_JAMO = 52, + PHAGS_PA = 53, + ENCLOSED_CJK_LETTERS_AND_MONTHS = 54, + CJK_COMPATIBILITY = 55, + HANGUL_SYLLABLES = 56, + NONPLANE_0 = 57, + PHOENICIAN = 58, + CJK_UNIFIED_IDEOGRAPHS = 59, + PRIVATE_USE_AREA_PLANE_0 = 60, + CJK_STROKES = 61, + ALPHABETIC_PRESENTATION_FORMS = 62, + ARABIC_PRESENTATION_FORMS_A = 63, + COMBINING_HALF_MARKS = 64, + VERTICAL_FORMS = 65, + SMALL_FORM_VARIANTS = 66, + ARABIC_PRESENTATION_FORMS_B = 67, + HALFWIDTH_AND_FULLWIDTH_FORMS = 68, + SPECIALS = 69, + TIBETAN = 70, + SYRIAC = 71, + THAANA = 72, + SINHALA = 73, + MYANMAR = 74, + ETHIOPIC = 75, + CHEROKEE = 76, + UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS = 77, + OGHAM = 78, + RUNIC = 79, + KHMER = 80, + MONGOLIAN = 81, + BRAILLE_PATTERNS = 82, + YI_SYLLABLES = 83, + TAGALOG = 84, + OLD_ITALIC = 85, + GOTHIC = 86, + DESERET = 87, + BYZANTINE_MUSICAL_SYMBOLS = 88, + MATHEMATICAL_ALPHANUMERIC_SYMBOLS = 89, + PRIVATE_USE_PLANE_15 = 90, + VARIATION_SELECTORS = 91, + TAGS = 92, + LIMBU = 93, + TAI_LE = 94, + NEW_TAI_LUE = 95, + BUGINESE = 96, + GLAGOLITIC = 97, + TIFINAGH = 98, + YIJING_HEXAGRAM_SYMBOLS = 99, + SYLOTI_NAGRI = 100, + LINEAR_B_SYLLABARY = 101, + ANCIENT_GREEK_NUMBERS = 102, + UGARITIC = 103, + OLD_PERSIAN = 104, + SHAVIAN = 105, + OSMANYA = 106, + CYPRIOT_SYLLABARY = 107, + KHAROSHTHI = 108, + TAI_XUAN_JING_SYMBOLS = 109, + CUNEIFORM = 110, + COUNTING_ROD_NUMERALS = 111, + SUNDANESE = 112, + LEPCHA = 113, + OL_CHIKI = 114, + SAURASHTRA = 115, + KAYAH_LI = 116, + REJANG = 117, + CHAM = 118, + ANCIENT_SYMBOLS = 119, + PHAISTOS_DISC = 120, + CARIAN = 121, + DOMINO_TILES = 122, + RESERVED1 = 123, + RESERVED2 = 124, + RESERVED3 = 125, + RESERVED4 = 126, + RESERVED5 = 127, + MAX_UC_ENUM = 128 + }; + }; + + struct CodePageCoverage + { + enum + { + CP1252 = 0, + CP1250 = 1, + CP1251 = 2, + CP1253 = 3, + CP1254 = 4, + CP1255 = 5, + CP1256 = 6, + CP1257 = 7, + CP1258 = 8, + CP874 = 16, + CP932 = 17, + CP936 = 18, + CP949 = 19, + CP950 = 20, + CP1361 = 21, + CP869 = 48, + CP866 = 49, + CP865 = 50, + CP864 = 51, + CP863 = 52, + CP862 = 53, + CP861 = 54, + CP860 = 55, + CP857 = 56, + CP855 = 57, + CP852 = 58, + CP775 = 59, + CP737 = 60, + CP780 = 61, + CP850 = 62, + CP437 = 63, + MAX_CP_ENUM = 64 + }; + }; + + struct FontCapabilities + { + boost::dynamic_bitset<sal_uInt32> maUnicodeRange; + boost::dynamic_bitset<sal_uInt32> maCodePageRange; + std::vector< sal_uInt32 > maGSUBScriptTags; + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx index f97f21a8f72d..145c4d0a2169 100644 --- a/vcl/inc/vcl/fontmanager.hxx +++ b/vcl/inc/vcl/fontmanager.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,16 +29,18 @@ #ifndef _PSPRINT_FONTMANAGER_HXX_ #define _PSPRINT_FONTMANAGER_HXX_ -#include <hash_map> +#include <boost/unordered_map.hpp> #include <map> #include <list> #include <set> #include "vcl/dllapi.h" #include "vcl/helper.hxx" - +#include "vcl/vclenum.hxx" #include "com/sun/star/lang/Locale.hpp" +#include <vector> + #define ATOM_FAMILYNAME 2 #define ATOM_PSNAME 3 @@ -54,71 +57,6 @@ class ImplFontOptions; namespace psp { class PPDParser; // see ppdparser.hxx -namespace italic -{ -enum type { - Upright = 0, - Oblique = 1, - Italic = 2, - Unknown = 3 -}; -} - -namespace width -{ -enum type { - Unknown = 0, - UltraCondensed = 1, - ExtraCondensed = 2, - Condensed = 3, - SemiCondensed = 4, - Normal = 5, - SemiExpanded = 6, - Expanded = 7, - ExtraExpanded = 8, - UltraExpanded = 9 -}; -} - -namespace pitch -{ -enum type { - Unknown = 0, - Fixed = 1, - Variable = 2 -}; -} - -namespace weight -{ -enum type { - Unknown = 0, - Thin = 1, - UltraLight = 2, - Light = 3, - SemiLight = 4, - Normal = 5, - Medium = 6, - SemiBold = 7, - Bold = 8, - UltraBold = 9, - Black = 10 -}; -} - -namespace family -{ -enum type { - Unknown = 0, - Decorative = 1, - Modern = 2, - Roman = 3, - Script = 4, - Swiss = 5, - System = 6 -}; -} - namespace fonttype { enum type { @@ -129,15 +67,6 @@ enum type { }; } -namespace fcstatus -{ -enum type { - istrue, - isunset, - isfalse -}; -} - /* * the difference between FastPrintFontInfo and PrintFontInfo * is that the information in FastPrintFontInfo can usually @@ -157,11 +86,11 @@ struct FastPrintFontInfo rtl::OUString m_aFamilyName; rtl::OUString m_aStyleName; std::list< rtl::OUString > m_aAliases; - family::type m_eFamilyStyle; - italic::type m_eItalic; - width::type m_eWidth; - weight::type m_eWeight; - pitch::type m_ePitch; + FontFamily m_eFamilyStyle; + FontItalic m_eItalic; + FontWidth m_eWidth; + FontWeight m_eWeight; + FontPitch m_ePitch; rtl_TextEncoding m_aEncoding; bool m_bSubsettable; bool m_bEmbeddable; @@ -169,11 +98,11 @@ struct FastPrintFontInfo FastPrintFontInfo() : m_nID( 0 ), m_eType( fonttype::Unknown ), - m_eFamilyStyle( family::Unknown ), - m_eItalic( italic::Unknown ), - m_eWidth( width::Unknown ), - m_eWeight( weight::Unknown ), - m_ePitch( pitch::Unknown ), + m_eFamilyStyle( FAMILY_DONTKNOW ), + m_eItalic( ITALIC_DONTKNOW ), + m_eWidth( WIDTH_DONTKNOW ), + m_eWeight( WEIGHT_DONTKNOW ), + m_ePitch( PITCH_DONTKNOW ), m_aEncoding( RTL_TEXTENCODING_DONTKNOW ) {} }; @@ -241,7 +170,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager // upper byte contains: 0 for horizontal metric // 1 for vertical metric // highest byte: 0 for now - std::hash_map< int, CharacterMetric > m_aMetrics; + boost::unordered_map< int, CharacterMetric > m_aMetrics; // contains the unicode blocks for which metrics were queried // this implies that metrics should be queried in terms of // unicode blocks. here a unicode block is identified @@ -256,7 +185,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager bool m_bKernPairsQueried; std::list< KernPair > m_aXKernPairs; std::list< KernPair > m_aYKernPairs; - std::hash_map< sal_Unicode, bool > m_bVerticalSubstitutions; + boost::unordered_map< sal_Unicode, bool > m_bVerticalSubstitutions; PrintFontMetrics() : m_bKernPairsQueried( false ) {} @@ -272,10 +201,10 @@ class VCL_PLUGIN_PUBLIC PrintFontManager std::list< int > m_aAliases; int m_nPSName; // atom rtl::OUString m_aStyleName; - italic::type m_eItalic; - width::type m_eWidth; - weight::type m_eWeight; - pitch::type m_ePitch; + FontItalic m_eItalic; + FontWidth m_eWidth; + FontWeight m_eWeight; + FontPitch m_ePitch; rtl_TextEncoding m_aEncoding; bool m_bFontEncodingOnly; // set if font should be only accessed by builtin encoding CharacterMetric m_aGlobalMetricX; @@ -355,10 +284,10 @@ class VCL_PLUGIN_PUBLIC PrintFontManager rtl::OString aFoundry; rtl::OString aFamily; rtl::OString aAddStyle; - italic::type eItalic; - weight::type eWeight; - width::type eWidth; - pitch::type ePitch; + FontItalic eItalic; + FontWeight eWeight; + FontWidth eWidth; + FontPitch ePitch; rtl_TextEncoding aEncoding; XLFDEntry() { nMask = 0; } @@ -370,8 +299,8 @@ class VCL_PLUGIN_PUBLIC PrintFontManager static rtl::OString s_aEmptyOString; fontID m_nNextFontID; - std::hash_map< fontID, PrintFont* > m_aFonts; - std::hash_map< int, family::type > m_aFamilyTypes; + boost::unordered_map< fontID, PrintFont* > m_aFonts; + boost::unordered_map< int, FontFamily > m_aFamilyTypes; std::list< rtl::OUString > m_aPrinterDrivers; std::list< rtl::OString > m_aFontDirectories; std::list< int > m_aPrivateFontDirectories; @@ -379,20 +308,20 @@ class VCL_PLUGIN_PUBLIC PrintFontManager m_aXLFD_Aliases; utl::MultiAtomProvider* m_pAtoms; // for speeding up findFontFileID - std::hash_map< rtl::OString, std::set< fontID >, rtl::OStringHash > + boost::unordered_map< rtl::OString, std::set< fontID >, rtl::OStringHash > m_aFontFileToFontID; - std::hash_map< rtl::OString, int, rtl::OStringHash > + boost::unordered_map< rtl::OString, int, rtl::OStringHash > m_aDirToAtom; - std::hash_map< int, rtl::OString > m_aAtomToDir; + boost::unordered_map< int, rtl::OString > m_aAtomToDir; int m_nNextDirAtom; - std::hash_multimap< rtl::OString, sal_Unicode, rtl::OStringHash > + boost::unordered_multimap< rtl::OString, sal_Unicode, rtl::OStringHash > m_aAdobenameToUnicode; - std::hash_multimap< sal_Unicode, rtl::OString > + boost::unordered_multimap< sal_Unicode, rtl::OString > m_aUnicodeToAdobename; - std::hash_multimap< sal_Unicode, sal_uInt8 > m_aUnicodeToAdobecode; - std::hash_multimap< sal_uInt8, sal_Unicode > m_aAdobecodeToUnicode; + boost::unordered_multimap< sal_Unicode, sal_uInt8 > m_aUnicodeToAdobecode; + boost::unordered_multimap< sal_uInt8, sal_Unicode > m_aAdobecodeToUnicode; mutable FontCache* m_pFontCache; bool m_bFontconfigSuccess; @@ -413,11 +342,11 @@ class VCL_PLUGIN_PUBLIC PrintFontManager fontID findFontFileID( int nDirID, const rtl::OString& rFile ) const; fontID findFontBuiltinID( int nPSNameAtom ) const; - family::type matchFamilyName( const rtl::OUString& rFamily ) const; + FontFamily matchFamilyName( const rtl::OUString& rFamily ) const; PrintFont* getFont( fontID nID ) const { - std::hash_map< fontID, PrintFont* >::const_iterator it; + boost::unordered_map< fontID, PrintFont* >::const_iterator it; it = m_aFonts.find( nID ); return it == m_aFonts.end() ? NULL : it->second; } @@ -437,7 +366,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager false else (e.g. no libfontconfig found) */ bool initFontconfig(); - int countFontconfigFonts( std::hash_map<rtl::OString, int, rtl::OStringHash>& o_rVisitedPaths ); + int countFontconfigFonts( boost::unordered_map<rtl::OString, int, rtl::OStringHash>& o_rVisitedPaths ); /* deinitialize fontconfig */ void deinitFontconfig(); @@ -498,7 +427,7 @@ public: const rtl::OUString& getPSName( fontID nFontID ) const; // get a specific fonts style family - family::type getFontFamilyType( fontID nFontID ) const; + FontFamily getFontFamilyType( fontID nFontID ) const; // get a specific fonts family name aliases void getFontFamilyAliases( fontID nFontID ) const; @@ -511,31 +440,31 @@ public: } // get a specific fonts italic type - italic::type getFontItalic( fontID nFontID ) const + FontItalic getFontItalic( fontID nFontID ) const { PrintFont* pFont = getFont( nFontID ); - return pFont ? pFont->m_eItalic : italic::Unknown; + return pFont ? pFont->m_eItalic : ITALIC_DONTKNOW; } // get a specific fonts width type - width::type getFontWidth( fontID nFontID ) const + FontWidth getFontWidth( fontID nFontID ) const { PrintFont* pFont = getFont( nFontID ); - return pFont ? pFont->m_eWidth : width::Unknown; + return pFont ? pFont->m_eWidth : WIDTH_DONTKNOW; } // get a specific fonts weight type - weight::type getFontWeight( fontID nFontID ) const + FontWeight getFontWeight( fontID nFontID ) const { PrintFont* pFont = getFont( nFontID ); - return pFont ? pFont->m_eWeight : weight::Unknown; + return pFont ? pFont->m_eWeight : WEIGHT_DONTKNOW; } // get a specific fonts pitch type - pitch::type getFontPitch( fontID nFontID ) const + FontPitch getFontPitch( fontID nFontID ) const { PrintFont* pFont = getFont( nFontID ); - return pFont ? pFont->m_ePitch : pitch::Unknown; + return pFont ? pFont->m_ePitch : PITCH_DONTKNOW; } // get a specific fonts encoding @@ -617,15 +546,15 @@ public: // helper for type 1 fonts std::list< rtl::OString > getAdobeNameFromUnicode( sal_Unicode aChar ) const; - std::pair< std::hash_multimap< sal_Unicode, sal_uInt8 >::const_iterator, - std::hash_multimap< sal_Unicode, sal_uInt8 >::const_iterator > + std::pair< boost::unordered_multimap< sal_Unicode, sal_uInt8 >::const_iterator, + boost::unordered_multimap< sal_Unicode, sal_uInt8 >::const_iterator > getAdobeCodeFromUnicode( sal_Unicode aChar ) const { return m_aUnicodeToAdobecode.equal_range( aChar ); } std::list< sal_Unicode > getUnicodeFromAdobeName( const rtl::OString& rName ) const; - std::pair< std::hash_multimap< sal_uInt8, sal_Unicode >::const_iterator, - std::hash_multimap< sal_uInt8, sal_Unicode >::const_iterator > + std::pair< boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator, + boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator > getUnicodeFromAdobeCode( sal_uInt8 aChar ) const { return m_aAdobecodeToUnicode.equal_range( aChar ); @@ -730,11 +659,11 @@ public: false else */ bool matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale ); - bool getFontOptions( const FastPrintFontInfo&, int nSize, void (*subcallback)(void*), ImplFontOptions& rResult ) const; + ImplFontOptions* getFontOptions( const FastPrintFontInfo&, int nSize, void (*subcallback)(void*)) const; rtl::OUString Substitute( const rtl::OUString& rFontName, rtl::OUString& rMissingCodes, - const rtl::OString& rLangAttrib, italic::type& rItalic, weight::type& rWeight, - width::type& rWidth, pitch::type& rPitch) const; + const rtl::OString& rLangAttrib, FontItalic& rItalic, FontWeight& rWeight, + FontWidth& rWidth, FontPitch& rPitch) const; bool hasFontconfig() const { return m_bFontconfigSuccess; } int FreeTypeCharIndex( void *pFace, sal_uInt32 aChar ); @@ -743,3 +672,5 @@ public: } // namespace #endif // _PSPRINT_FONTMANAGER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx index b69e5a847066..86f8dc5cbc77 100644 --- a/vcl/inc/vcl/gdimtf.hxx +++ b/vcl/inc/vcl/gdimtf.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,14 +31,15 @@ #include <vcl/dllapi.h> #include <tools/gen.hxx> -#include <tools/list.hxx> #include <tools/link.hxx> #include <tools/string.hxx> #include <vcl/mapmod.hxx> +#include <vector> class OutputDevice; class ImpLabelList; class MetaAction; +class MetaCommentAction; class SvStream; class Color; class BitmapEx; @@ -49,8 +51,8 @@ class Gradient; // - GDIMetaFile-Types - // --------------------- -#define GDI_METAFILE_END ((sal_uLong)0xFFFFFFFF) -#define GDI_METAFILE_LABEL_NOTFOUND ((sal_uLong)0xFFFFFFFF) +#define GDI_METAFILE_END ((size_t)0xFFFFFFFF) +#define GDI_METAFILE_LABEL_NOTFOUND ((size_t)0xFFFFFFFF) #ifndef METAFILE_END #define METAFILE_END GDI_METAFILE_END @@ -92,20 +94,19 @@ enum MtfConversion // - Color conversion routines - // ----------------------------- -//#if 0 // _SOLAR__PRIVATE - typedef Color (*ColorExchangeFnc)( const Color& rColor, const void* pColParam ); typedef BitmapEx (*BmpExchangeFnc)( const BitmapEx& rBmpEx, const void* pBmpParam ); -//#endif // __PRIVATE // --------------- // - GDIMetaFile - // --------------- -class VCL_DLLPUBLIC GDIMetaFile : protected List +class VCL_DLLPUBLIC GDIMetaFile { private: + ::std::vector< MetaAction* > aList; + size_t nCurrentActionElement; MapMode aPrefMapMode; Size aPrefSize; @@ -116,8 +117,8 @@ private: ImpLabelList* pLabelList; sal_Bool bPause; sal_Bool bRecord; + sal_Bool bUseCanvas; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE static Color ImplColAdjustFnc( const Color& rColor, const void* pColParam ); SAL_DLLPRIVATE static BitmapEx ImplBmpAdjustFnc( const BitmapEx& rBmpEx, const void* pBmpParam ); @@ -144,8 +145,9 @@ private: const OutputDevice& rMapDev, const PolyPolygon& rPolyPoly, const Gradient& rGrad ); + SAL_DLLPRIVATE bool ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize ); + SAL_DLLPRIVATE void ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, OutputDevice* pOut ); -//#endif // __PRIVATE protected: @@ -157,15 +159,13 @@ public: GDIMetaFile( const GDIMetaFile& rMtf ); virtual ~GDIMetaFile(); - using List::operator==; - using List::operator!=; GDIMetaFile& operator=( const GDIMetaFile& rMtf ); - sal_Bool operator==( const GDIMetaFile& rMtf ) const; - sal_Bool operator!=( const GDIMetaFile& rMtf ) const { return !( *this == rMtf ); } + sal_Bool operator==( const GDIMetaFile& rMtf ) const; + sal_Bool operator!=( const GDIMetaFile& rMtf ) const { return !( *this == rMtf ); } void Clear(); sal_Bool IsEqual( const GDIMetaFile& rMtf ) const; - sal_Bool Mirror( sal_uLong nMirrorFlags ); + sal_Bool Mirror( sal_uLong nMirrorFlags ); void Move( long nX, long nY ); // additional Move method getting specifics how to handle MapMode( MAP_PIXEL ) void Move( long nX, long nY, long nDPIX, long nDPIY ); @@ -183,53 +183,59 @@ public: Rectangle GetBoundRect( OutputDevice& i_rReference ); void Adjust( short nLuminancePercent = 0, short nContrastPercent = 0, - short nChannelRPercent = 0, short nChannelGPercent = 0, - short nChannelBPercent = 0, double fGamma = 1.0, sal_Bool bInvert = sal_False ); + short nChannelRPercent = 0, short nChannelGPercent = 0, + short nChannelBPercent = 0, double fGamma = 1.0, + sal_Bool bInvert = sal_False + ); + void Convert( MtfConversion eConversion ); - void ReplaceColors( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol = 0 ); + void ReplaceColors( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol = 0 ); void ReplaceColors( const Color* pSearchColors, const Color* rReplaceColors, sal_uLong nColorCount, sal_uLong* pTols = NULL ); GDIMetaFile GetMonochromeMtf( const Color& rCol ) const; void Record( OutputDevice* pOutDev ); - sal_Bool IsRecord() const { return bRecord; } + sal_Bool IsRecord() const { return bRecord; } - void Play( GDIMetaFile& rMtf, sal_uLong nPos = GDI_METAFILE_END ); - void Play( OutputDevice* pOutDev, sal_uLong nPos = GDI_METAFILE_END ); + void Play( GDIMetaFile& rMtf, size_t nPos = GDI_METAFILE_END ); + void Play( OutputDevice* pOutDev, size_t nPos = GDI_METAFILE_END ); void Play( OutputDevice* pOutDev, const Point& rPos, - const Size& rSize, sal_uLong nPos = GDI_METAFILE_END ); + const Size& rSize, size_t nPos = GDI_METAFILE_END ); void Pause( sal_Bool bPause ); - sal_Bool IsPause() const { return bPause; } + sal_Bool IsPause() const { return bPause; } void Stop(); void WindStart(); void WindEnd(); - void Wind( sal_uLong nAction ); + void Wind( size_t nAction ); void WindPrev(); void WindNext(); - sal_uLong GetActionCount() const { return Count(); } + size_t GetActionSize() const; + size_t GetActionPos( const String& rLabel ); + void AddAction( MetaAction* pAction ); - void AddAction( MetaAction* pAction, sal_uLong nPos ); - void RemoveAction( sal_uLong nPos ); - MetaAction* CopyAction( sal_uLong nPos ) const; - MetaAction* GetCurAction() const { return (MetaAction*) GetCurObject(); } - MetaAction* GetAction( sal_uLong nAction ) const { return (MetaAction*) GetObject( nAction ); } - MetaAction* FirstAction() { return (MetaAction*) First(); } - MetaAction* NextAction() { return (MetaAction*) Next(); } - MetaAction* ReplaceAction( MetaAction* pAction, sal_uLong nAction ) { return (MetaAction*) Replace( pAction, nAction ); } - - sal_uLong GetActionPos( const String& rLabel ); - sal_Bool InsertLabel( const String& rLabel, sal_uLong nActionPos ); + void AddAction( MetaAction* pAction, size_t nPos ); + void RemoveAction( size_t nPos ); + void push_back( MetaAction* pAction ); + + MetaAction* FirstAction(); + MetaAction* NextAction(); + MetaAction* GetAction( size_t nAction ) const; + MetaAction* CopyAction( size_t nPos ) const; + MetaAction* GetCurAction() const { return GetAction( nCurrentActionElement ); } + MetaAction* ReplaceAction( MetaAction* pAction, size_t nAction ); + + sal_Bool InsertLabel( const String& rLabel, size_t nActionPos ); void RemoveLabel( const String& rLabel ); void RenameLabel( const String& rLabel, const String& rNewLabel ); - sal_uLong GetLabelCount() const; - String GetLabel( sal_uLong nLabel ); + size_t GetLabelCount() const; + String GetLabel( size_t nLabel ); - sal_Bool SaveStatus(); + sal_Bool SaveStatus(); const Size& GetPrefSize() const { return aPrefSize; } void SetPrefSize( const Size& rSize ) { aPrefSize = rSize; } @@ -240,8 +246,8 @@ public: void SetHookHdl( const Link& rLink ) { aHookHdlLink = rLink; } const Link& GetHookHdl() const { return aHookHdlLink; } - sal_uLong GetChecksum() const; - sal_uLong GetSizeBytes() const; + sal_uLong GetChecksum() const; + sal_uLong GetSizeBytes() const; // Methoden zum Lesen und Schreiben des neuen Formats; // die Read-Methode kann auch das alte Format lesen @@ -253,7 +259,36 @@ public: friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, GDIMetaFile& rGDIMetaFile ); friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const GDIMetaFile& rGDIMetaFile ); - sal_Bool CreateThumbnail( sal_uInt32 nMaximumExtent, BitmapEx& rBmpEx, const BitmapEx* pOverlay = NULL, const Rectangle* pOverlayRect = NULL ) const; + sal_Bool CreateThumbnail( sal_uInt32 nMaximumExtent, BitmapEx& rBmpEx, const BitmapEx* pOverlay = NULL, const Rectangle* pOverlayRect = NULL ) const; + + void UseCanvas( sal_Bool _bUseCanvas ); + sal_Bool GetUseCanvas() const { return bUseCanvas; } }; +/** Create a special metaaction that delegates rendering to specified + service. + + This factory function creates a MetaCommentAction that delegates + rendering to the specified services, once played back in the + metafile. + + @param rRendererServiceName + Renderer service. Gets an awt::XGraphic on instantiation + + @param rGraphicServiceName + Graphic service. Gets the raw data on instantiation + + @param pData + Raw data. Gets copied + + @param nDataSize + Length, in byte, of raw data + */ +MetaCommentAction* makePluggableRendererAction( const rtl::OUString& rRendererServiceName, + const rtl::OUString& rGraphicServiceName, + const void* pData, + sal_uInt32 nDataSize ); + #endif // _SV_GDIMTF_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/vcl/inc/vcl/gfxlink.hxx b/vcl/inc/vcl/gfxlink.hxx index 29668f0dfa58..d86973b5686c 100644 --- a/vcl/inc/vcl/gfxlink.hxx +++ b/vcl/inc/vcl/gfxlink.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -184,3 +185,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/gradient.hxx b/vcl/inc/vcl/gradient.hxx index 7e2fe408eadf..1ed0c12ce98f 100644 --- a/vcl/inc/vcl/gradient.hxx +++ b/vcl/inc/vcl/gradient.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,6 +31,7 @@ #include <vcl/dllapi.h> #include <tools/color.hxx> +#include <tools/gen.hxx> #include <vcl/vclenum.hxx> @@ -118,6 +120,8 @@ public: void SetSteps( sal_uInt16 nSteps ); sal_uInt16 GetSteps() const { return mpImplGradient->mnStepCount; } + void GetBoundRect( const Rectangle& rRect, Rectangle &rBoundRect, Point& rCenter ) const; + Gradient& operator=( const Gradient& rGradient ); sal_Bool operator==( const Gradient& rGradient ) const; sal_Bool operator!=( const Gradient& rGradient ) const @@ -130,3 +134,5 @@ public: }; #endif // _SV_GRADIENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/graph.h b/vcl/inc/vcl/graph.h index f93561882800..1df2ee7a3df3 100644 --- a/vcl/inc/vcl/graph.h +++ b/vcl/inc/vcl/graph.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,3 +80,5 @@ public: }; #endif // _SV_GRAPH_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/graph.hxx b/vcl/inc/vcl/graph.hxx index 31c7b20b9c77..61da922acce6 100644 --- a/vcl/inc/vcl/graph.hxx +++ b/vcl/inc/vcl/graph.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -87,15 +88,11 @@ private: ImpGraphic* mpImpGraphic; -//#if 0 // _SOLAR__PRIVATE - public: SAL_DLLPRIVATE void ImplTestRefCount(); SAL_DLLPRIVATE ImpGraphic* ImplGetImpGraphic() const { return mpImpGraphic; } -//#endif - public: TYPEINFO(); @@ -224,3 +221,5 @@ public: }; #endif // _SV_GRAPH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/vcl/inc/vcl/graphictools.hxx b/vcl/inc/vcl/graphictools.hxx index 3e3b9b3dc5b5..edd29ab9db01 100644 --- a/vcl/inc/vcl/graphictools.hxx +++ b/vcl/inc/vcl/graphictools.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -460,3 +461,5 @@ private: }; #endif /* _VCL_GRAPHICTOOLS_HXX_ */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/group.hxx b/vcl/inc/vcl/group.hxx index 56aec19f366f..3334988c7877 100644 --- a/vcl/inc/vcl/group.hxx +++ b/vcl/inc/vcl/group.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,3 +66,5 @@ public: }; #endif // _SV_GROUP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/hatch.hxx b/vcl/inc/vcl/hatch.hxx index 78cbfe1153c1..947740229f7f 100644 --- a/vcl/inc/vcl/hatch.hxx +++ b/vcl/inc/vcl/hatch.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,3 +95,5 @@ public: }; #endif // _SV_HATCH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx index b80b9a86627a..ce7d1baf4fd6 100644 --- a/vcl/inc/vcl/help.hxx +++ b/vcl/inc/vcl/help.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -130,3 +131,5 @@ public: }; #endif // _SV_HELP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/helper.hxx b/vcl/inc/vcl/helper.hxx index 9047079f6be1..732e98080c62 100644 --- a/vcl/inc/vcl/helper.hxx +++ b/vcl/inc/vcl/helper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,3 +64,5 @@ rtl::OUString VCL_DLLPUBLIC getOfficePath( enum whichOfficePath ePath ); } // namespace #endif // _PSPRINT_HELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/i18nhelp.hxx b/vcl/inc/vcl/i18nhelp.hxx index b66ee1ee844e..a83afa4510ab 100644 --- a/vcl/inc/vcl/i18nhelp.hxx +++ b/vcl/inc/vcl/i18nhelp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -95,3 +96,4 @@ public: #endif // _VCL_I18NHELP_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/image.hxx b/vcl/inc/vcl/image.hxx index 3b294125226b..d536d6bd03d7 100644 --- a/vcl/inc/vcl/image.hxx +++ b/vcl/inc/vcl/image.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -176,3 +177,5 @@ private: }; #endif // _SV_IMAGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/imagerepository.hxx b/vcl/inc/vcl/imagerepository.hxx index f5809650fcf3..8f963fb51edc 100644 --- a/vcl/inc/vcl/imagerepository.hxx +++ b/vcl/inc/vcl/imagerepository.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,7 +59,12 @@ namespace vcl static bool loadImage( const ::rtl::OUString& _rName, BitmapEx& _out_rImage, - bool bSearchLanguageDependent + bool bSearchLanguageDependent, + bool loadMissing = false + ); + + static bool loadDefaultImage( + BitmapEx& _out_rImage ); }; @@ -68,3 +74,4 @@ namespace vcl #endif // VCL_IMAGEREPOSITORY_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/imgctrl.hxx b/vcl/inc/vcl/imgctrl.hxx index 456b6b599a1c..ec8ed99c93bb 100644 --- a/vcl/inc/vcl/imgctrl.hxx +++ b/vcl/inc/vcl/imgctrl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,7 +60,10 @@ public: protected: void ImplDraw( OutputDevice& rDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize ) const; private: - using FixedImage::ImplDraw; + sal_Bool SetModeBitmap( const BitmapEx& rBitmap ); + const BitmapEx& GetModeBitmap( ) const; }; #endif // _SV_IMGCTRL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/impdel.hxx b/vcl/inc/vcl/impdel.hxx index fc1796f0e402..90ab82bd1878 100644 --- a/vcl/inc/vcl/impdel.hxx +++ b/vcl/inc/vcl/impdel.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -85,3 +86,5 @@ } // namespace vcl #endif // _VCL_IMPDEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/inputctx.hxx b/vcl/inc/vcl/inputctx.hxx index 5dc3e31eec74..eaaec5e7bd1d 100644 --- a/vcl/inc/vcl/inputctx.hxx +++ b/vcl/inc/vcl/inputctx.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -86,3 +87,5 @@ inline sal_Bool InputContext::operator==( const InputContext& rInputContext ) co } #endif // _VCL_INPUTCTX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/introwin.hxx b/vcl/inc/vcl/introwin.hxx index 40644019bc15..e5503bc5dfd6 100644 --- a/vcl/inc/vcl/introwin.hxx +++ b/vcl/inc/vcl/introwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,3 +52,5 @@ public: }; #endif // _SV_INTROWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/javachild.hxx b/vcl/inc/vcl/javachild.hxx index c5ec3c678900..a7b39d0bff8f 100644 --- a/vcl/inc/vcl/javachild.hxx +++ b/vcl/inc/vcl/javachild.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,3 +54,5 @@ private: }; #endif // _SV_JAVACHILD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/jobdata.hxx b/vcl/inc/vcl/jobdata.hxx index fcdcf933bbd3..c296abb27e9d 100644 --- a/vcl/inc/vcl/jobdata.hxx +++ b/vcl/inc/vcl/jobdata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -87,3 +88,5 @@ struct VCL_DLLPUBLIC JobData #endif // PSPRINT_JOBDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/jobset.hxx b/vcl/inc/vcl/jobset.hxx index 5dcb0f1e9287..0340f5dd8587 100644 --- a/vcl/inc/vcl/jobset.hxx +++ b/vcl/inc/vcl/jobset.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,12 +48,10 @@ class VCL_DLLPUBLIC JobSetup private: ImplJobSetup* mpData; -//#if 0 // _SOLAR__PRIVATE public: SAL_DLLPRIVATE ImplJobSetup* ImplGetData(); SAL_DLLPRIVATE ImplJobSetup* ImplGetConstData(); SAL_DLLPRIVATE const ImplJobSetup* ImplGetConstData() const; -//#endif public: JobSetup(); @@ -81,3 +80,5 @@ public: }; #endif // _SV_JOBSET_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/keycod.hxx b/vcl/inc/vcl/keycod.hxx index 90e370cdbded..b5be547b1781 100644 --- a/vcl/inc/vcl/keycod.hxx +++ b/vcl/inc/vcl/keycod.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -155,3 +156,5 @@ inline KeyCode& KeyCode::operator = ( const KeyCode& rKeyCode ) } #endif // _SV_KEYCODE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/keycodes.hxx b/vcl/inc/vcl/keycodes.hxx index 940858020f10..2c6fa38bd49b 100644 --- a/vcl/inc/vcl/keycodes.hxx +++ b/vcl/inc/vcl/keycodes.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,6 +30,7 @@ #define _SV_KEYCODES_HXX #include <vcl/sv.h> +#undef DELETE #include <com/sun/star/awt/Key.hpp> #include <com/sun/star/awt/KeyGroup.hpp> @@ -155,6 +157,13 @@ #define KEY_DECIMAL ((sal_uInt16)::com::sun::star::awt::Key::DECIMAL) #define KEY_TILDE ((sal_uInt16)::com::sun::star::awt::Key::TILDE) #define KEY_QUOTELEFT ((sal_uInt16)::com::sun::star::awt::Key::QUOTELEFT) +#define KEY_BRACKETLEFT ((sal_uInt16)::com::sun::star::awt::Key::BRACKETLEFT) +#define KEY_BRACKETRIGHT ((sal_uInt16)::com::sun::star::awt::Key::BRACKETRIGHT) +#define KEY_SEMICOLON ((sal_uInt16)::com::sun::star::awt::Key::SEMICOLON) + +#define KEY_CAPSLOCK ((sal_uInt16)::com::sun::star::awt::Key::CAPSLOCK) +#define KEY_NUMLOCK ((sal_uInt16)::com::sun::star::awt::Key::NUMLOCK) +#define KEY_SCROLLLOCK ((sal_uInt16)::com::sun::star::awt::Key::SCROLLLOCK) #define KEY_CODE ((sal_uInt16)0x0FFF) @@ -188,4 +197,14 @@ #define MOUSE_MIDDLE ((sal_uInt16)0x0002) #define MOUSE_RIGHT ((sal_uInt16)0x0004) +// ------------------- +// - Indicator-Types - +// ------------------- + +#define INDICATOR_CAPSLOCK 0x0001 +#define INDICATOR_NUMLOCK 0x0002 +#define INDICATOR_SCROLLLOCK 0x0004 + #endif // _SV_KEYCODES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/lazydelete.hxx b/vcl/inc/vcl/lazydelete.hxx index dad10fb62b33..b62bb4216c85 100644 --- a/vcl/inc/vcl/lazydelete.hxx +++ b/vcl/inc/vcl/lazydelete.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #include "dllapi.h" #include <vector> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <algorithm> #if OSL_DEBUG_LEVEL > 2 @@ -124,7 +125,7 @@ namespace vcl }; std::vector< DeleteObjectEntry > m_aObjects; - typedef std::hash_map< sal_IntPtr, unsigned int > PtrToIndexMap; + typedef boost::unordered_map< sal_IntPtr, unsigned int > PtrToIndexMap; PtrToIndexMap m_aPtrToIndex; /** strict weak ordering funtion to bring objects to be destroyed lazily @@ -257,6 +258,11 @@ namespace vcl // set contents, returning old contents // ownership is transfered ! T* set( T* i_pNew ) { T* pOld = m_pT; m_pT = i_pNew; return pOld; } + + // set contents, deleting old contents + // ownership is transfered ! + void reset( T* i_pNew = NULL ) + { OSL_ASSERT( i_pNew != m_pT || i_pNew == NULL ); T* pOld = m_pT; m_pT = i_pNew; delete pOld; } }; /** Similar to DeleteOnDeinit, the DeleteUnoReferenceOnDeinit @@ -299,3 +305,4 @@ namespace vcl #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/lineinfo.hxx b/vcl/inc/vcl/lineinfo.hxx index ca498c157bd7..046257cbdd9f 100644 --- a/vcl/inc/vcl/lineinfo.hxx +++ b/vcl/inc/vcl/lineinfo.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -132,3 +133,5 @@ public: }; #endif // _SV_LINEINFO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/longcurr.hxx b/vcl/inc/vcl/longcurr.hxx index d186dca9d292..ca4ebcadc77e 100644 --- a/vcl/inc/vcl/longcurr.hxx +++ b/vcl/inc/vcl/longcurr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <vcl/dllapi.h> #include <tools/bigint.hxx> -#ifndef _FIELD_HXX #include <vcl/field.hxx> -#endif class LocaleDataWrapper; @@ -99,9 +98,7 @@ public: class VCL_DLLPUBLIC LongCurrencyField : public SpinField, public LongCurrencyFormatter { -//#if 0 // _SOLAR__PRIVATE friend void ImplNewLongCurrencyFieldValue( LongCurrencyField*, BigInt ); -//#endif private: BigInt mnSpinSize; @@ -160,3 +157,5 @@ public: }; #endif // _LONGCURR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/lstbox.h b/vcl/inc/vcl/lstbox.h index c9dbfce508df..f4577dc1e718 100644 --- a/vcl/inc/vcl/lstbox.h +++ b/vcl/inc/vcl/lstbox.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,3 +64,5 @@ #define LISTBOX_ENTRY_FLAG_DRAW_DISABLED 0x0000004 #endif // _SV_LSTBOX_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/lstbox.hxx b/vcl/inc/vcl/lstbox.hxx index 80ee97200006..cc1d0615cb7b 100644 --- a/vcl/inc/vcl/lstbox.hxx +++ b/vcl/inc/vcl/lstbox.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,7 +57,6 @@ private: Link maDoubleClickHdl; sal_uInt16 mnLineCount; -//#if 0 // _SOLAR__PRIVATE private: SAL_DLLPRIVATE void ImplInitListBoxData(); @@ -74,7 +74,6 @@ protected: SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); -//#endif sal_Bool IsDropDownBox() const { return mpFloatWin ? sal_True : sal_False; } protected: @@ -264,3 +263,5 @@ public: }; #endif // _SV_LSTBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/mapmod.hxx b/vcl/inc/vcl/mapmod.hxx index ea7b1bed6409..bf666bc782cb 100644 --- a/vcl/inc/vcl/mapmod.hxx +++ b/vcl/inc/vcl/mapmod.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -114,3 +115,5 @@ public: }; #endif // _SV_MAPMOD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx index 0ccdc912f535..340311e9b55b 100644 --- a/vcl/inc/vcl/menu.hxx +++ b/vcl/inc/vcl/menu.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -198,6 +199,10 @@ protected: // return value is Max( rCheckHeight, rRadioHeight ) SAL_DLLPRIVATE long ImplGetNativeCheckAndRadioSize( Window*, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth ) const; + // returns native submenu arrow size and spacing from right border + // return value is whether it's supported natively + SAL_DLLPRIVATE sal_Bool ImplGetNativeSubmenuArrowSize( Window* pWin, Size& rArrowSize, long& rArrowSpacing ) const; + SAL_DLLPRIVATE void ImplAddDel( ImplMenuDelData &rDel ); SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel ); public: @@ -400,7 +405,6 @@ class VCL_DLLPUBLIC MenuBar : public Menu sal_Bool mbHideBtnVisible; sal_Bool mbDisplayable; -//#if 0 // _SOLAR__PRIVATE friend class Application; friend class Menu; friend class MenuBarWindow; @@ -410,7 +414,6 @@ class VCL_DLLPUBLIC MenuBar : public Menu SAL_DLLPRIVATE static Window* ImplCreate( Window* pParent, Window* pWindow, MenuBar* pMenu ); SAL_DLLPRIVATE static void ImplDestroy( MenuBar* pMenu, sal_Bool bDelete ); SAL_DLLPRIVATE sal_Bool ImplHandleKeyEvent( const KeyEvent& rKEvent, sal_Bool bFromMenu = sal_True ); -//#endif public: MenuBar(); @@ -532,3 +535,4 @@ inline PopupMenu& PopupMenu::operator =( const PopupMenu& rMenu ) #endif // _SV_MENU_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/menubtn.hxx b/vcl/inc/vcl/menubtn.hxx index 41f8b55bc057..1e65504b97bc 100644 --- a/vcl/inc/vcl/menubtn.hxx +++ b/vcl/inc/vcl/menubtn.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -96,3 +97,5 @@ public: }; #endif // _SV_MENUBTN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/metaact.hxx b/vcl/inc/vcl/metaact.hxx index b1bd5d91d20e..87bc75fab2a0 100644 --- a/vcl/inc/vcl/metaact.hxx +++ b/vcl/inc/vcl/metaact.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1595,3 +1596,5 @@ public: }; #endif // _SV_METAACT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/metric.hxx b/vcl/inc/vcl/metric.hxx index 5381e0f14bde..677135b99990 100644 --- a/vcl/inc/vcl/metric.hxx +++ b/vcl/inc/vcl/metric.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -161,3 +162,5 @@ inline TextRectInfo::TextRectInfo() } #endif // _SV_METRIC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/mnemonic.hxx b/vcl/inc/vcl/mnemonic.hxx index 2a09a5776d10..1a0aac80a4a4 100644 --- a/vcl/inc/vcl/mnemonic.hxx +++ b/vcl/inc/vcl/mnemonic.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -86,3 +87,5 @@ public: }; #endif // _SV_MNEMONIC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/mnemonicengine.hxx b/vcl/inc/vcl/mnemonicengine.hxx index fcd303510203..79f6856cb704 100644 --- a/vcl/inc/vcl/mnemonicengine.hxx +++ b/vcl/inc/vcl/mnemonicengine.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -156,3 +157,4 @@ namespace vcl #endif // VCL_MNEMONICENGINE_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/morebtn.hxx b/vcl/inc/vcl/morebtn.hxx index fdf7d5a74cfc..e84798479d7f 100644 --- a/vcl/inc/vcl/morebtn.hxx +++ b/vcl/inc/vcl/morebtn.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -93,3 +94,5 @@ inline void MoreButton::SetState( sal_Bool bNewState ) } #endif // _SV_MOREBTN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/msgbox.hxx b/vcl/inc/vcl/msgbox.hxx index 5e0604464bea..326dae5616e3 100644 --- a/vcl/inc/vcl/msgbox.hxx +++ b/vcl/inc/vcl/msgbox.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -70,7 +71,6 @@ protected: FixedImage* mpFixedImage; XubString maMessText; Image maImage; - Image maImageHC; sal_uInt16 mnSoundType; sal_Bool mbHelpBtn; sal_Bool mbSound; @@ -100,8 +100,8 @@ public: void SetImage( const Image& rImage ) { maImage = rImage; } const Image& GetImage() const { return maImage; } - sal_Bool SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL ); - const Image& GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + sal_Bool SetModeImage( const Image& rImage ); + const Image& GetModeImage( ) const; void SetDefaultCheckBoxText(); void SetCheckBoxText( const XubString& rText ) { maCheckBoxText = rText;} @@ -126,7 +126,6 @@ public: InfoBox( Window* pParent, const ResId & rResId ); static Image GetStandardImage(); - static Image GetStandardImageHC(); }; // -------------- @@ -146,7 +145,6 @@ public: void SetDefaultCheckBoxText(); static Image GetStandardImage(); - static Image GetStandardImageHC(); }; // ------------ @@ -164,7 +162,6 @@ public: ErrorBox( Window* pParent, const ResId& rResId ); static Image GetStandardImage(); - static Image GetStandardImageHC(); }; // ------------ @@ -184,7 +181,8 @@ public: void SetDefaultCheckBoxText(); static Image GetStandardImage(); - static Image GetStandardImageHC(); }; #endif // _SV_MSGBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/octree.hxx b/vcl/inc/vcl/octree.hxx index 88de6bcc9e68..3cef6384a7d6 100644 --- a/vcl/inc/vcl/octree.hxx +++ b/vcl/inc/vcl/octree.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -135,12 +136,9 @@ private: sal_uInt8* pMap; const sal_uLong nBits; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void ImplCreateBuffers( const sal_uLong nMax ); -//#endif // __PRIVATE - public: explicit InverseColorMap( const BitmapPalette& rPal ); @@ -159,3 +157,5 @@ inline sal_uInt16 InverseColorMap::GetBestPaletteIndex( const BitmapColor& rColo } #endif // _SV_OCTREE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/oldprintadaptor.hxx b/vcl/inc/vcl/oldprintadaptor.hxx index 3d7ccedc2ca1..1a6705b42cb8 100644 --- a/vcl/inc/vcl/oldprintadaptor.hxx +++ b/vcl/inc/vcl/oldprintadaptor.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,3 +51,5 @@ namespace vcl } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 601670592194..b0d694c5e75e 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -108,6 +109,7 @@ namespace vcl class PDFWriterImpl; class ExtOutDevData; class ITextLayout; + struct FontCapabilities; class RenderGraphic; } @@ -201,8 +203,6 @@ struct KerningPair #define IMAGE_DRAW_DEACTIVE ((sal_uInt16)0x0004) #define IMAGE_DRAW_COLORTRANSFORM ((sal_uInt16)0x0008) #define IMAGE_DRAW_SEMITRANSPARENT ((sal_uInt16)0x0010) -#define IMAGE_DRAW_MONOCHROME_BLACK ((sal_uInt16)0x0020) -#define IMAGE_DRAW_MONOCHROME_WHITE ((sal_uInt16)0x0040) #define IMAGE_DRAW_3DLOOK 0 #define IMAGE_DRAW_BTNLOOK 0 @@ -280,6 +280,8 @@ enum OutDevViewType { OUTDEV_VIEWTYPE_DONTKNOW, OUTDEV_VIEWTYPE_PRINTPREVIEW, OU class VirtualDevice; class Printer; +class ImplFontSelectData; +class ImplFontMetricData; const char* ImplDbgCheckOutputDevice( const void* pObj ); @@ -566,6 +568,9 @@ public: // Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area) void impPaintLineGeometryWithEvtlExpand(const LineInfo& rInfo, basegfx::B2DPolyPolygon aLinePolyPolygon); + SAL_DLLPRIVATE void forceFallbackFontToFit(SalLayout &rFallback, ImplFontEntry &rFallbackFont, + ImplFontSelectData &rFontSelData, int nFallbackLevel, + ImplLayoutArgs& rLayoutArgs, const ImplFontMetricData& rOrigMetric) const; protected: OutputDevice(); @@ -1087,6 +1092,7 @@ public: FontMetric GetFontMetric() const; FontMetric GetFontMetric( const Font& rFont ) const; sal_Bool GetFontCharMap( FontCharMap& rFontCharMap ) const; + bool GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities ) const; xub_StrLen HasGlyphs( const Font& rFont, const String& rStr, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN ) const; @@ -1234,3 +1240,5 @@ public: }; #endif // _SV_OUTDEV_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/pdfextoutdevdata.hxx b/vcl/inc/vcl/pdfextoutdevdata.hxx index bf2a09c1dd42..37dadb9a63db 100644 --- a/vcl/inc/vcl/pdfextoutdevdata.hxx +++ b/vcl/inc/vcl/pdfextoutdevdata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -550,3 +551,5 @@ public : } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index 09a8a08d5aca..9df687de8b05 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -208,7 +209,7 @@ public: // PDF/A does not allow transparency Warning_Transparency_Omitted_PDFA, - // transparent object occured but is only supported since + // transparent object occurred but is only supported since // PDF 1.4 Warning_Transparency_Omitted_PDF13, @@ -691,9 +692,9 @@ The following structure describes the permissions used in PDF security bool Emit(); /* - * Get a list of errors that occured during processing + * Get a list of errors that occurred during processing * this should enable the producer to give feedback about - * any anomalies that might have occured + * any anomalies that might have occurred */ std::set< ErrorCode > GetErrors(); @@ -1360,3 +1361,5 @@ The following structure describes the permissions used in PDF security } #endif // _VCL_PDFWRITER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/pngread.hxx b/vcl/inc/vcl/pngread.hxx index d2879f8f182a..64385f604537 100644 --- a/vcl/inc/vcl/pngread.hxx +++ b/vcl/inc/vcl/pngread.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,3 +69,5 @@ namespace vcl } #endif // _SV_PNGREAD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/pngwrite.hxx b/vcl/inc/vcl/pngwrite.hxx index 38ca97a8c931..15c8c624a5ff 100644 --- a/vcl/inc/vcl/pngwrite.hxx +++ b/vcl/inc/vcl/pngwrite.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,3 +66,5 @@ namespace vcl } #endif // _SV_PNGWRITE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/pointr.hxx b/vcl/inc/vcl/pointr.hxx index 5456eb86d94a..d5d2a49b33f0 100644 --- a/vcl/inc/vcl/pointr.hxx +++ b/vcl/inc/vcl/pointr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,3 +58,5 @@ public: }; #endif // _VCL_POINTR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/popupmenuwindow.hxx b/vcl/inc/vcl/popupmenuwindow.hxx index 5ed794ff56ca..9759ab42fb73 100644 --- a/vcl/inc/vcl/popupmenuwindow.hxx +++ b/vcl/inc/vcl/popupmenuwindow.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,3 +46,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx index ab777c392836..7082c020c7a2 100644 --- a/vcl/inc/vcl/ppdparser.hxx +++ b/vcl/inc/vcl/ppdparser.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,7 @@ #include <list> #include <vector> -#include <hash_map> +#include <boost/unordered_map.hpp> #include "tools/string.hxx" #include "tools/stream.hxx" @@ -64,7 +65,7 @@ class VCL_DLLPUBLIC PPDKey { friend class PPDParser; - typedef ::std::hash_map< ::rtl::OUString, PPDValue, ::rtl::OUStringHash > hash_type; + typedef ::boost::unordered_map< ::rtl::OUString, PPDValue, ::rtl::OUStringHash > hash_type; typedef ::std::vector< PPDValue* > value_type; String m_aKey; @@ -126,8 +127,9 @@ class VCL_DLLPUBLIC PPDParser { friend class PPDContext; friend class CUPSManager; + friend class PPDCache; - typedef ::std::hash_map< ::rtl::OUString, PPDKey*, ::rtl::OUStringHash > hash_type; + typedef ::boost::unordered_map< ::rtl::OUString, PPDKey*, ::rtl::OUStringHash > hash_type; typedef ::std::vector< PPDKey* > value_type; void insertKey( const String& rKey, PPDKey* pKey ); @@ -142,11 +144,6 @@ public: PPDConstraint() : m_pKey1( NULL ), m_pOption1( NULL ), m_pKey2( NULL ), m_pOption2( NULL ) {} }; private: - - static ::std::list< PPDParser* > aAllParsers; - static ::std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >* - pAllPPDFiles; - hash_type m_aKeys; value_type m_aOrderedKeys; ::std::list< PPDConstraint > m_aConstraints; @@ -300,7 +297,7 @@ public: class VCL_DLLPUBLIC PPDContext { - typedef ::std::hash_map< const PPDKey*, const PPDValue*, PPDKeyhash > hash_type; + typedef ::boost::unordered_map< const PPDKey*, const PPDValue*, PPDKeyhash > hash_type; hash_type m_aCurrentValues; const PPDParser* m_pParser; @@ -329,8 +326,8 @@ public: void getUnconstrainedValues( const PPDKey*, ::std::list< const PPDValue* >& rValues ); // for printer setup - void* getStreamableBuffer( sal_uLong& rBytes ) const; - void rebuildFromStreamBuffer( void* pBuffer, sal_uLong nBytes ); + char* getStreamableBuffer( sal_uLong& rBytes ) const; + void rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes ); // convenience int getRenderResolution() const; @@ -343,3 +340,5 @@ public: } // namespace #endif // _PSPRINT_PPDPARSER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index 2ce69ab0b660..182258aeb3c1 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,7 +43,7 @@ #include "com/sun/star/view/PrintableState.hpp" #include <boost/shared_ptr.hpp> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <set> struct SalPrinterInfoQueue; @@ -553,7 +554,7 @@ public: class VCL_DLLPUBLIC PrinterOptionsHelper { protected: - std::hash_map< rtl::OUString, com::sun::star::uno::Any, rtl::OUStringHash > m_aPropertyMap; + boost::unordered_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: @@ -565,7 +566,7 @@ class VCL_DLLPUBLIC PrinterOptionsHelper {} /* process a new set of properties - * merges changed properties and returns "true" if any occured + * merges changed properties and returns "true" if any occurred * 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, @@ -699,3 +700,5 @@ class VCL_DLLPUBLIC PrinterOptionsHelper #endif // _SV_PRINT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/printerinfomanager.hxx b/vcl/inc/vcl/printerinfomanager.hxx index 5e94ed919a4e..b6ebc072b8cf 100644 --- a/vcl/inc/vcl/printerinfomanager.hxx +++ b/vcl/inc/vcl/printerinfomanager.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #ifndef _PSPRINT_PRINTERINFOMANAGER_HXX_ #define _PSPRINT_PRINTERINFOMANAGER_HXX_ -#include <hash_map> +#include <boost/unordered_map.hpp> #include <list> #include "vcl/dllapi.h" @@ -69,9 +70,9 @@ struct PrinterInfo : JobData // this vector is currently implicitly given by the adobe // standard encoding bool m_bPerformFontSubstitution; - std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash > + boost::unordered_map< rtl::OUString, rtl::OUString, rtl::OUStringHash > m_aFontSubstitutes; - std::hash_map< fontID, fontID > + boost::unordered_map< fontID, fontID > m_aFontSubstitutions; PrinterInfo() : @@ -121,7 +122,7 @@ protected: PrinterInfo m_aInfo; }; - std::hash_map< rtl::OUString, Printer, rtl::OUStringHash > m_aPrinters; + boost::unordered_map< rtl::OUString, Printer, rtl::OUStringHash > m_aPrinters; PrinterInfo m_aGlobalDefaults; std::list< WatchFile > m_aWatchFiles; rtl::OUString m_aDefaultPrinter; @@ -139,12 +140,11 @@ protected: bool m_bDisableCUPS; PrinterInfoManager( Type eType = Default ); - virtual ~PrinterInfoManager(); virtual void initialize(); // fill in font substitutions - // the resulting hash_map maps from source to target font ids + // the resulting boost::unordered_map maps from source to target font ids void fillFontSubstitutions( PrinterInfo& rInfo ) const; // fill default paper if not configured in config file @@ -238,8 +238,12 @@ public: // gets m_bDisableCUPS, initialized from printer config bool isCUPSDisabled() const; + + virtual ~PrinterInfoManager(); }; } // namespace #endif // _PSPRINT_PRINTERINFOMANAGER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/prntypes.hxx b/vcl/inc/vcl/prntypes.hxx index bb1911f0e5a2..13d87a94d3ac 100644 --- a/vcl/inc/vcl/prntypes.hxx +++ b/vcl/inc/vcl/prntypes.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,3 +95,5 @@ enum Orientation { ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE }; #define PRINTER_CAPABILITIES_USEPULLMODEL ((sal_uInt16)12) #endif // _SV_PRNTYPES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/ptrstyle.hxx b/vcl/inc/vcl/ptrstyle.hxx index be6991635bb7..174e590955a4 100644 --- a/vcl/inc/vcl/ptrstyle.hxx +++ b/vcl/inc/vcl/ptrstyle.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -125,18 +126,18 @@ typedef sal_uInt16 PointerStyle; #define POINTER_TEXT_VERTICAL ((PointerStyle)86) #define POINTER_PIVOT_DELETE ((PointerStyle)87) -// --> FME 2004-07-30 #i32329# Enhanced table selection +// #i32329# #define POINTER_TAB_SELECT_S ((PointerStyle)88) #define POINTER_TAB_SELECT_E ((PointerStyle)89) #define POINTER_TAB_SELECT_SE ((PointerStyle)90) #define POINTER_TAB_SELECT_W ((PointerStyle)91) #define POINTER_TAB_SELECT_SW ((PointerStyle)92) -// <-- -// --> FME 2004-08-16 #i20119# Paintbrush tool +// #i20119# #define POINTER_PAINTBRUSH ((PointerStyle)93) -// <-- #define POINTER_COUNT 94 #endif // _VCL_PTRSTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/regband.hxx b/vcl/inc/vcl/regband.hxx index e56bd7d3c564..0ebacbdb93d4 100644 --- a/vcl/inc/vcl/regband.hxx +++ b/vcl/inc/vcl/regband.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -148,3 +149,5 @@ public: }; #endif // _SV_REGBAND_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/region.hxx b/vcl/inc/vcl/region.hxx index fce105bfa8f8..f21cca472252 100755..100644 --- a/vcl/inc/vcl/region.hxx +++ b/vcl/inc/vcl/region.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -158,3 +159,5 @@ public: }; #endif // _SV_REGION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/salbtype.hxx b/vcl/inc/vcl/salbtype.hxx index be8faccdc771..111fdecda62d 100644 --- a/vcl/inc/vcl/salbtype.hxx +++ b/vcl/inc/vcl/salbtype.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -181,13 +182,11 @@ private: BitmapColor* mpBitmapColor; sal_uInt16 mnCount; -//#if 0 // _SOLAR__PRIVATE public: SAL_DLLPRIVATE inline BitmapColor* ImplGetColorBuffer() const; -//#endif // __PRIVATE public: @@ -684,13 +683,11 @@ inline BitmapColor& BitmapPalette::operator[]( sal_uInt16 nIndex ) // ------------------------------------------------------------------ -//#if 0 // _SOLAR__PRIVATE inline BitmapColor* BitmapPalette::ImplGetColorBuffer() const { DBG_ASSERT( mpBitmapColor, "No color buffer available!" ); return mpBitmapColor; } -//#endif // ------------------------------------------------------------------ inline sal_uInt16 BitmapPalette::GetBestIndex( const BitmapColor& rCol ) const @@ -898,3 +895,5 @@ inline void ColorMask::SetColorFor32Bit( const BitmapColor& rColor, HPBYTE pPixe } #endif // _SV_SALBTYPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/salctype.hxx b/vcl/inc/vcl/salctype.hxx index 1894143f78be..4b3e1e3ad772 100644 --- a/vcl/inc/vcl/salctype.hxx +++ b/vcl/inc/vcl/salctype.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,5 @@ com::sun::star::uno::Reference< com::sun::star::script::XInvocation > createBmpC } #endif // _SV_SALCTYPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/salgtype.hxx b/vcl/inc/vcl/salgtype.hxx index 5cad30aa788b..7f994f452f2c 100644 --- a/vcl/inc/vcl/salgtype.hxx +++ b/vcl/inc/vcl/salgtype.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -88,3 +89,5 @@ typedef sal_uInt16 SalInvert; #define SAL_INVERT_TRACKFRAME ((SalInvert)0x0004) #endif // _SV_SALGTYPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx index f78af4321398..af392854ee1d 100755..100644 --- a/vcl/inc/vcl/salnativewidgets.hxx +++ b/vcl/inc/vcl/salnativewidgets.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -156,26 +157,28 @@ typedef sal_uInt32 ControlType; typedef sal_uInt32 ControlPart; -#define PART_ENTIRE_CONTROL 1 -#define PART_WINDOW 5 // the static listbox window containing the list -#define PART_BUTTON 100 -#define PART_BUTTON_UP 101 +#define PART_ENTIRE_CONTROL 1 +#define PART_WINDOW 5 // the static listbox window containing the list +#define PART_BUTTON 100 +#define PART_BUTTON_UP 101 #define PART_BUTTON_DOWN 102 // Also for ComboBoxes/ListBoxes #define PART_BUTTON_LEFT 103 -#define PART_BUTTON_RIGHT 104 +#define PART_BUTTON_RIGHT 104 #define PART_ALL_BUTTONS 105 +#define PART_SEPARATOR 106 #define PART_TRACK_HORZ_LEFT 200 #define PART_TRACK_VERT_UPPER 201 #define PART_TRACK_HORZ_RIGHT 202 #define PART_TRACK_VERT_LOWER 203 #define PART_TRACK_HORZ_AREA 204 #define PART_TRACK_VERT_AREA 205 -#define PART_THUMB_HORZ 210 // Also used as toolbar grip -#define PART_THUMB_VERT 211 // Also used as toolbar grip +#define PART_THUMB_HORZ 210 // Also used as toolbar grip +#define PART_THUMB_VERT 211 // Also used as toolbar grip #define PART_MENU_ITEM 250 #define PART_MENU_ITEM_CHECK_MARK 251 #define PART_MENU_ITEM_RADIO_MARK 252 #define PART_MENU_SEPARATOR 253 +#define PART_MENU_SUBMENU_ARROW 254 /* #i77549# HACK: for scrollbars in case of thumb rect, page up and page down rect we @@ -470,3 +473,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/scopedbitmapaccess.hxx b/vcl/inc/vcl/scopedbitmapaccess.hxx new file mode 100644 index 000000000000..4247324e4463 --- /dev/null +++ b/vcl/inc/vcl/scopedbitmapaccess.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef VCL_SCOPEDBITMAPACCESS_HXX_INCLUDED +#define VCL_SCOPEDBITMAPACCESS_HXX_INCLUDED + +namespace vcl +{ + +/** This template handles BitmapAccess the RAII way. + + Please don't use directly, but through the ready-made typedefs + ScopedReadAccess and ScopedWriteAccess in classes Bitmap and + AlphaMask. + + Use as follows: + Bitmap aBitmap; + Bitmap::ScopedReadAccess pReadAccess( aBitmap ); + pReadAccess->SetPixel()... + + Bitmap aBitmap2; + Bitmap::ScopedWriteAccess pWriteAccess( bCond ? aBitmap2.AcquireWriteAccess() : 0, aBitmap2 ); + if ( pWriteAccess )... + + @attention for practical reasons, ScopedBitmapAccess stores a + reference to the provided bitmap, thus, make sure that the bitmap + specified at construction time lives at least as long as the + ScopedBitmapAccess. + */ +template < class Access, class Bitmap, Access* (Bitmap::* Acquire)() > class ScopedBitmapAccess +{ + typedef ScopedBitmapAccess< Access, Bitmap, Acquire > self_type; + typedef bool (self_type::* unspecified_bool_type)() const; + +public: + explicit ScopedBitmapAccess( Bitmap& rBitmap ) : + mpAccess( 0 ), + mrBitmap( rBitmap ) + { + mpAccess = (mrBitmap.*Acquire)(); + } + + ScopedBitmapAccess( Access* pAccess, Bitmap& rBitmap ) : + mpAccess( pAccess ), + mrBitmap( rBitmap ) + { + } + + ~ScopedBitmapAccess() + { + mrBitmap.ReleaseAccess( mpAccess ); + } + + bool operator!() const { return !mpAccess; } + operator unspecified_bool_type() const + { + return mpAccess ? &self_type::operator! : 0; + } + + Access* get() { return mpAccess; } + const Access* get() const { return mpAccess; } + + Access* operator->() { return mpAccess; } + const Access* operator->() const { return mpAccess; } + + Access& operator*() { return *mpAccess; } + const Access& operator*() const { return *mpAccess; } + +private: + Access* mpAccess; + Bitmap& mrBitmap; +}; + +} + +#endif // VCL_SCOPEDBITMAPACCESS_HXX_INCLUDED + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/scrbar.hxx b/vcl/inc/vcl/scrbar.hxx index f608ec123818..6e894bc2263b 100644 --- a/vcl/inc/vcl/scrbar.hxx +++ b/vcl/inc/vcl/scrbar.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -168,3 +169,5 @@ public: }; #endif // _SV_SCRBAR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/seleng.hxx b/vcl/inc/vcl/seleng.hxx index 0e33fa2785d2..8466df46a901 100644 --- a/vcl/inc/vcl/seleng.hxx +++ b/vcl/inc/vcl/seleng.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,6 +39,8 @@ class CommandEvent; // Timerticks #define SELENG_DRAGDROP_TIMEOUT 400 #define SELENG_AUTOREPEAT_INTERVAL 50 +#define SELENG_AUTOREPEAT_INTERVAL_MIN 25 +#define SELENG_AUTOREPEAT_INTERVAL_MAX 300 enum SelectionMode { NO_SELECTION, SINGLE_SELECTION, RANGE_SELECTION, MULTIPLE_SELECTION }; @@ -87,20 +90,20 @@ private: Timer aWTimer; // erzeugt kuenstliche Mouse-Moves MouseEvent aLastMove; SelectionMode eSelMode; + sal_uLong nUpdateInterval; // Stufigkeit fuer Mausbewegungen waehrend einer Selektion sal_uInt16 nMouseSensitivity; sal_uInt16 nLockedMods; sal_uInt16 nFlags; -//#if 0 // _SOLAR__PRIVATE DECL_DLLPRIVATE_LINK( ImpWatchDog, Timer * ); -//#endif inline sal_Bool ShouldDeselect( sal_Bool bModifierKey1 ) const; // determines to deselect or not when Ctrl-key is pressed on CursorPosChanging public: SelectionEngine( Window* pWindow, - FunctionSet* pFunctions = NULL ); + FunctionSet* pFunctions = NULL, + sal_uLong nAutoRepeatInterval = SELENG_AUTOREPEAT_INTERVAL ); ~SelectionEngine(); // sal_True: Event wurde von Selection-Engine verarbeitet. @@ -159,6 +162,8 @@ public: sal_Bool HasAnchor() const; void SetAnchor( sal_Bool bAnchor ); + void SetUpdateInterval( sal_uLong nInterval ); + // wird im Ctor eingeschaltet void ExpandSelectionOnMouseMove( sal_Bool bExpand = sal_True ) { @@ -251,3 +256,4 @@ inline void SelectionEngine::SetAnchor( sal_Bool bAnchor ) #endif // _SV_SELENG_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index 1c35d2fea930..0ade4c63f295 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -428,10 +429,13 @@ private: sal_uInt16 mnAutoMnemonic; sal_uInt16 mnUseImagesInMenus; sal_uLong mnUseFlatBorders; + sal_Bool mbPreferredUseImagesInMenus; long mnMinThumbSize; sal_uLong mnSymbolsStyle; sal_uLong mnPreferredSymbolsStyle; sal_uInt16 mnSkipDisabledInMenus; + sal_Bool mbHideDisabledMenuItems; + sal_Bool mnAcceleratorsInContextMenus; Wallpaper maWorkspaceGradient; const void* mpFontOptions; }; @@ -453,7 +457,6 @@ private: #define STYLE_OPTION_SPINARROW ((sal_uLong)0x00000080) #define STYLE_OPTION_SPINUPDOWN ((sal_uLong)0x00000100) #define STYLE_OPTION_NOMNEMONICS ((sal_uLong)0x00000200) -#define STYLE_OPTION_HIDEDISABLED ((sal_uLong)0x00100000) #define DRAGFULL_OPTION_WINDOWMOVE ((sal_uLong)0x00000001) #define DRAGFULL_OPTION_WINDOWSIZE ((sal_uLong)0x00000002) @@ -494,7 +497,12 @@ private: #define STYLE_SYMBOLS_TANGO ((sal_uLong)5) #define STYLE_SYMBOLS_OXYGEN ((sal_uLong)6) #define STYLE_SYMBOLS_CLASSIC ((sal_uLong)7) -#define STYLE_SYMBOLS_THEMES_MAX ((sal_uLong)8) +#define STYLE_SYMBOLS_HUMAN ((sal_uLong)8) +#define STYLE_SYMBOLS_THEMES_MAX ((sal_uLong)9) + +#define STYLE_MENUIMAGES_OFF ((sal_uInt16)0) +#define STYLE_MENUIMAGES_ON ((sal_uInt16)1) +#define STYLE_MENUIMAGES_AUTO ((sal_uInt16)2) #define STYLE_CURSOR_NOBLINKTIME ((sal_uLong)0xFFFFFFFF) @@ -519,6 +527,7 @@ public: Color GetSeparatorColor() const; void SetCheckedColor( const Color& rColor ) { CopyData(); mpData->maCheckedColor = rColor; } + void SetCheckedColorSpecialCase( ); const Color& GetCheckedColor() const { return mpData->maCheckedColor; } void SetLightColor( const Color& rColor ) @@ -719,12 +728,23 @@ public: { return (sal_Bool) mpData->mnUseFlatMenues; } void SetUseImagesInMenus( sal_Bool bUseImagesInMenus ) { CopyData(); mpData->mnUseImagesInMenus = bUseImagesInMenus; } - sal_Bool GetUseImagesInMenus() const - { return (sal_Bool) mpData->mnUseImagesInMenus; } - void SetSkipDisabledInMenus( sal_Bool bSkipDisabledInMenus ) + sal_Bool GetUseImagesInMenus() const; + void SetPreferredUseImagesInMenus( sal_Bool bPreferredUseImagesInMenus ) + { CopyData(); mpData->mbPreferredUseImagesInMenus = bPreferredUseImagesInMenus; } + sal_Bool GetPreferredUseImagesInMenus() const + { return mpData->mbPreferredUseImagesInMenus; } + void SetSkipDisabledInMenus( sal_Bool bSkipDisabledInMenus ) { CopyData(); mpData->mnSkipDisabledInMenus = bSkipDisabledInMenus; } sal_Bool GetSkipDisabledInMenus() const { return (sal_Bool) mpData->mnSkipDisabledInMenus; } + void SetHideDisabledMenuItems( sal_Bool bHideDisabledMenuItems ) + { CopyData(); mpData->mbHideDisabledMenuItems = bHideDisabledMenuItems; } + sal_Bool GetHideDisabledMenuItems() const + { return mpData->mbHideDisabledMenuItems; } + void SetAcceleratorsInContextMenus( sal_Bool bAcceleratorsInContextMenus ) + { CopyData(); mpData->mnAcceleratorsInContextMenus = bAcceleratorsInContextMenus; } + sal_Bool GetAcceleratorsInContextMenus() const + { return mpData->mnAcceleratorsInContextMenus; } void SetCairoFontOptions( const void *pOptions ) { CopyData(); mpData->mpFontOptions = pOptions; } @@ -837,7 +857,7 @@ public: void SetCursorBlinkTime( long nBlinkTime ) { CopyData(); mpData->mnCursorBlinkTime = nBlinkTime; } long GetCursorBlinkTime() const - { return mpData->mnCursorBlinkTime; } + { return (long) mpData->mnCursorBlinkTime; } void SetScreenZoom( sal_uInt16 nPercent ) { CopyData(); mpData->mnScreenZoom = nPercent; } @@ -1119,8 +1139,6 @@ private: LanguageType meUILanguage; LocaleDataWrapper* mpLocaleDataWrapper; LocaleDataWrapper* mpUILocaleDataWrapper; - CollatorWrapper* mpCollatorWrapper; - CollatorWrapper* mpUICollatorWrapper; vcl::I18nHelper* mpI18nHelper; vcl::I18nHelper* mpUII18nHelper; LocaleConfigurationListener* mpLocaleCfgListener; @@ -1246,3 +1264,5 @@ public: }; #endif // _SV_SETTINGS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/slider.hxx b/vcl/inc/vcl/slider.hxx index 8473170bc114..15f049555386 100644 --- a/vcl/inc/vcl/slider.hxx +++ b/vcl/inc/vcl/slider.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -130,3 +131,5 @@ public: }; #endif // _SV_SLIDER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/sndstyle.hxx b/vcl/inc/vcl/sndstyle.hxx index 01882cde56bc..170a51173726 100644 --- a/vcl/inc/vcl/sndstyle.hxx +++ b/vcl/inc/vcl/sndstyle.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,3 +45,5 @@ typedef sal_uInt16 SoundType; #define SOUND_DISABLE ((SoundType)5) #endif // _SV_SNDSTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/sallayout.h b/vcl/inc/vcl/solarmutex.hxx index 8444b5e758a9..96119d295b9d 100644 --- a/vcl/os2/inc/sallayout.h +++ b/vcl/inc/vcl/solarmutex.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,46 +25,55 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +#ifndef _VCL_SOLARMUTEX_HXX_ +#define _VCL_SOLARMUTEX_HXX_ -#ifndef _SV_SALLAYOUT_H -#define _SV_SALLAYOUT_H +#include <osl/mutex.hxx> +#include <vcl/dllapi.h> -#if 0 -#include <sv.h> -#include <sallayout.hxx> - -class ImplOs2FontEntry; +namespace vcl +{ -class Os2SalLayout : public GenericSalLayout +/** Implementation of the SolarMutex interface. + */ +class VCL_DLLPUBLIC SolarMutexObject : public osl::SolarMutex { public: - Os2SalLayout( HPS); - virtual bool LayoutText( ImplLayoutArgs& ); - virtual void AdjustLayout( ImplLayoutArgs& ); - virtual void DrawText( SalGraphics& ) const; + //static SolarMutex& SAL_CALL getGlobalMutex(); + + /** Creates mutex + */ + SolarMutexObject(); + + /** Implicitly destroys mutex + */ + virtual ~SolarMutexObject(); + + /** Blocks if Mutex is already in use + */ + virtual void SAL_CALL acquire(); + + /** Tries to get the mutex without blocking. + @return True if mutex could be obtained, otherwise False + */ + virtual sal_Bool SAL_CALL tryToAcquire(); + + /** Releases the mutex. + */ + virtual void SAL_CALL release(); protected: - HPS mhPS; - FONTMETRICS FontMetrics; - int mnBaseAdv; + oslMutex m_solarMutex; private: - int mnGlyphCount; - int mnCharCount; - sal_Unicode* mpOutGlyphs; - int* mpGlyphAdvances; // if possible this is shared with mpGlyphAdvances[] - int* mpGlyphOrigAdvs; - int* mpCharWidths; // map rel char pos to char width - int* mpChars2Glyphs; // map rel char pos to abs glyph pos - int* mpGlyphs2Chars; // map abs glyph pos to abs char pos - bool* mpGlyphRTLFlags; // BiDi status for glyphs: true=>RTL - mutable long mnWidth; - bool mbDisableGlyphs; + /* Disable copy/assignment + */ + SolarMutexObject( const SolarMutexObject& ); + SolarMutexObject& SAL_CALL operator=( const SolarMutexObject& ); +}; - int mnNotdefWidth; - BYTE mnCharSet; +} -}; -#endif +#endif // _VCL_SOLARMUTEX_HXX_ -#endif // _SV_SALLAYOUT_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/sound.hxx b/vcl/inc/vcl/sound.hxx index edab9d7d8655..1a32a27154ce 100644 --- a/vcl/inc/vcl/sound.hxx +++ b/vcl/inc/vcl/sound.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,3 +50,4 @@ public: #endif // _SV_SOUND_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/spin.h b/vcl/inc/vcl/spin.h index d81b9bf1cbc0..f7b69cbf2a16 100644 --- a/vcl/inc/vcl/spin.h +++ b/vcl/inc/vcl/spin.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,3 +50,5 @@ void ImplDrawSpinButton( OutputDevice* pOutDev, sal_Bool bHorz = sal_False, sal_Bool bMirrorHorz = sal_False ); #endif // _SV_SPIN_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/spin.hxx b/vcl/inc/vcl/spin.hxx index 9b49652fad15..02141bccd448 100644 --- a/vcl/inc/vcl/spin.hxx +++ b/vcl/inc/vcl/spin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -115,3 +116,5 @@ private: }; #endif // _SV_SPIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/spinfld.hxx b/vcl/inc/vcl/spinfld.hxx index ca81f01ac128..becfe4be426f 100644 --- a/vcl/inc/vcl/spinfld.hxx +++ b/vcl/inc/vcl/spinfld.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -113,3 +114,5 @@ public: }; #endif // _SV_SPINFLD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/split.hxx b/vcl/inc/vcl/split.hxx index 306d90acfbb1..66371c6da1a2 100644 --- a/vcl/inc/vcl/split.hxx +++ b/vcl/inc/vcl/split.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -124,3 +125,5 @@ public: }; #endif // _SV_SPLIT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/splitwin.hxx b/vcl/inc/vcl/splitwin.hxx index 4ec41438536a..ce1e74958f48 100644 --- a/vcl/inc/vcl/splitwin.hxx +++ b/vcl/inc/vcl/splitwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -278,3 +279,5 @@ public: }; #endif // _SV_SPLITWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/status.hxx b/vcl/inc/vcl/status.hxx index 97ea5c94c715..d039ddf8f203 100644 --- a/vcl/inc/vcl/status.hxx +++ b/vcl/inc/vcl/status.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,8 +32,10 @@ #include <vcl/sv.h> #include <vcl/dllapi.h> #include <vcl/window.hxx> +#include <vector> -class ImplStatusItemList; +struct ImplStatusItem; +typedef ::std::vector< ImplStatusItem* > ImplStatusItemList; // -------------------- // - Progress-Ausgabe - @@ -107,9 +110,7 @@ private: SAL_DLLPRIVATE void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ); SAL_DLLPRIVATE void ImplFormat(); SAL_DLLPRIVATE sal_Bool ImplIsItemUpdate(); -// #if 0 // _SOLAR__PRIVATE using OutputDevice::ImplDrawText; -// #endif SAL_DLLPRIVATE void ImplDrawText( sal_Bool bOffScreen, long nOldTextWidth ); SAL_DLLPRIVATE void ImplDrawItem( sal_Bool bOffScreen, sal_uInt16 nPos, sal_Bool bDrawText, sal_Bool bDrawFrame ); SAL_DLLPRIVATE void ImplDrawProgress( sal_Bool bPaint, @@ -224,3 +225,5 @@ public: }; #endif // _SV_STATUS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/stdtext.hxx b/vcl/inc/vcl/stdtext.hxx index 120246bd92f2..693a2692b010 100644 --- a/vcl/inc/vcl/stdtext.hxx +++ b/vcl/inc/vcl/stdtext.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,3 +52,5 @@ XubString VCL_DLLPUBLIC GetStandardText( sal_uInt16 nStdText ); void VCL_DLLPUBLIC ShowServiceNotAvailableError( Window* pParent, const XubString& rServiceName, sal_Bool bError ); #endif // _VCL_STDTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/strhelper.hxx b/vcl/inc/vcl/strhelper.hxx index a0837c2e7c93..450139b0ba14 100644 --- a/vcl/inc/vcl/strhelper.hxx +++ b/vcl/inc/vcl/strhelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,7 +49,7 @@ int VCL_DLLPUBLIC GetCommandLineTokenCount( const ByteString& ); String VCL_DLLPUBLIC WhitespaceToSpace( const String&, sal_Bool bProtect = sal_True ); ByteString VCL_DLLPUBLIC WhitespaceToSpace( const ByteString&, sal_Bool bProtect = sal_True ); -// returns a string with multiple adjacent occurences of whitespace +// returns a string with multiple adjacent occurrences of whitespace // converted to a single space. if bProtect is sal_True (nonzero), then // doublequote, singlequote and singleleftquote protect their respective // contents @@ -81,3 +82,5 @@ inline int VCL_DLLPUBLIC getValueOfDouble( char* pBuffer, double f, int nPrecisi } // namespace #endif // _PSPRINT_STRHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/sv.h b/vcl/inc/vcl/sv.h index 9296570a71bb..543e08caec8f 100644 --- a/vcl/inc/vcl/sv.h +++ b/vcl/inc/vcl/sv.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,3 +32,5 @@ #include <tools/solar.h> #endif // _SV_SV_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx index 88e9b0f75732..85e902161a48 100644 --- a/vcl/inc/vcl/svapp.hxx +++ b/vcl/inc/vcl/svapp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,19 +29,17 @@ #ifndef _SV_SVAPP_HXX #define _SV_SVAPP_HXX -#ifndef _VOS_THREAD_HXX -#include <vos/thread.hxx> -#endif +#include <osl/thread.hxx> +#include <osl/mutex.hxx> #include <tools/string.hxx> #include <tools/link.hxx> #include <tools/unqid.hxx> #include <vcl/sv.h> #include <vcl/dllapi.h> #include <vcl/apptypes.hxx> -#ifndef _VCL_SETTINGS_HXX #include <vcl/settings.hxx> -#endif #include <vcl/vclevent.hxx> +class BitmapEx; class Link; class AllSettings; class DataChangedEvent; @@ -57,7 +56,6 @@ class NotifyEvent; class KeyEvent; class MouseEvent; -namespace vos { class IMutex; } #include <com/sun/star/uno/Reference.h> #include <com/sun/star/connection/XConnection.hpp> @@ -245,7 +243,7 @@ public: Application(); virtual ~Application(); - virtual void Main() = 0; + virtual int Main() = 0; virtual sal_Bool QueryExit(); @@ -257,13 +255,11 @@ public: virtual void ShowStatusText( const XubString& rText ); virtual void HideStatusText(); - virtual void ShowHelpStatusText( const XubString& rText ); - virtual void HideHelpStatusText(); - virtual void FocusChanged(); virtual void DataChanged( const DataChangedEvent& rDCEvt ); virtual void Init(); + virtual void InitFinished(); virtual void DeInit(); static void InitAppRes( const ResId& rResId ); @@ -280,8 +276,8 @@ public: static void Reschedule( bool bAllEvents = false ); static void Yield( bool bAllEvents = false ); static void EndYield(); - static vos::IMutex& GetSolarMutex(); - static vos::OThread::TThreadIdentifier GetMainThreadIdentifier(); + static osl::SolarMutex& GetSolarMutex(); + static oslThreadIdentifier GetMainThreadIdentifier(); static sal_uLong ReleaseSolarMutex(); static void AcquireSolarMutex( sal_uLong nCount ); static void EnableNoYieldMode( bool i_bNoYield ); @@ -364,6 +360,7 @@ public: static void SetAppName( const String& rUniqueName ); static String GetAppName(); + static bool LoadBrandBitmap (const char* pName, BitmapEx &rBitmap); static void SetDisplayName( const UniString& rDisplayName ); static UniString GetDisplayName(); @@ -498,6 +495,151 @@ private: DECL_STATIC_LINK( Application, PostEventHandler, void* ); }; + +class VCL_DLLPUBLIC SolarMutexGuard +{ + private: + SolarMutexGuard( const SolarMutexGuard& ); + const SolarMutexGuard& operator = ( const SolarMutexGuard& ); + ::osl::SolarMutex& m_solarMutex; + + public: + + /** Acquires the object specified as parameter. + */ + SolarMutexGuard() : + m_solarMutex(Application::GetSolarMutex()) + { + m_solarMutex.acquire(); + } + + /** Releases the mutex or interface. */ + ~SolarMutexGuard() + { + m_solarMutex.release(); + } +}; + +class VCL_DLLPUBLIC SolarMutexClearableGuard +{ + SolarMutexClearableGuard( const SolarMutexClearableGuard& ); + const SolarMutexClearableGuard& operator = ( const SolarMutexClearableGuard& ); + bool m_bCleared; +public: + /** Acquires mutex + @param pMutex pointer to mutex which is to be acquired */ + SolarMutexClearableGuard() + : m_bCleared(false) + , m_solarMutex( Application::GetSolarMutex() ) + { + m_solarMutex.acquire(); + } + + /** Releases mutex. */ + virtual ~SolarMutexClearableGuard() + { + if( !m_bCleared ) + { + m_solarMutex.release(); + } + } + + /** Releases mutex. */ + void SAL_CALL clear() + { + if( !m_bCleared ) + { + m_solarMutex.release(); + m_bCleared = true; + } + } +protected: + osl::SolarMutex& m_solarMutex; +}; + +class VCL_DLLPUBLIC SolarMutexResettableGuard +{ + SolarMutexResettableGuard( const SolarMutexResettableGuard& ); + const SolarMutexResettableGuard& operator = ( const SolarMutexResettableGuard& ); + bool m_bCleared; +public: + /** Acquires mutex + @param pMutex pointer to mutex which is to be acquired */ + SolarMutexResettableGuard() + : m_bCleared(false) + , m_solarMutex( Application::GetSolarMutex() ) + { + m_solarMutex.acquire(); + } + + /** Releases mutex. */ + virtual ~SolarMutexResettableGuard() + { + if( !m_bCleared ) + { + m_solarMutex.release(); + } + } + + /** Releases mutex. */ + void SAL_CALL clear() + { + if( !m_bCleared) + { + m_solarMutex.release(); + m_bCleared = true; + } + } + /** Releases mutex. */ + void SAL_CALL reset() + { + if( m_bCleared) + { + m_solarMutex.acquire(); + m_bCleared = false; + } + } +protected: + osl::SolarMutex& m_solarMutex; +}; + + +/** + A helper class that calls Application::ReleaseSolarMutex() in its constructor + and restores the mutex in its destructor. +*/ +class SolarMutexReleaser +{ + sal_uLong mnReleased; + const bool mbRescheduleDuringAcquire; +public: + enum + { + RescheduleDuringAcquire = true + }; + SolarMutexReleaser( const bool i_rescheduleDuringAcquire = false ) + : mnReleased( Application::ReleaseSolarMutex()) + , mbRescheduleDuringAcquire( i_rescheduleDuringAcquire ) + { + } + + ~SolarMutexReleaser() + { + if ( mnReleased > 0 ) + { + if ( mbRescheduleDuringAcquire ) + { + while ( !Application::GetSolarMutex().tryToAcquire() ) + { + Application::Reschedule(); + } + --mnReleased; + } + Application::AcquireSolarMutex( mnReleased ); + } + } +}; + VCL_DLLPUBLIC Application* GetpApp(); VCL_DLLPUBLIC sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & ); @@ -515,3 +657,5 @@ inline void Application::EndYield() } #endif // _APP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/svgread.hxx b/vcl/inc/vcl/svgread.hxx index ea4388767d02..4427198eeb5a 100644 --- a/vcl/inc/vcl/svgread.hxx +++ b/vcl/inc/vcl/svgread.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -77,4 +78,6 @@ namespace vcl }; } -#endif // _SV_SVGREAD_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/vcl/inc/vcl/symbol.hxx b/vcl/inc/vcl/symbol.hxx index 1f94db084311..c03bf9a6af58 100644 --- a/vcl/inc/vcl/symbol.hxx +++ b/vcl/inc/vcl/symbol.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,3 +77,5 @@ typedef sal_uInt16 SymbolType; #define SYMBOL_NOSYMBOL (SYMBOL_DONTKNOW) #endif // _SV_SYMBOL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/syschild.hxx b/vcl/inc/vcl/syschild.hxx index b779b5d9d316..275e41312f17 100644 --- a/vcl/inc/vcl/syschild.hxx +++ b/vcl/inc/vcl/syschild.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,8 +63,8 @@ public: // per default systemchildwindows erase their background for better plugin support // however, this might not always be required void EnableEraseBackground( sal_Bool bEnable = sal_True ); - sal_Bool IsEraseBackgroundEnabled(); - + sal_Bool IsEraseBackgroundEnabled(); + void SetForwardKey( sal_Bool bEnable ); // return the platform specific handle/id of this window; // in case the flag bUseJava is set, a java compatible overlay window // is created on which other java windows can be created (plugin interface) @@ -71,3 +72,5 @@ public: }; #endif // _SV_SYSCHILD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/sysdata.hxx b/vcl/inc/vcl/sysdata.hxx index b9feeaf3a2aa..cab614841e1d 100644 --- a/vcl/inc/vcl/sysdata.hxx +++ b/vcl/inc/vcl/sysdata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,6 +41,9 @@ typedef struct CGLayer *CGLayerRef; class NSView; #endif #endif +#if defined( WNT ) +#include <windef.h> +#endif // ----------------- // - SystemEnvData - @@ -48,7 +52,7 @@ class NSView; struct SystemEnvData { unsigned long nSize; // size in bytes of this structure -#if defined( WNT ) || defined( OS2 ) +#if defined( WNT ) HWND hWnd; // the window hwnd #elif defined( QUARTZ ) NSView* pView; // the cocoa (NSView *) implementing this object @@ -76,7 +80,7 @@ struct SystemEnvData struct SystemParentData { unsigned long nSize; // size in bytes of this structure -#if defined( WNT ) || defined( OS2 ) +#if defined( WNT ) HWND hWnd; // the window hwnd #elif defined( QUARTZ ) NSView* pView; // the cocoa (NSView *) implementing this object @@ -121,7 +125,7 @@ struct SystemGraphicsData int nScreen; // the current screen of the drawable int nDepth; // depth of said visual long aColormap; // the colormap being used - void* pRenderFormat; // render format for drawable + void* pXRenderFormat; // render format for drawable #endif }; @@ -183,10 +187,11 @@ typedef std::vector<SystemGlyphData> SystemGlyphDataVector; struct SystemTextLayoutData { - unsigned long nSize; // size in bytes of this structure - std::vector<SystemGlyphData> rGlyphData; // glyph data - int orientation; // Text orientation + unsigned long nSize; // size in bytes of this structure + SystemGlyphDataVector rGlyphData; // glyph data + int orientation; // Text orientation }; #endif // _SV_SYSDATA_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx index 696a07ca3d42..0fd2fd8d1512 100644 --- a/vcl/inc/vcl/syswin.hxx +++ b/vcl/inc/vcl/syswin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -276,6 +277,10 @@ public: @see GetScreenNumber */ void SetScreenNumber( unsigned int nNewScreen ); + + void SetApplicationID( const rtl::OUString &rApplicationID ); }; #endif // _SV_SYSWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index ac0e11f3fb1d..c6525138f73b 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -92,6 +93,7 @@ private: protected: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); virtual void FillLayoutData() const; @@ -204,3 +206,5 @@ public: }; #endif // _SV_TABCTRL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/tabdlg.hxx b/vcl/inc/vcl/tabdlg.hxx index 23eb6fc142dc..0b654b409f33 100644 --- a/vcl/inc/vcl/tabdlg.hxx +++ b/vcl/inc/vcl/tabdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,3 +69,5 @@ public: }; #endif // _SV_TABDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/tabpage.hxx b/vcl/inc/vcl/tabpage.hxx index 4ed42914e655..92a00f892845 100644 --- a/vcl/inc/vcl/tabpage.hxx +++ b/vcl/inc/vcl/tabpage.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -55,8 +56,8 @@ public: virtual void ActivatePage(); virtual void DeactivatePage(); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); }; #endif // _SV_TABPAGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/taskpanelist.hxx b/vcl/inc/vcl/taskpanelist.hxx index ec1f4a016e8b..102f755554f2 100644 --- a/vcl/inc/vcl/taskpanelist.hxx +++ b/vcl/inc/vcl/taskpanelist.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,10 +41,8 @@ class VCL_DLLPUBLIC TaskPaneList Window *FindNextFloat( Window *pWindow, sal_Bool bForward = sal_True ); Window *FindNextSplitter( Window *pWindow, sal_Bool bForward = sal_True ); -//#if 0 // _SOLAR__PRIVATE public: sal_Bool IsInList( Window *pWindow ); -//#endif public: TaskPaneList(); @@ -55,3 +54,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/threadex.hxx b/vcl/inc/vcl/threadex.hxx index 1b48b5d63c9c..429b43e6ac7c 100644 --- a/vcl/inc/vcl/threadex.hxx +++ b/vcl/inc/vcl/threadex.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -286,3 +287,4 @@ inline typename FuncT::result_type syncExecute( FuncT const& func ) } // namespace solarthread } // namespace vcl +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/throbber.hxx b/vcl/inc/vcl/throbber.hxx index f86a9944e28f..ce45631d2fda 100644 --- a/vcl/inc/vcl/throbber.hxx +++ b/vcl/inc/vcl/throbber.hxx @@ -32,8 +32,6 @@ #include "vcl/imgctrl.hxx" #include "vcl/timer.hxx" -#include <vos/mutex.hxx> - #include <com/sun/star/graphic/XGraphic.hpp> #include <vector> diff --git a/vcl/inc/vcl/timer.hxx b/vcl/inc/vcl/timer.hxx index 76857f6c08c5..efc4b00924a7 100644 --- a/vcl/inc/vcl/timer.hxx +++ b/vcl/inc/vcl/timer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -87,3 +88,5 @@ public: }; #endif // _SV_TIMER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx index 9cb70aff58bd..5badbc2d13bd 100644 --- a/vcl/inc/vcl/toolbox.hxx +++ b/vcl/inc/vcl/toolbox.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -229,7 +230,6 @@ private: mbCustomize:1, mbCustomizeMode:1, mbDragging:1, - mbHideStatusText:1, mbMenuStrings:1, mbIsShift:1, mbIsKeyEvent:1, @@ -251,9 +251,7 @@ private: using Window::ImplInit; private: SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); -// #if 0 // _SOLAR__PRIVATE using DockingWindow::ImplInitSettings; -// #endif SAL_DLLPRIVATE void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); SAL_DLLPRIVATE ImplToolItem* ImplGetItem( sal_uInt16 nId ) const; @@ -262,7 +260,8 @@ private: SAL_DLLPRIVATE void ImplFormat( sal_Bool bResize = sal_False ); SAL_DLLPRIVATE void ImplDrawSpin( sal_Bool bUpperIn, sal_Bool bLowerIn ); SAL_DLLPRIVATE void ImplDrawNext( sal_Bool bIn ); - SAL_DLLPRIVATE void ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight = sal_False, sal_Bool bPaint = sal_False, sal_Bool bLayout = sal_False ); + SAL_DLLPRIVATE void ImplDrawSeparator( sal_uInt16 nPos, Rectangle rRect ); + SAL_DLLPRIVATE void ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight = 0, sal_Bool bPaint = sal_False, sal_Bool bLayout = sal_False ); using Window::ImplInvalidate; SAL_DLLPRIVATE void ImplInvalidate( sal_Bool bNewCalc = sal_False, sal_Bool bFullPaint = sal_False ); SAL_DLLPRIVATE void ImplUpdateItem( sal_uInt16 nIndex = 0xFFFF ); @@ -282,7 +281,6 @@ private: SAL_DLLPRIVATE void ImplHideFocus(); SAL_DLLPRIVATE void ImplUpdateInputEnable(); SAL_DLLPRIVATE void ImplFillLayoutData() const; - SAL_DLLPRIVATE void ImplUpdateCustomMenu(); SAL_DLLPRIVATE sal_Bool ImplHasClippedItems(); SAL_DLLPRIVATE Point ImplGetPopupPosition( const Rectangle& rRect, const Size& rSize ) const; SAL_DLLPRIVATE void ImplExecuteCustomMenu(); @@ -299,7 +297,6 @@ private: DECL_DLLPRIVATE_LINK( ImplCustomMenuListener, VclMenuEvent* ); DECL_DLLPRIVATE_LINK( ImplDropdownLongClickHdl, ToolBox* ); -//#if 0 // _SOLAR__PRIVATE // Copy assignment is forbidden and not implemented. SAL_DLLPRIVATE ToolBox (const ToolBox &); SAL_DLLPRIVATE ToolBox& operator= (const ToolBox &); @@ -341,7 +338,6 @@ public: static SAL_DLLPRIVATE void ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight ); static SAL_DLLPRIVATE sal_uInt16 ImplCountLineBreaks( const ToolBox *pThis ); SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData; } -//#endif protected: void SetCurItemId(sal_uInt16 nSet) { mnCurItemId = nSet; } @@ -602,6 +598,7 @@ public: sal_uInt16 GetMenuType() const; sal_Bool IsMenuEnabled() const; PopupMenu* GetMenu() const; + void UpdateCustomMenu(); void SetMenuButtonHdl( const Link& rLink ); const Link& GetMenuButtonHdl() const; @@ -609,7 +606,7 @@ public: void ExecuteCustomMenu(); // allow Click Handler to detect special key - sal_Bool IsShift() const { return mbIsShift; } + bool IsShift() const { return mbIsShift; } // allow Click Handler to distinguish between mouse and key input sal_Bool IsKeyEvent() const { return mbIsKeyEvent; } @@ -680,3 +677,5 @@ inline sal_uInt16 ToolBox::GetFloatingLines() const } #endif // _SV_TOOLBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/unohelp.hxx b/vcl/inc/vcl/unohelp.hxx index 5d98b6872a26..823ee477355a 100644 --- a/vcl/inc/vcl/unohelp.hxx +++ b/vcl/inc/vcl/unohelp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,18 +54,24 @@ namespace accessibility { } }}} +namespace comphelper { + namespace string { + class NaturalStringSorter; +}} + namespace vcl { namespace unohelper { - -::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > VCL_DLLPUBLIC GetMultiServiceFactory(); -::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > VCL_DLLPUBLIC CreateBreakIterator(); -::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCharacterClassification> VCL_DLLPUBLIC CreateCharacterClassification(); -::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCollator > VCL_DLLPUBLIC CreateCollator(); -::rtl::OUString VCL_DLLPUBLIC CreateLibraryName( const sal_Char* pModName, sal_Bool bSUPD ); -void VCL_DLLPUBLIC NotifyAccessibleStateEventGlobally( const ::com::sun::star::accessibility::AccessibleEventObject& rEventObject ); +VCL_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetMultiServiceFactory(); +VCL_DLLPUBLIC ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > CreateBreakIterator(); +VCL_DLLPUBLIC ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCharacterClassification> CreateCharacterClassification(); +//Get access to singleton Natural String Sorter collating for Application::GetLocale +VCL_DLLPUBLIC const comphelper::string::NaturalStringSorter& getNaturalStringSorterForAppLocale(); +VCL_DLLPUBLIC ::rtl::OUString CreateLibraryName( const sal_Char* pModName, sal_Bool bSUPD ); +VCL_DLLPUBLIC void NotifyAccessibleStateEventGlobally( const ::com::sun::star::accessibility::AccessibleEventObject& rEventObject ); }} // namespace vcl::unohelper #endif // _VCL_UNOHELP_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/unohelp2.hxx b/vcl/inc/vcl/unohelp2.hxx index e7d8d34e0595..5824f016c57c 100644 --- a/vcl/inc/vcl/unohelp2.hxx +++ b/vcl/inc/vcl/unohelp2.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -82,3 +83,4 @@ namespace vcl { namespace unohelper { #endif // _VCL_UNOHELP2_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/unowrap.hxx b/vcl/inc/vcl/unowrap.hxx index b11842aa0c6b..3691014d7477 100644 --- a/vcl/inc/vcl/unowrap.hxx +++ b/vcl/inc/vcl/unowrap.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,3 +90,5 @@ public: }; #endif // _VCL_UNOWRAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/vclenum.hxx b/vcl/inc/vcl/vclenum.hxx index dff91a111948..a833d0594f07 100644 --- a/vcl/inc/vcl/vclenum.hxx +++ b/vcl/inc/vcl/vclenum.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,6 +31,7 @@ #include <sal/types.h> #include <tools/solar.h> +#include <tools/fontenum.hxx> #ifndef ENUM_TIMEFIELDFORMAT_DECLARED #define ENUM_TIMEFIELDFORMAT_DECLARED @@ -143,143 +145,6 @@ enum RasterOp { ROP_OVERPAINT, ROP_XOR, ROP_0, ROP_1, ROP_INVERT }; // ------------------------------------------------------------ -#ifndef ENUM_FONTFAMILY_DECLARED -#define ENUM_FONTFAMILY_DECLARED - -enum FontFamily { FAMILY_DONTKNOW, FAMILY_DECORATIVE, FAMILY_MODERN, - FAMILY_ROMAN, FAMILY_SCRIPT, FAMILY_SWISS, FAMILY_SYSTEM, FontFamily_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; - -#endif - -// ------------------------------------------------------------ - -#ifndef ENUM_FONTPITCH_DECLARED -#define ENUM_FONTPITCH_DECLARED - -enum FontPitch { PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, FontPitch_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; - -#endif - -// ------------------------------------------------------------ - -#ifndef ENUM_TEXTALIGN_DECLARED -#define ENUM_TEXTALIGN_DECLARED - -enum TextAlign { ALIGN_TOP, ALIGN_BASELINE, ALIGN_BOTTOM, TextAlign_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; - -#endif - -// ------------------------------------------------------------ - -#ifndef ENUM_FONTWEIGHT_DECLARED -#define ENUM_FONTWEIGHT_DECLARED - -enum FontWeight { WEIGHT_DONTKNOW, WEIGHT_THIN, WEIGHT_ULTRALIGHT, - WEIGHT_LIGHT, WEIGHT_SEMILIGHT, WEIGHT_NORMAL, - WEIGHT_MEDIUM, WEIGHT_SEMIBOLD, WEIGHT_BOLD, - WEIGHT_ULTRABOLD, WEIGHT_BLACK, FontWeight_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; - -#endif - -// ------------------------------------------------------------ - -#ifndef ENUM_FONTWIDTH_DECLARED -#define ENUM_FONTWIDTH_DECLARED - -enum FontWidth { WIDTH_DONTKNOW, WIDTH_ULTRA_CONDENSED, WIDTH_EXTRA_CONDENSED, - WIDTH_CONDENSED, WIDTH_SEMI_CONDENSED, WIDTH_NORMAL, - WIDTH_SEMI_EXPANDED, WIDTH_EXPANDED, WIDTH_EXTRA_EXPANDED, - WIDTH_ULTRA_EXPANDED, - FontWidth_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; - -#endif - -// ------------------------------------------------------------ - -#ifndef ENUM_FONTITALIC_DECLARED -#define ENUM_FONTITALIC_DECLARED - -enum FontItalic { ITALIC_NONE, ITALIC_OBLIQUE, ITALIC_NORMAL, ITALIC_DONTKNOW, FontItalic_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; - -#endif - -// ------------------------------------------------------------ - -#ifndef ENUM_FONTUNDERLINE_DECLARED -#define ENUM_FONTUNDERLINE_DECLARED - -enum FontUnderline { UNDERLINE_NONE, UNDERLINE_SINGLE, UNDERLINE_DOUBLE, - UNDERLINE_DOTTED, UNDERLINE_DONTKNOW, - UNDERLINE_DASH, UNDERLINE_LONGDASH, - UNDERLINE_DASHDOT, UNDERLINE_DASHDOTDOT, - UNDERLINE_SMALLWAVE, - UNDERLINE_WAVE, UNDERLINE_DOUBLEWAVE, - UNDERLINE_BOLD, UNDERLINE_BOLDDOTTED, - UNDERLINE_BOLDDASH, UNDERLINE_BOLDLONGDASH, - UNDERLINE_BOLDDASHDOT, UNDERLINE_BOLDDASHDOTDOT, - UNDERLINE_BOLDWAVE, - FontUnderline_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; - -#endif - -// ------------------------------------------------------------ - -#ifndef ENUM_FONTSTRIKEOUT_DECLARED -#define ENUM_FONTSTRIKEOUT_DECLARED - -enum FontStrikeout { STRIKEOUT_NONE, STRIKEOUT_SINGLE, STRIKEOUT_DOUBLE, - STRIKEOUT_DONTKNOW, STRIKEOUT_BOLD, - STRIKEOUT_SLASH, STRIKEOUT_X, - FontStrikeout_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; - -#endif - -// ------------------------------------------------------------ - -#ifndef ENUM_FONTEMPHASISMARK_DECLARED -#define ENUM_FONTEMPHASISMARK_DECLARED - -typedef sal_uInt16 FontEmphasisMark; -#define EMPHASISMARK_NONE ((FontEmphasisMark)0x0000) -#define EMPHASISMARK_DOT ((FontEmphasisMark)0x0001) -#define EMPHASISMARK_CIRCLE ((FontEmphasisMark)0x0002) -#define EMPHASISMARK_DISC ((FontEmphasisMark)0x0003) -#define EMPHASISMARK_ACCENT ((FontEmphasisMark)0x0004) -#define EMPHASISMARK_STYLE ((FontEmphasisMark)0x00FF) -#define EMPHASISMARK_POS_ABOVE ((FontEmphasisMark)0x1000) -#define EMPHASISMARK_POS_BELOW ((FontEmphasisMark)0x2000) - -// Only for kompability -#define EMPHASISMARK_DOTS_ABOVE (EMPHASISMARK_DOT | EMPHASISMARK_POS_ABOVE) -#define EMPHASISMARK_DOTS_BELOW (EMPHASISMARK_DOT | EMPHASISMARK_POS_BELOW) -#define EMPHASISMARK_SIDE_DOTS (EMPHASISMARK_ACCENT | EMPHASISMARK_POS_ABOVE) -#define EMPHASISMARK_CIRCLE_ABOVE (EMPHASISMARK_CIRCLE | EMPHASISMARK_POS_ABOVE) - -#endif - -// ------------------------------------------------------------ - -#ifndef ENUM_FONTTYPE_DECLARED -#define ENUM_FONTTYPE_DECLARED - -enum FontType { TYPE_DONTKNOW, TYPE_RASTER, TYPE_VECTOR, TYPE_SCALABLE, - FontType_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; - -#endif - -#ifndef ENUM_FONTEMBEDDEDBITMAP_DECLARED -#define ENUM_FONTEMBEDDEDBITMAP_DECLARED - -enum FontEmbeddedBitmap { EMBEDDEDBITMAP_DONTKNOW, EMBEDDEDBITMAP_FALSE, EMBEDDEDBITMAP_TRUE }; - -#endif - -#ifndef ENUM_FONTANTIALIAS_DECLARED -#define ENUM_FONTANTIALIAS_DECLARED - -enum FontAntiAlias { ANTIALIAS_DONTKNOW, ANTIALIAS_FALSE, ANTIALIAS_TRUE }; - -#endif #ifndef ENUM_FONTAUTOHINT_DECLARED #define ENUM_FONTAUTOHINT_DECLARED @@ -326,3 +191,5 @@ enum OutDevSupportType { OutDevSupport_TransparentRect, OutDevSupport_B2DClip, O #endif #endif // _VCL_VCLENUM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx index d6f8af298593..51c5591f09f7 100644 --- a/vcl/inc/vcl/vclevent.hxx +++ b/vcl/inc/vcl/vclevent.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -153,10 +154,9 @@ namespace com { namespace sun { namespace star { #define VCLEVENT_ROADMAP_ITEMSELECTED 1171 #define VCLEVENT_TOOLBOX_FORMATCHANGED 1172 // request new layout #define VCLEVENT_COMBOBOX_SETTEXT 1173 -// --> OD 2009-04-01 #i92103# +// #i92103# #define VCLEVENT_ITEM_EXPANDED 1174 #define VCLEVENT_ITEM_COLLAPSED 1175 -// <-- #define VCLEVENT_DROPDOWN_PRE_OPEN 1176 // VclMenuEvent @@ -259,7 +259,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible; }; -class VCL_DLLPUBLIC VclEventListeners : public std::list<Link> +class VCL_DLLPUBLIC VclEventListeners { public: void Call( VclSimpleEvent* pEvent ) const; @@ -268,6 +268,10 @@ public: // and returns sal_True in that case // a handler must return sal_True to signal that it has processed the event sal_Bool Process( VclSimpleEvent* pEvent ) const; + void addListener( const Link& rListener ); + void removeListener( const Link& rListener ); +private: + std::list<Link> m_aListeners; }; class VCL_DLLPUBLIC VclEventListeners2 : public vcl::DeletionNotifier @@ -299,3 +303,5 @@ public: }; #endif // _VCL_VCLEVENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/virdev.hxx b/vcl/inc/vcl/virdev.hxx index c1cee4f58c95..79b8233cf964 100644 --- a/vcl/inc/vcl/virdev.hxx +++ b/vcl/inc/vcl/virdev.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -127,3 +128,5 @@ private: }; #endif // _SV_VIRDEV_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/waitobj.hxx b/vcl/inc/vcl/waitobj.hxx index 1dcd42d8bcf9..1bbdd04506e9 100644 --- a/vcl/inc/vcl/waitobj.hxx +++ b/vcl/inc/vcl/waitobj.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,3 +52,5 @@ public: }; #endif // _SV_WAITOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/wall.hxx b/vcl/inc/vcl/wall.hxx index 133aa39525a8..66a2a11038ed 100644 --- a/vcl/inc/vcl/wall.hxx +++ b/vcl/inc/vcl/wall.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -92,10 +93,9 @@ private: SAL_DLLPRIVATE void ImplMakeUnique( sal_Bool bReleaseCache = sal_True ); SAL_DLLPRIVATE Gradient ImplGetApplicationGradient() const; -//#if 0 // _SOLAR__PRIVATE public: SAL_DLLPRIVATE ImplWallpaper* ImplGetImpWallpaper() const { return mpImplWallpaper; } -//#endif + public: Wallpaper(); @@ -141,3 +141,5 @@ public: }; #endif // _SV_WALL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index f367be85051d..df82b7870854 100755..100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,19 +33,13 @@ #include <vcl/dllapi.h> #include <vcl/outdev.hxx> #include <tools/resid.hxx> -#ifndef _SV_POINTR_HXX #include <vcl/pointr.hxx> -#endif #include <tools/wintypes.hxx> -#ifndef _SV_APPTYPES_HXX #include <vcl/apptypes.hxx> -#endif #include <vcl/inputctx.hxx> #include <vcl/vclevent.hxx> // Only for compatibility - because many people outside haven't included event.hxx -#ifndef _VCL_EVENT_HXX #include <vcl/event.hxx> -#endif #include <vcl/region.hxx> #include <vcl/salnativewidgets.hxx> #include <rtl/ustring.hxx> @@ -190,9 +185,7 @@ namespace svt { class PopupWindowControllerImpl; } #define TOTOP_RESTOREWHENMIN ((sal_uInt16)0x0001) #define TOTOP_FOREGROUNDTASK ((sal_uInt16)0x0002) #define TOTOP_NOGRABFOCUS ((sal_uInt16)0x0004) -//#if 0 // _SOLAR__PRIVATE // vcl internal only #define TOTOP_GRABFOCUSONLY ((sal_uInt16)0x0008) -//#endif // Flags for Invalidate #define INVALIDATE_CHILDREN ((sal_uInt16)0x0001) @@ -317,7 +310,6 @@ typedef sal_uInt16 StateChangedType; #define EXTTEXTINPUT_END_COMPLETE ((sal_uInt16)0x0001) #define EXTTEXTINPUT_END_CANCEL ((sal_uInt16)0x0002) -//#if 0 // _SOLAR__PRIVATE #define IMPL_MINSIZE_BUTTON_WIDTH 70 #define IMPL_MINSIZE_BUTTON_HEIGHT 22 #define IMPL_EXTRA_BUTTON_WIDTH 18 @@ -335,7 +327,6 @@ typedef sal_uInt16 StateChangedType; #define DLGWINDOW_PREV 0 #define DLGWINDOW_NEXT 1 #define DLGWINDOW_FIRST 2 -//#endif enum WindowSizeType { WINDOWSIZE_MINIMUM, @@ -727,7 +718,6 @@ public: void SetZoomedPointFont( const Font& rFont ); long GetDrawPixel( OutputDevice* pDev, long nPixels ) const; Font GetDrawPixelFont( OutputDevice* pDev ) const; - void GetFontResolution( sal_Int32& nDPIX, sal_Int32& nDPIY ) const; void SetControlFont(); void SetControlFont( const Font& rFont ); @@ -989,9 +979,7 @@ public: void SetData( void* pNewData ); void* GetData() const; - // Should be merged in the next top level build !!! - Bitmap SnapShot( sal_Bool bBorder ) const; - Bitmap SnapShot() const; + Bitmap SnapShot( sal_Bool bBorder = sal_True ) const; void ShowFocus( const Rectangle& rRect ); void HideFocus(); @@ -1125,6 +1113,22 @@ public: */ void doLazyDelete(); + //------------------------------------- + // Keyboard access functions + //------------------------------------- + + /** Query the states of keyboard indicators - Caps Lock, Num Lock and + Scroll Lock. Use the following mask to retrieve the state of each + indicator: + + INDICATOR_CAPS_LOCK + INDICATOR_NUM_LOCK + INDICATOR_SCROLL_LOCK + */ + sal_uInt16 GetIndicatorState() const; + + void SimulateKeyPress( sal_uInt16 nKeyCode ) const; + // let the window intercept the KeyDown messages of the system children void InterceptChildWindowKeyDown( sal_Bool bIntercept ); @@ -1179,8 +1183,9 @@ public: /* */ virtual void setProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& ); - }; #endif // _SV_WINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/wpropset.hxx b/vcl/inc/vcl/wpropset.hxx index 409b629496e6..ac0f98fd3525 100644 --- a/vcl/inc/vcl/wpropset.hxx +++ b/vcl/inc/vcl/wpropset.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -64,3 +65,5 @@ namespace vcl } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/wrkwin.hxx b/vcl/inc/vcl/wrkwin.hxx index 863b84131a79..c58f6971ffc0 100644 --- a/vcl/inc/vcl/wrkwin.hxx +++ b/vcl/inc/vcl/wrkwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -106,3 +107,5 @@ public: }; #endif // _SV_WRKWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vclpluginapi.h b/vcl/inc/vclpluginapi.h index 3fe781a7bb97..462943b95401 100644 --- a/vcl/inc/vclpluginapi.h +++ b/vcl/inc/vclpluginapi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,3 +69,5 @@ #endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/wall2.hxx b/vcl/inc/wall2.hxx index 12ef95e017d7..162614262095 100644 --- a/vcl/inc/wall2.hxx +++ b/vcl/inc/wall2.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,3 +59,5 @@ public: #endif // _SV_WALL2_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h index 8ef8e9fd9f6e..5cf92bcf3591 100755 --- a/vcl/inc/win/salbmp.h +++ b/vcl/inc/win/salbmp.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,6 +74,9 @@ public: virtual bool Create( const SalBitmap& rSalBmpImpl ); virtual bool Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics ); virtual bool Create( const SalBitmap& rSalBmpImpl, sal_uInt16 nNewBitCount ); + virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, + Size& rSize, + bool bMask = false ); virtual void Destroy(); @@ -85,3 +89,5 @@ public: }; #endif // _SV_SALBMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx index 6c040993c76e..ca0a19f4361a 100755..100644 --- a/vcl/inc/win/saldata.hxx +++ b/vcl/inc/win/saldata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -141,7 +142,7 @@ public: ULONG_PTR gdiplusToken; std::set< HMENU > mhMenuSet; // keeps track of menu handles created by VCL, used by IsKnownMenuHandle() - std::map< UINT,USHORT > maVKMap; // map some dynamic VK_* entries + std::map< UINT,sal_uInt16 > maVKMap; // map some dynamic VK_* entries oslModule maDwmLib; DwmIsCompositionEnabled_ptr mpDwmIsCompositionEnabled; }; @@ -160,8 +161,6 @@ struct SalShlData UINT mnWheelScrollLines; // WheelScrollLines UINT mnWheelScrollChars; // WheelScrollChars UINT mnWheelMsgId; // Wheel-Message-Id fuer W95 - WORD mnVersion; // System-Version (311 == 3.11) - BOOL mbW40; // Is System-Version >= 4.0 BOOL mbWXP; // Windows XP BOOL mbWPrinter; // true: use unicode printer functions // false: use anis compat printer functions @@ -348,8 +347,6 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 ); // ----------------- // A/W-Wrapper -LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong ); -LONG ImplGetWindowLong( HWND hWnd, int nIndex ); BOOL ImplPostMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ); BOOL ImplSendMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ); BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax ); @@ -358,22 +355,24 @@ LONG ImplDispatchMessage( CONST MSG *lpMsg ); inline void SetWindowPtr( HWND hWnd, WinSalFrame* pThis ) { - ImplSetWindowLong( hWnd, SAL_FRAME_THIS, (LONG)pThis ); + SetWindowLongPtr( hWnd, SAL_FRAME_THIS, (LONG_PTR)pThis ); } inline WinSalFrame* GetWindowPtr( HWND hWnd ) { - return (WinSalFrame*)ImplGetWindowLong( hWnd, SAL_FRAME_THIS ); + return (WinSalFrame*)GetWindowLongPtrW( hWnd, SAL_FRAME_THIS ); } inline void SetSalObjWindowPtr( HWND hWnd, WinSalObject* pThis ) { - ImplSetWindowLong( hWnd, SAL_OBJECT_THIS, (LONG)pThis ); + SetWindowLongPtr( hWnd, SAL_OBJECT_THIS, (LONG_PTR)pThis ); } inline WinSalObject* GetSalObjWindowPtr( HWND hWnd ) { - return (WinSalObject*)ImplGetWindowLong( hWnd, SAL_OBJECT_THIS ); + return (WinSalObject*)GetWindowLongPtr( hWnd, SAL_OBJECT_THIS ); } #endif // _SV_SALDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h index 71786924d097..e62d60196a1e 100755 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -134,10 +135,13 @@ public: virtual void Beep( SoundType eSoundType ); virtual const SystemEnvData* GetSystemData() const; virtual SalPointerState GetPointerState(); + virtual SalIndicatorState GetIndicatorState(); + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ); virtual void SetParent( SalFrame* pNewParent ); virtual bool SetPluginParent( SystemParentData* pNewParent ); virtual void SetBackgroundBitmap( SalBitmap* ); virtual void SetScreenNumber( unsigned int ); + virtual void SetApplicationID( const rtl::OUString &rApplicationID ); virtual void ResetClipRegion(); virtual void BeginSetClipRegion( sal_uIntPtr nRects ); virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); @@ -147,3 +151,5 @@ public: void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ); #endif // _SV_SALFRAME_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 52ac23b45a48..fd21114a648c 100755..100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,14 @@ #include <salgdi.hxx> #include <outfont.hxx> #include <impfont.hxx> +#include <vcl/fontcapabilities.hxx> #include "boost/scoped_ptr.hpp" -#include <hash_set> +#include <boost/unordered_set.hpp> + +#ifdef ENABLE_GRAPHITE +#include <graphite2/Font.h> +#endif class ImplFontSelectData; class ImplWinFontEntry; @@ -52,6 +58,26 @@ class ImplFontAttrCache; #define GCP_KERN_HACK #define GNG_VERT_HACK +#ifdef ENABLE_GRAPHITE +class RawFontData; +class GrFontData +{ +public: + GrFontData(HDC hDC); + ~GrFontData(); + const void * getTable(unsigned int name, size_t *len) const; + const gr_face * getFace() const { return mpFace; } + void AddReference() { ++mnRefCount; } + void DeReference() { if (--mnRefCount == 0) delete this; } +private: + GrFontData(GrFontData &) {}; + HDC mhDC; + mutable std::vector<RawFontData*> mvData; + gr_face * mpFace; + unsigned int mnRefCount; +}; +#endif + // win32 specific physically available font face class ImplWinFontData : public ImplFontData { @@ -79,9 +105,11 @@ public: bool AliasSymbolsLow() const { return mbAliasSymbolsLow; } #ifdef ENABLE_GRAPHITE bool SupportsGraphite() const { return mbHasGraphiteSupport; } + const gr_face* GraphiteFace() const; #endif const ImplFontCharMap* GetImplFontCharMap() const; + bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; const Ucs2SIntMap* GetEncodingVector() const { return mpEncodingVector; } void SetEncodingVector( const Ucs2SIntMap* pNewVec ) const { @@ -97,11 +125,14 @@ private: mutable bool mbHasKoreanRange; mutable bool mbHasCJKSupport; #ifdef ENABLE_GRAPHITE + mutable GrFontData* mpGraphiteData; mutable bool mbHasGraphiteSupport; #endif mutable bool mbHasArabicSupport; + mutable bool mbFontCapabilitiesRead; mutable ImplFontCharMap* mpUnicodeMap; mutable const Ucs2SIntMap* mpEncodingVector; + mutable vcl::FontCapabilities maFontCapabilities; // TODO: get rid of the members below needed to work with the Win9x non-unicode API BYTE* mpFontCharSets; // all Charsets for the current font (used on W98 for kerning) @@ -112,12 +143,12 @@ private: bool mbAliasSymbolsLow; private: void ReadCmapTable( HDC ) const; - void ReadOs2Table( HDC ) const; + void GetFontCapabilities( HDC hDC ) const; #ifdef GNG_VERT_HACK void ReadGsubTable( HDC ) const; - typedef std::hash_set<sal_UCS4> UcsHashSet; + typedef boost::unordered_set<sal_UCS4> UcsHashSet; mutable UcsHashSet maGsubTable; mutable bool mbGsubRead; public: @@ -138,7 +169,8 @@ public: HFONT mhFonts[ MAX_FALLBACK ]; // Font + Fallbacks const ImplWinFontData* mpWinFontData[ MAX_FALLBACK ]; // pointer to the most recent font face ImplWinFontEntry* mpWinFontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance - float mfFontScale; // allows metrics emulation of huge font sizes + float mfFontScale[ MAX_FALLBACK ]; // allows metrics emulation of huge font sizes + float mfCurrentFontScale; HPEN mhPen; // Pen HBRUSH mhBrush; // Brush HRGN mhRegion; // Region Handle @@ -246,7 +278,7 @@ public: // get device resolution virtual void GetResolution( long& rDPIX, long& rDPIY ); // get the depth of the device - virtual sal_uInt16 GetBitCount(); + virtual sal_uInt16 GetBitCount() const; // get the width of the device virtual long GetGraphicsWidth() const; @@ -279,6 +311,8 @@ public: virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ); // get the repertoire of the current font virtual const ImplFontCharMap* GetImplFontCharMap() const; + // get the layout capabilities of the current font + virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rGetFontCapabilities) const; // graphics must fill supplied font list virtual void GetDevFontList( ImplDevFontList* ); // graphics should call ImplAddDevFontSubstitute on supplied @@ -335,8 +369,8 @@ public: Ucs2UIntMap& rUnicodeEnc ); virtual int GetMinKashidaWidth(); - virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual sal_Bool GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); + virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); + virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); @@ -395,3 +429,4 @@ inline bool ImplWinFontData::HasChar( sal_uInt32 cChar ) const #endif // _SV_SALGDI_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h index 0c3580509654..04ea296e13d4 100755..100644 --- a/vcl/inc/win/salinst.h +++ b/vcl/inc/win/salinst.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,8 +31,6 @@ #include <salinst.hxx> -namespace vos { class OMutex; } - // ------------------- // - SalInstanceData - // ------------------- @@ -44,7 +43,7 @@ public: HINSTANCE mhInst; // Instance Handle HWND mhComWnd; // window, for communication (between threads and the main thread) SalYieldMutex* mpSalYieldMutex; // Sal-Yield-Mutex - vos::OMutex* mpSalWaitMutex; // Sal-Wait-Mutex + osl::Mutex* mpSalWaitMutex; // Sal-Wait-Mutex sal_uInt16 mnYieldWaitCount; // Wait-Count public: WinSalInstance(); @@ -73,7 +72,7 @@ public: virtual SalI18NImeStatus* CreateI18NImeStatus(); virtual SalSystem* CreateSalSystem(); virtual SalBitmap* CreateSalBitmap(); - virtual vos::IMutex* GetYieldMutex(); + virtual osl::SolarMutex* GetYieldMutex(); virtual sal_uIntPtr ReleaseYieldMutex(); virtual void AcquireYieldMutex( sal_uIntPtr nCount ); virtual bool CheckYieldMutex(); @@ -102,3 +101,5 @@ void ImplSalStartTimer( sal_uIntPtr nMS, sal_Bool bMutex = sal_False ); void ImplSalPrinterAbortJobAsync( HDC hPrnDC ); #endif // _SV_SALINST_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salmenu.h b/vcl/inc/win/salmenu.h index 686c6c406aeb..99239d7b8191 100755 --- a/vcl/inc/win/salmenu.h +++ b/vcl/inc/win/salmenu.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -74,3 +75,4 @@ public: #endif // _SV_SALMENU_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salnativewidgets.h b/vcl/inc/win/salnativewidgets.h index 772e0cc5b036..33ba8de4ba87 100755 --- a/vcl/inc/win/salnativewidgets.h +++ b/vcl/inc/win/salnativewidgets.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,3 +51,5 @@ class SalControlHandleData #endif /* __cplusplus */ #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salobj.h b/vcl/inc/win/salobj.h index 57ed83ee8e6b..068d65a611f2 100755 --- a/vcl/inc/win/salobj.h +++ b/vcl/inc/win/salobj.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,3 +69,5 @@ public: }; #endif // _SV_SALOBJ_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h index 538fc8ea18e3..6b399f99f971 100755 --- a/vcl/inc/win/salprn.h +++ b/vcl/inc/win/salprn.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -127,3 +128,5 @@ public: }; #endif // _SV_SALPRN_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h index af0019c47615..6f133b57d15f 100755 --- a/vcl/inc/win/salsys.h +++ b/vcl/inc/win/salsys.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -90,3 +91,4 @@ public: #endif // _SV_SALSYS_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/saltimer.h b/vcl/inc/win/saltimer.h index f04c9bf3104a..d408e099eaaf 100755 --- a/vcl/inc/win/saltimer.h +++ b/vcl/inc/win/saltimer.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,3 +43,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salvd.h b/vcl/inc/win/salvd.h index 14632bccf649..0f213ed5a6f3 100755 --- a/vcl/inc/win/salvd.h +++ b/vcl/inc/win/salvd.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,3 +59,5 @@ public: }; #endif // _SV_SALVD_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/svsys.h b/vcl/inc/win/svsys.h index 7b0e87304d59..f7bc87b0c514 100644 --- a/vcl/inc/win/svsys.h +++ b/vcl/inc/win/svsys.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +29,11 @@ #ifndef _SV_SVSYS_H #define _SV_SVSYS_H -#include <tools/svwin.h> +#ifdef WNT +#include <prewin.h> +#include <postwin.h> +#endif #endif // _SV_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/wincomp.hxx b/vcl/inc/win/wincomp.hxx index 2eabc23c8f48..6e20eb8e16e5 100755 --- a/vcl/inc/win/wincomp.hxx +++ b/vcl/inc/win/wincomp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #ifndef _SV_WINCOMP_HXX #define _SV_WINCOMP_HXX -#ifndef _STRING_H #include <string.h> -#endif // ---------- // - Strict - @@ -150,37 +149,37 @@ inline HFONT GetWindowFont( HWND hWnd ) inline void SetClassCursor( HWND hWnd, HCURSOR hCursor ) { - SetClassLong( hWnd, GCL_HCURSOR, (DWORD)hCursor ); + SetClassLongPtr( hWnd, GCLP_HCURSOR, (LONG_PTR)hCursor ); } inline HCURSOR GetClassCursor( HWND hWnd ) { - return (HCURSOR)GetClassLong( hWnd, GCL_HCURSOR ); + return (HCURSOR)GetClassLongPtr( hWnd, GCLP_HCURSOR ); } inline void SetClassIcon( HWND hWnd, HICON hIcon ) { - SetClassLong( hWnd, GCL_HICON, (DWORD)hIcon ); + SetClassLongPtr( hWnd, GCLP_HICON, (LONG_PTR)hIcon ); } inline HICON GetClassIcon( HWND hWnd ) { - return (HICON)GetClassLong( hWnd, GCL_HICON ); + return (HICON)GetClassLongPtr( hWnd, GCLP_HICON ); } inline HBRUSH SetClassBrush( HWND hWnd, HBRUSH hBrush ) { - return (HBRUSH)SetClassLong( hWnd, GCL_HBRBACKGROUND, (DWORD)hBrush ); + return (HBRUSH)SetClassLongPtr( hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)hBrush ); } inline HBRUSH GetClassBrush( HWND hWnd ) { - return (HBRUSH)GetClassLong( hWnd, GCL_HBRBACKGROUND ); + return (HBRUSH)GetClassLongPtr( hWnd, GCLP_HBRBACKGROUND ); } inline HINSTANCE GetWindowInstance( HWND hWnd ) { - return (HINSTANCE)GetWindowLong( hWnd, GWL_HINSTANCE ); + return (HINSTANCE)GetWindowLongPtr( hWnd, GWLP_HINSTANCE ); } // ------------------------ @@ -261,3 +260,5 @@ typedef int (APIENTRY* SysAgt_Enable_PROC)( int ); #endif #endif // _SV_WINCOMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 4011584890cf..12f6eedc2906 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -401,3 +402,5 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight ); #endif // _SV_WINDOW_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/xconnection.hxx b/vcl/inc/xconnection.hxx index d43e02941cb3..bd3270fa24c7 100644 --- a/vcl/inc/xconnection.hxx +++ b/vcl/inc/xconnection.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,3 +72,5 @@ namespace vcl { } #endif // _VCL_XCONNECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/howto.txt b/vcl/os2/howto.txt deleted file mode 100644 index 8711e8ea3b09..000000000000 --- a/vcl/os2/howto.txt +++ /dev/null @@ -1,13 +0,0 @@ - -VCL positioning - -Window coordinates are parent relative, with exception of maState fields, they -have screen coordinates. - -Every window has a parent window, usually the client area of an existing window, -otherwise the desktop window. - -When a window is to be sized/moved, SetPosSize is called. -Since coordinates are the position/size of client area, we need to calculate -current window frame size/position and map to screen coordinates using the -owner window position as offset. diff --git a/vcl/os2/inc/salbmp.h b/vcl/os2/inc/salbmp.h deleted file mode 100644 index 14e51ffae8da..000000000000 --- a/vcl/os2/inc/salbmp.h +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALBMP_H -#define _SV_SALBMP_H - -#include <tools/gen.hxx> -#include <vcl/sv.h> -#include <vcl/salbmp.hxx> - -// -------------- -// - SalBitmap - -// -------------- - -struct BitmapBuffer; -class BitmapColor; -class BitmapPalette; -class SalGraphics; - -#define HANDLE ULONG -#define HBITMAP ULONG - -class Os2SalBitmap : public SalBitmap -{ -private: - - Size maSize; - HANDLE mhDIB; - HANDLE mhDIB1Subst; - HBITMAP mhDDB; - USHORT mnBitCount; - -public: - - HANDLE ImplGethDIB() const { return mhDIB; } - HBITMAP ImplGethDDB() const { return mhDDB; } - HANDLE ImplGethDIB1Subst() const { return mhDIB1Subst; } - - void ImplReplacehDIB1Subst( HANDLE hDIB1Subst ); - - static HANDLE ImplCreateDIB( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); - static HANDLE ImplCreateDIB4FromDIB1( HANDLE hDIB1 ); - static HANDLE ImplCopyDIBOrDDB( HANDLE hHdl, BOOL bDIB ); - static USHORT ImplGetDIBColorCount( HANDLE hDIB ); - static void ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf, - const Size& rSizePixel, BOOL bRLE4 ); - - //BOOL Create( HANDLE hBitmap, BOOL bDIB, BOOL bCopyHandle ); - -public: - - Os2SalBitmap(); - ~Os2SalBitmap(); - -public: - - //BOOL Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); - //BOOL Create( const SalBitmap& rSalBmpImpl ); - //BOOL Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics ); - //BOOL Create( const SalBitmap& rSalBmpImpl, USHORT nNewBitCount ); - - //void Destroy(); - - //Size GetSize() const { return maSize; } - //USHORT GetBitCount() const { return mnBitCount; } - - //BitmapBuffer* AcquireBuffer( bool bReadOnly ); - //void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); - bool Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle ); - virtual bool Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); - virtual bool Create( const SalBitmap& rSalBmpImpl ); - virtual bool Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics ); - virtual bool Create( const SalBitmap& rSalBmpImpl, USHORT nNewBitCount ); - - virtual void Destroy(); - - virtual Size GetSize() const { return maSize; } - virtual USHORT GetBitCount() const { return mnBitCount; } - - virtual BitmapBuffer* AcquireBuffer( bool bReadOnly ); - virtual void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); - virtual bool GetSystemData( BitmapSystemData& rData ); -}; - -#endif // _SV_SALBMP_H diff --git a/vcl/os2/inc/saldata.hxx b/vcl/os2/inc/saldata.hxx deleted file mode 100644 index cf536a58d8dd..000000000000 --- a/vcl/os2/inc/saldata.hxx +++ /dev/null @@ -1,307 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALDATA_HXX -#define _SV_SALDATA_HXX - -#include <vcl/sv.h> -#include <vcl/svdata.hxx> -#include <vcl/salwtype.hxx> - -class Os2SalInstance; -class Os2SalFrame; -class Os2SalObject; - -extern "C" int debug_printf(const char *f, ...); - -// -------------- -// - SalIMEData - -// -------------- - -// YD FIXME #define ENABLE_IME - -#ifdef ENABLE_IME - -struct SalIMEData; - -#ifdef OS2IM_INCLUDED - -typedef APIRET (APIENTRY ImAssociateInstanceFunc)( HWND hwnd, HIMI himi, PHIMI phimiPrev ); -typedef APIRET (APIENTRY ImGetInstanceFunc)( HWND hwnd, PHIMI phimi ); -typedef APIRET (APIENTRY ImReleaseInstanceFunc)( HWND hwnd, HIMI himi ); -typedef APIRET (APIENTRY ImSetConversionFontFunc)( HIMI himi, PFATTRS pFontAttrs ); -typedef APIRET (APIENTRY ImSetConversionFontSizeFunc)( HIMI himi, PSIZEF psizfxBox ); -typedef APIRET (APIENTRY ImGetConversionStringFunc)( HIMI himi, ULONG ulIndex, PVOID pBuf, PULONG pulBufLen ); -typedef APIRET (APIENTRY ImGetResultStringFunc)( HIMI himi, ULONG ulIndex, PVOID pBuf, PULONG pulBufLen ); -typedef APIRET (APIENTRY ImSetCandidateWindowPosFunc)( HIMI himi, PCANDIDATEPOS pCandidatePos ); -typedef APIRET (APIENTRY ImQueryIMEPropertyFunc)( HIMI himi, ULONG ulIndex, PULONG pulProp ); -typedef APIRET (APIENTRY ImRequestIMEFunc)( HIMI himi, ULONG ulAction, ULONG ulIndex, ULONG ulValue ); -typedef APIRET (APIENTRY ImSetIMModeFunc)( HIMI himi, ULONG ulInputMode, ULONG ulConversionMode ); -typedef APIRET (APIENTRY ImQueryIMModeFunc)( HIMI himi, PULONG pulInputMode, PULONG pulConversionMode ); - -struct SalIMEData -{ - HMODULE mhModIME; - ImAssociateInstanceFunc* mpAssocIME; - ImGetInstanceFunc* mpGetIME; - ImReleaseInstanceFunc* mpReleaseIME; - ImSetConversionFontFunc* mpSetConversionFont; - ImSetConversionFontSizeFunc* mpSetConversionFontSize; - ImGetConversionStringFunc* mpGetConversionString; - ImGetResultStringFunc* mpGetResultString; - ImSetCandidateWindowPosFunc* mpSetCandidateWin; - ImQueryIMEPropertyFunc* mpQueryIMEProperty; - ImRequestIMEFunc* mpRequestIME; - ImSetIMModeFunc* mpSetIMEMode; - ImQueryIMModeFunc* mpQueryIMEMode; -}; - -#endif - -#endif - -// -------------------- -// - Icon cache - -// -------------------- - -struct SalIcon -{ - int nId; - HPOINTER hIcon; - SalIcon *pNext; -}; - -// ----------- -// - SalData - -// ----------- - -struct SalData -{ - HAB mhAB; // anchor block handle - HMQ mhMQ; // handle of os2 message queue - int mnArgc; // commandline param count - char** mpArgv; // commandline - ULONG mnNewTimerMS; // Neue Zeit, mit dem der Timer gestartet werden soll - ULONG mnTimerMS; // Current Time (in MS) of the Timer - ULONG mnTimerOrgMS; // Current Original Time (in MS) - ULONG mnNextTimerTime; - ULONG mnLastEventTime; - ULONG mnTimerId; // os2 timer id - BOOL mbInTimerProc; // timer event is currently being dispatched - //SALTIMERPROC mpTimerProc; // timer callback proc - HWND mhWantLeaveMsg; // window handle, that want a MOUSELEAVE message - AutoTimer* mpMouseLeaveTimer; // Timer for MouseLeave Test - Os2SalInstance* mpFirstInstance; // pointer of first instance - Os2SalFrame* mpFirstFrame; // pointer of first frame - Os2SalFrame* mpCreateFrame; // Create-Frame for WM_CREATE - Os2SalObject* mpFirstObject; // pointer of first object window - ULONG mnAppThreadId; // Id from Applikation-Thread - ULONG mnFontMetricCount; // number of entries in the font list - PFONTMETRICS mpFontMetrics; // cached font list - BOOL mbObjClassInit; // Ist SALOBJECTCLASS initialised -#ifdef ENABLE_IME - SalIMEData* mpIMEData; // SalIME-Data - BOOL mbIMEInit; // SalIME-Data-Init -#endif - - SalIcon* mpFirstIcon; // icon cache, points to first icon, NULL if none - -}; - -inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; } -inline SalData* GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; } -inline SalData* GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; } - -// -------------- -// - SalShlData - -// -------------- - -#define OS2_VER_211 211 -#define OS2_VER_WARP3 230 -#define OS2_VER_WARP4 240 - -struct SalShlData -{ - HMODULE mhMod; // Module handle of SAL-DLL - USHORT mnVersion; // 211 = OS2 2.11; 230 = OS2 3.0; 240 = OS2 4.0 - PFNWP mpFrameProc; // old frame proc -}; - -extern SalShlData aSalShlData; - -BOOL SalImplHandleProcessMenu( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 ); - -// -------------------------------------------- -// - SALSHL.CXX - for accessing DLL resources - -// -------------------------------------------- - -HPOINTER ImplLoadSalCursor( int nId ); -HBITMAP ImplLoadSalBitmap( int nId ); -BOOL ImplLoadSalIcon( int nId, HPOINTER& rIcon); - -// SALGDI.CXX -void ImplInitSalGDI(); -void ImplFreeSalGDI(); - -// -------------- -// - Prototypes - -// -------------- - -// \\OS2\SOURCE\APP\SALINST.CXX -void ImplSalYieldMutexAcquireWithWait(); -ULONG ImplSalReleaseYieldMutex(); -void ImplSalAcquireYieldMutex( ULONG nCount ); -ULONG GetCurrentThreadId(); -BOOL ImplSalYieldMutexTryToAcquire(); -void ImplSalYieldMutexAcquire(); -void ImplSalYieldMutexRelease(); - -// \\OS2\SOURCE\WINDOW\SALFRAME.CXX -MRESULT EXPENTRY SalFrameWndProc( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 ); -MRESULT EXPENTRY SalFrameFrameProc( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 ); -// \SV\WIN\SOURCE\APP\SALTIMER.CXX -#define SALTIMERPROC_RECURSIVE 0xffffffff -void SalTimerProc( HWND hWnd, UINT nMsg, UINT nId, ULONG nTime ); - -// \WIN\SOURCE\WINDOW\SALFRAME.CXX -void SalTestMouseLeave(); - -// \\OS2\SOURCE\WINDOW\SALFRAME.CXX -// return Frame for Message-Handling -Os2SalFrame* GetSalDefaultFrame(); - -// \\OS2\SOURCE\WINDOW\SALFRAME.CXX -// IME-Daten wieder freigeben -#ifdef ENABLE_IME -void ImplReleaseSALIMEData(); -#endif - -// ----------- -// - Defines - -// ----------- - -#define SAL_PROFILE_APPNAME ((PSZ)"StarOffice") -#define SAL_PROFILE_USEDJP ((PSZ)"UseDJP") -#define SAL_PROFILE_PRINTDJP ((PSZ)"PrintDJP") -#define SAL_PROFILE_PRINTRAW ((PSZ)"PrintRAW") - -#define SAL_FRAME_WNDEXTRA sizeof(ULONG) -#define SAL_FRAME_THIS 0 -#define SAL_FRAME_CLASSNAME "SALFRAME" -#define SAL_SUBFRAME_CLASSNAME "SALSUBFRAME" -#define SAL_OBJECT_WNDEXTRA sizeof(ULONG) -#define SAL_OBJECT_THIS 0 -#define SAL_OBJECT_CLASSNAME "SALOBJECT" -#define SAL_OBJECT_CHILDCLASSNAME "SALOBJECTCHILD" -#define SAL_OBJECT_CLIPCLASSNAME "SALOBJECTCLIP" -#define SAL_COM_CLASSNAME "SALCOMWND" - -#define SAL_MOUSELEAVE_TIMEOUT 300 - -// MP1 == 0; MP2 == pData -#define SAL_MSG_USEREVENT (WM_USER+111) -// MP1 == 0; MP2 == MousePosition relativ to upper left of screen -#define SAL_MSG_MOUSELEAVE (WM_USER+112) -// MP1 == hDC; MP2 == 0 -#define SAL_MSG_PRINTABORTJOB (WM_USER+113) -// MP1 == 0; MP2 == 0 -#define SAL_MSG_STARTTIMER (WM_USER+114) -// MP1 == nFrameStyle; MP2 == pParent; lResult pFrame -#define SAL_MSG_CREATEFRAME (WM_USER+115) -// MP1 == 0; MP2 == pParent; lResult pObject -#define SAL_MSG_CREATEOBJECT (WM_USER+116) -// MP1 == bWait; MP2 == pMutex -#define SAL_MSG_THREADYIELD (WM_USER+117) -// MP1 == 0; MP2 == 0 -#define SAL_MSG_RELEASEWAITYIELD (WM_USER+118) -// MP1 == 0; MP2 == pData -#define SAL_MSG_SYSPROCESSMENU (WM_USER+119) -// POSTFOCUS-Message; MP1 == nMP1; MP2 == nMP2 (SHORT1( bFocus ), 0) -#define SAL_MSG_POSTFOCUS (WM_USER+120) -// POSTSIZE-Message; MP1 == nMP1; MP2 == nMP2 -#define SAL_MSG_POSTSIZE (WM_USER+121) - -// wParam == wParam; lParam == lParam -#define SAL_MSG_POSTMOVE (WM_USER+136) -// wParam == pRECT; lParam == 0 -#define SAL_MSG_POSTPAINT (WM_USER+137) -// wParam == nFlags; lParam == 0 -#define SAL_MSG_TOTOP (WM_USER+142) -// wParam == bVisible; lParam == 0 -#define SAL_MSG_SHOW (WM_USER+143) - -// SysChild-ToTop; nMP1 = 0; nMP2 = 0 -#define SALOBJ_MSG_TOTOP (WM_USER+150) -// POSTFOCUS-Message; MP1 == nMP1; MP2 == nMP2 (SHORT1( bFocus ), 0) -#define SALOBJ_MSG_POSTFOCUS (WM_USER+151) - -// wParam == 0; lParam == 0 -#define SAL_MSG_DESTROYFRAME (WM_USER+160) -// wParam == 0; lParam == pObject; -#define SAL_MSG_DESTROYOBJECT (WM_USER+161) -// wParam == 0; lParam == this; lResult == bRet -#define SAL_MSG_CREATESOUND (WM_USER+162) -// wParam == 0; lParam == this -#define SAL_MSG_DESTROYSOUND (WM_USER+163) -// wParam == hWnd; lParam == 0; lResult == hDC -#define SAL_MSG_GETDC (WM_USER+164) -// wParam == hWnd; lParam == 0 -#define SAL_MSG_RELEASEDC (WM_USER+165) -// wParam == newParentHwnd; lParam == oldHwnd; lResult == newhWnd -#define SAL_MSG_RECREATEHWND (WM_USER+166) -// wParam == newParentHwnd; lParam == oldHwnd; lResult == newhWnd -#define SAL_MSG_RECREATECHILDHWND (WM_USER+167) -// wParam == 0; lParam == HWND; -#define SAL_MSG_DESTROYHWND (WM_USER+168) -// POSTTIMER-Message; wparam = 0, lParam == time -#define SAL_MSG_POSTTIMER (WM_USER+169) - -// ----------------- -// - Helpfunctions - -// ----------------- - -inline void SetWindowPtr( HWND hWnd, SalFrame* pThis ) -{ - WinSetWindowULong( hWnd, SAL_FRAME_THIS, (ULONG)pThis ); -} - -inline Os2SalFrame* GetWindowPtr( HWND hWnd ) -{ - return (Os2SalFrame*)WinQueryWindowULong( hWnd, SAL_FRAME_THIS ); -} - -inline void SetSalObjWindowPtr( HWND hWnd, SalObject* pThis ) -{ - WinSetWindowULong( hWnd, SAL_OBJECT_THIS, (ULONG)pThis ); -} - -inline Os2SalObject* GetSalObjWindowPtr( HWND hWnd ) -{ - return (Os2SalObject*)WinQueryWindowULong( hWnd, SAL_OBJECT_THIS ); -} - -#endif // _SV_SALDATA_HXX diff --git a/vcl/os2/inc/salframe.h b/vcl/os2/inc/salframe.h deleted file mode 100644 index f02a39f80955..000000000000 --- a/vcl/os2/inc/salframe.h +++ /dev/null @@ -1,166 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALFRAME_H -#define _SV_SALFRAME_H - -#include <vcl/sv.h> -#include <vcl/sysdata.hxx> -#include <vcl/salframe.hxx> - - -#ifndef PM_BIDI_INCLUDED -#include <pmbidi.h> -#endif - -#ifndef __UCONV_H__ -#include <uconv.h> -#endif - -#ifndef __UNIDEF_H__ -#include <unidef.h> -#endif - -#ifndef __UNIKBD_H__ -#include <unikbd.h> -#endif - -//class SalFrame; -class Os2SalGraphics; - -// ---------------- -// - SalFrameData - -// ---------------- - -//class SalFrameData -class Os2SalFrame : public SalFrame -{ -public: - HWND mhWndFrame; // HWND-Frame - HWND mhWndClient; // HWND-Client - HAB mhAB; // HAB - HPOINTER mhPointer; // Current MousePointer - void* mpInst; // VCL-Instance - //SALFRAMEPROC mpProc; // VCL-Proc - Os2SalGraphics* mpGraphics; // current frame graphics - Os2SalFrame* mpNextFrame; // pointer to next frame - SystemEnvData maSysData; // system data - SalFrameState maState; // frame state - int mnShowState; // show state - ULONG mnStyle; // SalFrameStyle - long mnWidth; // Window-Witdth - long mnHeight; // Window-Height - SWP maFullScreenRect; // WindowRect befor FullScreenMode - BOOL mbGraphics; // is Graphics used - BOOL mbAllwayOnTop; // Allways on top modus - BOOL mbVisible; // Visible Show/Hide-Status - BOOL mbMinHide; // hide called from OS2 - BOOL mbHandleIME; // TRUE: Wir handeln die IME-Messages - BOOL mbConversionMode; // TRUE: Wir befinden uns im Conversion-Modus - BOOL mbCandidateMode; // TRUE: Wir befinden uns im Candidate-Modus - BOOL mbCaption; // has window a caption - BOOL mbBorder; // has window a border - BOOL mbFixBorder; // has window a fixed border - BOOL mbSizeBorder; // has window a sizeable border - BOOL mbNoIcon; // is an window without an icon - BOOL mbFloatWin; // is a FloatingWindow - BOOL mbFullScreen; // TRUE: in full screen mode - BOOL mbPresentation; // TRUE: Presentation Mode running - BOOL mbInShow; // innerhalb eines Show-Aufrufs - BOOL mbRestoreMaximize; // Restore-Maximize - BOOL mbInMoveMsg; // Move-Message wird verarbeitet - BOOL mbInSizeMsg; // Size-Message wird verarbeitet - BOOL mbFullScreenToolWin; // WS_EX_TOOLWINDOW reset in FullScreenMode - BOOL mbDefPos; // default-position - BOOL mbOverwriteState; // TRUE: WindowState darf umgesetzt werden - - int mnMinWidth; // min. client width in pixeln - int mnMinHeight; // min. client height in pixeln - int mnMaxWidth; // max. client width in pixeln - int mnMaxHeight; // max. client height in pixeln - static ULONG mnInputLang; // current Input Language - KHAND mnKeyboardHandle; // current unicode keyboard - static BOOL mbInReparent; // TRUE: ignore focus lost and gain due to reparenting - -private: - Os2SalFrame* mpParentFrame; // parent frame pointer - -public: - Os2SalFrame(); - virtual ~Os2SalFrame(); - - virtual SalGraphics* GetGraphics(); - virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual BOOL PostEvent( void* pData ); - virtual void SetTitle( const XubString& rTitle ); - virtual void SetIcon( USHORT nIcon ); - virtual void SetMenu( SalMenu* pSalMenu ); - virtual void DrawMenuBar(); - virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ); - virtual void Show( BOOL bVisible, BOOL bNoActivate = FALSE ); - virtual void Enable( BOOL bEnable ); - virtual void SetMinClientSize( long nWidth, long nHeight ); - virtual void SetMaxClientSize( long nWidth, long nHeight ); - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ); - virtual void GetClientSize( long& rWidth, long& rHeight ); - virtual void GetWorkArea( RECTL& rRect ); - virtual void GetWorkArea( Rectangle& rRect ); - virtual SalFrame* GetParent() const; - virtual void SetWindowState( const SalFrameState* pState ); - virtual BOOL GetWindowState( SalFrameState* pState ); - virtual void ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ); - virtual void StartPresentation( BOOL bStart ); - virtual void SetAlwaysOnTop( BOOL bOnTop ); - virtual void ToTop( USHORT nFlags ); - virtual void SetPointer( PointerStyle ePointerStyle ); - virtual void CaptureMouse( BOOL bMouse ); - virtual void SetPointerPos( long nX, long nY ); - virtual void Flush(); - virtual void Sync(); - virtual void SetInputContext( SalInputContext* pContext ); - virtual void EndExtTextInput( USHORT nFlags ); - virtual String GetKeyName( USHORT nKeyCode ); - virtual String GetSymbolKeyName( const XubString& rFontName, USHORT nKeyCode ); - virtual BOOL MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); - virtual LanguageType GetInputLanguage(); - virtual SalBitmap* SnapShot(); - virtual void UpdateSettings( AllSettings& rSettings ); - virtual void Beep( SoundType eSoundType ); - virtual const SystemEnvData* GetSystemData() const; - virtual SalPointerState GetPointerState(); - virtual void SetParent( SalFrame* pNewParent ); - virtual bool SetPluginParent( SystemParentData* pNewParent ); - virtual void SetBackgroundBitmap( SalBitmap* ); - virtual void SetScreenNumber( unsigned int ); - virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( ULONG nRects ); - virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual void EndSetClipRegion(); - -}; - -#endif // _SV_SALFRAME_H diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h deleted file mode 100644 index 1c9b66d89a0b..000000000000 --- a/vcl/os2/inc/salgdi.h +++ /dev/null @@ -1,367 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALGDI_H -#define _SV_SALGDI_H - -#include <vcl/sv.h> -#include <vcl/sallayout.hxx> -#include <vcl/salgdi.hxx> -#include <vcl/outfont.hxx> -#include <vcl/impfont.hxx> - -#include <hash_set> - -class ImplOs2FontEntry; - -// ----------- -// - Defines - -// ----------- - -// win32 platform specific options. Move them to the PMK file? -#define GCP_USEKERNING 0x0008 -#define USE_UNISCRIBE -#define GCP_KERN_HACK -#define GNG_VERT_HACK - -// os2 specific physically available font face -class ImplOs2FontData : public ImplFontData -{ -public: - ImplOs2FontData( PFONTMETRICS, - int nFontHeight, - BYTE nPitchAndFamily ); - ~ImplOs2FontData(); - - virtual ImplFontData* Clone() const; - virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; - virtual sal_IntPtr GetFontId() const; - void SetFontId( sal_IntPtr nId ) { mnId = nId; } - void UpdateFromHPS( HPS ) const; - - bool HasChar( sal_uInt32 cChar ) const; - - PFONTMETRICS GetFontMetrics() const { return pFontMetric; } - USHORT GetCharSet() const { return meOs2CharSet; } - BYTE GetPitchAndFamily() const { return mnPitchAndFamily; } - bool IsGlyphApiDisabled() const { return mbDisableGlyphApi; } - bool SupportsKorean() const { return mbHasKoreanRange; } - bool SupportsCJK() const { return mbHasCJKSupport; } - bool AliasSymbolsHigh() const { return mbAliasSymbolsHigh; } - bool AliasSymbolsLow() const { return mbAliasSymbolsLow; } - - const ImplFontCharMap* GetImplFontCharMap() const; - -private: - sal_IntPtr mnId; - mutable bool mbDisableGlyphApi; - mutable bool mbHasKoreanRange; - mutable bool mbHasCJKSupport; - - mutable const ImplFontCharMap* mpUnicodeMap; - - // TODO: get rid of the members below needed to work with the Win9x non-unicode API - BYTE* mpFontCharSets; // all Charsets for the current font (used on W98 for kerning) - BYTE mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried - USHORT meOs2CharSet; - BYTE mnPitchAndFamily; - bool mbAliasSymbolsHigh; - bool mbAliasSymbolsLow; - PFONTMETRICS pFontMetric; - -private: - void ReadCmapTable( HDC ) const; - void ReadOs2Table( HDC ) const; - -#ifdef GNG_VERT_HACK - void ReadGsubTable( HDC ) const; - - typedef std::hash_set<int> IntHashSet; - mutable IntHashSet maGsubTable; - mutable bool mbGsubRead; -public: - bool HasGSUBstitutions( HDC ) const; - bool IsGSUBstituted( sal_Unicode ) const; -#endif // GNG_VERT_HACK - -}; - - -// ------------------- -// - SalGraphicsData - -// ------------------- - -class Os2SalGraphics : public SalGraphics -{ -public: - HPS mhPS; // HPS - HDC mhDC; // HDC - HWND mhWnd; // HWND - LONG mnHeight; // Height of frame Window - ULONG mnClipElementCount; // number of clip rects in clip rect array - RECTL* mpClipRectlAry; // clip rect array - ULONG mnFontMetricCount; // number of entries in the font list - PFONTMETRICS mpFontMetrics; // cached font list - LONG mnOrientationX; // X-Font orientation - LONG mnOrientationY; // Y-Font orientation - BOOL mbLine; // draw lines - BOOL mbFill; // fill areas - BOOL mbPrinter; // is Printer - BOOL mbVirDev; // is VirDev - BOOL mbWindow; // is Window - BOOL mbScreen; // is Screen compatible - bool mbXORMode; // _every_ output with RasterOp XOR - ULONG mhFonts[ MAX_FALLBACK ]; // Font + Fallbacks - const ImplOs2FontData* mpOs2FontData[ MAX_FALLBACK ]; // pointer to the most recent font face - ImplOs2FontEntry* mpOs2FontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance - ULONG mhDefFont; // DefaultFont - float mfFontScale; // allows metrics emulation of huge font sizes - BOOL mbFontKernInit; // FALSE: FontKerns must be queried - KERNINGPAIRS* mpFontKernPairs; // Kerning Pairs of the current Font - ULONG mnFontKernPairCount;// Number of Kerning Pairs of the current Font - - USHORT ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, int ); - -public: - Os2SalGraphics(); - virtual ~Os2SalGraphics(); - -protected: - // draw --> LineColor and FillColor and RasterOp and ClipRegion - virtual void drawPixel( long nX, long nY ); - virtual void drawPixel( long nX, long nY, SalColor nSalColor ); - virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ); - virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); - virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ); - virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); - virtual void drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, PCONSTSALPOINT* pPtAry ); - virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin ); - virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); - virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); - virtual sal_Bool drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); - - // CopyArea --> No RasterOp, but ClipRegion - virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, - long nSrcHeight, USHORT nFlags ); - - // CopyBits and DrawBitmap --> RasterOp and ClipRegion - // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics - virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ); - virtual void drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap ); - virtual void drawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, - SalColor nTransparentColor ); - virtual void drawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, - const SalBitmap& rTransparentBitmap ); - virtual void drawMask( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, - SalColor nMaskColor ); - - virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); - virtual SalColor getPixel( long nX, long nY ); - - // invert --> ClipRegion (only Windows or VirDevs) - virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags); - virtual void invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ); - - virtual BOOL drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ); - -#if 0 - // native widget rendering methods that require mirroring - virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, BOOL& rIsInside ); - virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, - rtl::OUString aCaption ); - virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, - rtl::OUString aCaption ); - virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, rtl::OUString aCaption, - Region &rNativeBoundingRegion, Region &rNativeContentRegion ); -#endif - - virtual bool drawAlphaBitmap( const SalTwoRect&, - const SalBitmap& rSourceBitmap, - const SalBitmap& rAlphaBitmap ); - virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency ); - -public: - // public SalGraphics methods, the interface to teh independent vcl part - - // get device resolution - virtual void GetResolution( long& rDPIX, long& rDPIY ); - // get the depth of the device - virtual USHORT GetBitCount(); - // get the width of the device - virtual long GetGraphicsWidth() const; - - // set the clip region to empty - virtual void ResetClipRegion(); - virtual bool setClipRegion( const Region& ); - - // set the line color to transparent (= don't draw lines) - virtual void SetLineColor(); - // set the line color to a specific color - virtual void SetLineColor( SalColor nSalColor ); - // set the fill color to transparent (= don't fill) - virtual void SetFillColor(); - // set the fill color to a specific color, shapes will be - // filled accordingly - virtual void SetFillColor( SalColor nSalColor ); - // enable/disable XOR drawing - virtual void SetXORMode( bool bSet, bool ); - // set line color for raster operations - virtual void SetROPLineColor( SalROPColor nROPColor ); - // set fill color for raster operations - virtual void SetROPFillColor( SalROPColor nROPColor ); - // set the text color to a specific color - virtual void SetTextColor( SalColor nSalColor ); - // set the font - virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); - // get the current font's etrics - virtual void GetFontMetric( ImplFontMetricData* ); - // get kernign pairs of the current font - // return only PairCount if (pKernPairs == NULL) - virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ); - // get the repertoire of the current font - virtual ImplFontCharMap* GetImplFontCharMap() const; - // graphics must fill supplied font list - virtual void GetDevFontList( ImplDevFontList* ); - // graphics should call ImplAddDevFontSubstitute on supplied - // OutputDevice for all its device specific preferred font substitutions - virtual void GetDevFontSubstList( OutputDevice* ); - virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); - // CreateFontSubset: a method to get a subset of glyhps of a font - // inside a new valid font file - // returns TRUE if creation of subset was successfull - // parameters: rToFile: contains a osl file URL to write the subset to - // pFont: describes from which font to create a subset - // pGlyphIDs: the glyph ids to be extracted - // pEncoding: the character code corresponding to each glyph - // pWidths: the advance widths of the correspoding glyphs (in PS font units) - // nGlyphs: the number of glyphs - // rInfo: additional outgoing information - // implementation note: encoding 0 with glyph id 0 should be added implicitly - // as "undefined character" - virtual BOOL CreateFontSubset( const rtl::OUString& rToFile, - const ImplFontData* pFont, - long* pGlyphIDs, - sal_uInt8* pEncoding, - sal_Int32* pWidths, - int nGlyphs, - FontSubsetInfo& rInfo // out parameter - ); - - // GetFontEncodingVector: a method to get the encoding map Unicode - // to font encoded character; this is only used for type1 fonts and - // may return NULL in case of unknown encoding vector - // if ppNonEncoded is set and non encoded characters (that is type1 - // glyphs with only a name) exist it is set to the corresponding - // map for non encoded glyphs; the encoding vector contains -1 - // as encoding for these cases - virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded ); - - // GetEmbedFontData: gets the font data for a font marked - // embeddable by GetDevFontList or NULL in case of error - // parameters: pFont: describes the font in question - // pWidths: the widths of all glyphs from char code 0 to 255 - // pWidths MUST support at least 256 members; - // rInfo: additional outgoing information - // pDataLen: out parameter, contains the byte length of the returned buffer - virtual const void* GetEmbedFontData( const ImplFontData*, - const sal_Ucs* pUnicodes, - sal_Int32* pWidths, - FontSubsetInfo& rInfo, - long* pDataLen ); - // frees the font data again - virtual void FreeEmbedFontData( const void* pData, long nDataLen ); - - virtual void GetGlyphWidths( const ImplFontData* pFont, - bool bVertical, - Int32Vector& rWidths, - Ucs2UIntMap& rUnicodeEnc ); - - virtual BOOL GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual BOOL GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); - - virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); - virtual void DrawServerFontLayout( const ServerFontLayout& ); - virtual bool supportsOperation( OutDevSupportType ) const; - - // Query the platform layer for control support - virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); - - virtual SystemGraphicsData GetGraphicsData() const; - virtual SystemFontData GetSysFontData( int nFallbacklevel ) const; -}; - -// Init/Deinit Graphics -void ImplSalInitGraphics( Os2SalGraphics* mpData ); -void ImplSalDeInitGraphics( Os2SalGraphics* mpData ); - -// ----------- -// - Defines - -// ----------- - -#define RGBCOLOR(r,g,b) ((ULONG)(((BYTE)(b)|((USHORT)(g)<<8))|(((ULONG)(BYTE)(r))<<16))) -#define TY( y ) (mnHeight-(y)-1) - -// offset for lcid field, used for fallback font selection -#define LCID_BASE 100 - -// ----------- -// - Inlines - -// ----------- - -// #102411# Win's GCP mishandles kerning => we need to do it ourselves -// SalGraphicsData::mpFontKernPairs is sorted by -inline bool ImplCmpKernData( const KERNINGPAIRS& a, const KERNINGPAIRS& b ) -{ - if( a.sFirstChar < b.sFirstChar ) - return true; - if( a.sFirstChar > b.sFirstChar ) - return false; - return (a.sSecondChar < b.sSecondChar); -} - -// called extremely often from just one spot => inline -inline bool ImplOs2FontData::HasChar( sal_uInt32 cChar ) const -{ - if( mpUnicodeMap->HasChar( cChar ) ) - return true; - // second chance to allow symbol aliasing - if( mbAliasSymbolsLow && ((cChar-0xF000) <= 0xFF) ) - cChar -= 0xF000; - else if( mbAliasSymbolsHigh && (cChar <= 0xFF) ) - cChar += 0xF000; - return mpUnicodeMap->HasChar( cChar ); -} - -#endif // _SV_SALGDI_H diff --git a/vcl/os2/inc/salids.hrc b/vcl/os2/inc/salids.hrc deleted file mode 100644 index b5f2260d307f..000000000000 --- a/vcl/os2/inc/salids.hrc +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALIDS_HRC -#define _SV_SALIDS_HRC - -// Pointer -#define SAL_RESID_POINTER_NULL 10000 -#define SAL_RESID_POINTER_HELP 10001 -#define SAL_RESID_POINTER_CROSS 10002 -#define SAL_RESID_POINTER_MOVE 10003 -#define SAL_RESID_POINTER_HSPLIT 10004 -#define SAL_RESID_POINTER_VSPLIT 10005 -#define SAL_RESID_POINTER_HSIZEBAR 10006 -#define SAL_RESID_POINTER_VSIZEBAR 10007 -#define SAL_RESID_POINTER_HAND 10008 -#define SAL_RESID_POINTER_REFHAND 10009 -#define SAL_RESID_POINTER_PEN 10010 -#define SAL_RESID_POINTER_MAGNIFY 10011 -#define SAL_RESID_POINTER_FILL 10012 -#define SAL_RESID_POINTER_ROTATE 10013 -#define SAL_RESID_POINTER_HSHEAR 10014 -#define SAL_RESID_POINTER_VSHEAR 10015 -#define SAL_RESID_POINTER_MIRROR 10016 -#define SAL_RESID_POINTER_CROOK 10017 -#define SAL_RESID_POINTER_CROP 10018 -#define SAL_RESID_POINTER_MOVEPOINT 10019 -#define SAL_RESID_POINTER_MOVEBEZIERWEIGHT 10020 -#define SAL_RESID_POINTER_MOVEDATA 10021 -#define SAL_RESID_POINTER_COPYDATA 10022 -#define SAL_RESID_POINTER_LINKDATA 10023 -#define SAL_RESID_POINTER_MOVEDATALINK 10024 -#define SAL_RESID_POINTER_COPYDATALINK 10025 -#define SAL_RESID_POINTER_MOVEFILE 10026 -#define SAL_RESID_POINTER_COPYFILE 10027 -#define SAL_RESID_POINTER_LINKFILE 10028 -#define SAL_RESID_POINTER_MOVEFILELINK 10029 -#define SAL_RESID_POINTER_COPYFILELINK 10030 -#define SAL_RESID_POINTER_MOVEFILES 10031 -#define SAL_RESID_POINTER_COPYFILES 10032 -#define SAL_RESID_POINTER_DRAW_LINE 10033 -#define SAL_RESID_POINTER_DRAW_RECT 10034 -#define SAL_RESID_POINTER_DRAW_POLYGON 10035 -#define SAL_RESID_POINTER_DRAW_BEZIER 10036 -#define SAL_RESID_POINTER_DRAW_ARC 10037 -#define SAL_RESID_POINTER_DRAW_PIE 10038 -#define SAL_RESID_POINTER_DRAW_CIRCLECUT 10039 -#define SAL_RESID_POINTER_DRAW_ELLIPSE 10040 -#define SAL_RESID_POINTER_DRAW_FREEHAND 10041 -#define SAL_RESID_POINTER_DRAW_CONNECT 10042 -#define SAL_RESID_POINTER_DRAW_TEXT 10043 -#define SAL_RESID_POINTER_DRAW_CAPTION 10044 -#define SAL_RESID_POINTER_CHART 10045 -#define SAL_RESID_POINTER_DETECTIVE 10046 -#define SAL_RESID_POINTER_PIVOT_COL 10047 -#define SAL_RESID_POINTER_PIVOT_ROW 10048 -#define SAL_RESID_POINTER_PIVOT_FIELD 10049 -#define SAL_RESID_POINTER_CHAIN 10050 -#define SAL_RESID_POINTER_CHAIN_NOTALLOWED 10051 -#define SAL_RESID_POINTER_TIMEEVENT_MOVE 10052 -#define SAL_RESID_POINTER_TIMEEVENT_SIZE 10053 -#define SAL_RESID_POINTER_AUTOSCROLL_N 10054 -#define SAL_RESID_POINTER_AUTOSCROLL_S 10055 -#define SAL_RESID_POINTER_AUTOSCROLL_W 10056 -#define SAL_RESID_POINTER_AUTOSCROLL_E 10057 -#define SAL_RESID_POINTER_AUTOSCROLL_NW 10058 -#define SAL_RESID_POINTER_AUTOSCROLL_NE 10059 -#define SAL_RESID_POINTER_AUTOSCROLL_SW 10060 -#define SAL_RESID_POINTER_AUTOSCROLL_SE 10061 -#define SAL_RESID_POINTER_AUTOSCROLL_NS 10062 -#define SAL_RESID_POINTER_AUTOSCROLL_WE 10063 -#define SAL_RESID_POINTER_AUTOSCROLL_NSWE 10064 -#define SAL_RESID_POINTER_AIRBRUSH 10070 -#define SAL_RESID_POINTER_TEXT_VERTICAL 10071 -#define SAL_RESID_POINTER_PIVOT_DELETE 10072 -#define SAL_RESID_POINTER_TAB_SELECT_S 10073 -#define SAL_RESID_POINTER_TAB_SELECT_E 10074 -#define SAL_RESID_POINTER_TAB_SELECT_SE 10075 -#define SAL_RESID_POINTER_TAB_SELECT_W 10076 -#define SAL_RESID_POINTER_TAB_SELECT_SW 10077 -#define SAL_RESID_POINTER_PAINTBRUSH 10078 - -#define SAL_RESID_ICON_DEFAULT 1 - -#endif // _SV_SALIDS_HRC diff --git a/vcl/os2/inc/salinst.h b/vcl/os2/inc/salinst.h deleted file mode 100644 index 7826a62e1f9b..000000000000 --- a/vcl/os2/inc/salinst.h +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALINST_H -#define _SV_SALINST_H - -#include <vcl/sv.h> -#include <vcl/salinst.hxx> - -namespace vos { class OMutex; } - -// ------------------- -// - SalInstanceData - -// ------------------- - -class SalYieldMutex; - -#define SAL_COMMANDLINENOINIT ((USHORT)0xFFFF) -#define SAL_MAXPARAM 40 - -class Os2SalInstance : public SalInstance -{ -public: - HAB mhAB; // anchor block handle - HMQ mhMQ; // handle of os2 message queue - HPOINTER mhAppIcon; // app icon - int mnArgc; // commandline param count - char** mpArgv; // commandline - HWND mhComWnd; // window, for communication (between threads and the main thread) - SalYieldMutex* mpSalYieldMutex; // Sal-Yield-Mutex - vos::OMutex* mpSalWaitMutex; // Sal-Wait-Mutex - USHORT mnYieldWaitCount; // Wait-Count - -public: - Os2SalInstance(); - virtual ~Os2SalInstance(); - - virtual SalFrame* CreateChildFrame( SystemParentData* pParent, ULONG nStyle ); - virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle ); - virtual void DestroyFrame( SalFrame* pFrame ); - virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow = TRUE ); - virtual void DestroyObject( SalObject* pObject ); - virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, - USHORT nBitCount, const SystemGraphicsData *pData ); - virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ); - - virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, - ImplJobSetup* pSetupData ); - virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ); - virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ); - virtual void DestroyPrinter( SalPrinter* pPrinter ); - virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ); - virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ); - virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ); - virtual String GetDefaultPrinter(); - virtual SalTimer* CreateSalTimer(); - virtual SalI18NImeStatus* CreateI18NImeStatus(); - virtual SalSystem* CreateSalSystem(); - virtual SalBitmap* CreateSalBitmap(); - virtual vos::IMutex* GetYieldMutex(); - virtual ULONG ReleaseYieldMutex(); - virtual void AcquireYieldMutex( ULONG nCount ); - virtual bool CheckYieldMutex(); - virtual void Yield( bool, bool ); - virtual bool AnyInput( USHORT nType ); - virtual SalSession* CreateSalSession(); - virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); - virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); -}; - -SalFrame* ImplSalCreateFrame( Os2SalInstance* pInst, HWND hWndParent, ULONG nSalFrameStyle ); -SalObject* ImplSalCreateObject( Os2SalInstance* pInst, Os2SalFrame* pParent ); -void ImplSalStartTimer( ULONG nMS, BOOL bMutex = FALSE ); - -#endif // _SV_SALINST_H diff --git a/vcl/os2/inc/sallang.hxx b/vcl/os2/inc/sallang.hxx deleted file mode 100644 index 72d2566571a6..000000000000 --- a/vcl/os2/inc/sallang.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SALLANG_HXX -#define _SALLANG_HXX - -//#ifndef _TOOLS_LANG_HXX -//#include <tools/lang.hxx> -//#endif -#include <i18npool/mslangid.hxx> - -// -------------------- -// - Language Strings - -// -------------------- - -// --- Key-Namen --- -#define LSTR_KEY_SHIFT 0 -#define LSTR_KEY_CTRL 1 -#define LSTR_KEY_ALT 2 -#define LSTR_KEY_UP 3 -#define LSTR_KEY_DOWN 4 -#define LSTR_KEY_LEFT 5 -#define LSTR_KEY_RIGHT 6 -#define LSTR_KEY_HOME 7 -#define LSTR_KEY_END 8 -#define LSTR_KEY_PAGEUP 9 -#define LSTR_KEY_PAGEDOWN 10 -#define LSTR_KEY_RETURN 11 -#define LSTR_KEY_ESC 12 -#define LSTR_KEY_TAB 13 -#define LSTR_KEY_BACKSPACE 14 -#define LSTR_KEY_SPACE 15 -#define LSTR_KEY_INSERT 16 -#define LSTR_KEY_DELETE 17 - -// --- Anzahl der Texte --- - -#define LSTR_COUNT 18 - -// -------------------------------------------- -// - Methoden zum Abfragen der Sprach-Strings - -// -------------------------------------------- - -const sal_Unicode** ImplGetLangTab( LanguageType eLang ); - -#endif // _SALLANG_HXX diff --git a/vcl/os2/inc/salmenu.h b/vcl/os2/inc/salmenu.h deleted file mode 100644 index 081158bf81f7..000000000000 --- a/vcl/os2/inc/salmenu.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALMENU_H -#define _SV_SALMENU_H - -#include <vcl/sv.h> -#include <vcl/bitmap.hxx> -#include <vcl/salmenu.hxx> - - -class Os2SalMenu : public SalMenu -{ -public: - Os2SalMenu() {} - virtual ~Os2SalMenu(); - - virtual BOOL VisibleMenuBar(); // must return TRUE to actually DISPLAY native menu bars - // otherwise only menu messages are processed (eg, OLE on Windows) - - virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ); - virtual void RemoveItem( unsigned nPos ); - virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ); - virtual void SetFrame( const SalFrame* pFrame ); - virtual void CheckItem( unsigned nPos, BOOL bCheck ); - virtual void EnableItem( unsigned nPos, BOOL bEnable ); - virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText ); - virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage); - virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName ); - virtual void GetSystemMenuData( SystemMenuData* pData ); -}; - -class Os2SalMenuItem : public SalMenuItem -{ -public: - Os2SalMenuItem() {} - virtual ~Os2SalMenuItem(); -}; - -#endif // _SV_SALMENU_H - diff --git a/vcl/os2/inc/salobj.h b/vcl/os2/inc/salobj.h deleted file mode 100644 index 04fdef90bf67..000000000000 --- a/vcl/os2/inc/salobj.h +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALOBJ_H -#define _SV_SALOBJ_H - -#include <vcl/sv.h> -#include <vcl/salobj.hxx> - -// ----------------- -// - SalObjectData - -// ----------------- - -class Os2SalObject : public SalObject -{ -public: - HWND mhWnd; // Window handle - HWND mhWndChild; // Child Window handle - HWND mhLastFocusWnd; // Child-Window, welches als letztes den Focus hatte - SystemChildData maSysData; // SystemEnvData - HWND mhLastClipWnd; // LastClip-Window - HWND mhOldLastClipWnd; // LastClip-Window befor BeginSetClipRegion - long mnHeight; // Fenster-Hoehe fuer Positionsumrechnung - Os2SalObject* mpNextObject; // pointer to next object - void* mpInst; // instance handle for callback - SALOBJECTPROC mpProc; // callback proc - - Os2SalObject(); - virtual ~Os2SalObject(); - - virtual void ResetClipRegion(); - virtual USHORT GetClipRegionType(); - virtual void BeginSetClipRegion( ULONG nRects ); - virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual void EndSetClipRegion(); - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ); - virtual void Show( BOOL bVisible ); - virtual void Enable( BOOL nEnable ); - virtual void GrabFocus(); - virtual void SetBackground(); - virtual void SetBackground( SalColor nSalColor ); - virtual const SystemEnvData* GetSystemData() const; - virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); -}; - -#endif // _SV_SALOBJ_H diff --git a/vcl/os2/inc/salprn.h b/vcl/os2/inc/salprn.h deleted file mode 100644 index 4cb7700ffaae..000000000000 --- a/vcl/os2/inc/salprn.h +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALPRN_H -#define _SV_SALPRN_H - -#include <vcl/sv.h> -#include <vcl/salprn.hxx> - -class SalGraphics; -class SalInfoPrinter; - -struct ImplFormInfo; -typedef ImplFormInfo* PIMPLFORMINFO; -struct ImplTrayInfo; -typedef ImplTrayInfo* PIMPLTRAYINFO; - -// ---------------------- -// - SalInfoPrinterData - -// ---------------------- - -//class SalInfoPrinterData -class Os2SalInfoPrinter : public SalInfoPrinter -{ -public: - Os2SalGraphics* mpGraphics; // Graphics - HDC mhDC; // printer hdc - HPS mhPS; // printer hps - ByteString maPrinterName; // pszPrinters - ByteString maName; // pszName bzw. LogAdress - ByteString maDriverName; // pszDriverName nach . - ByteString maDeviceName; // pszDriverName bis . - ByteString maJobSetupDeviceName; // DeviceName aus pDriverData - PIMPLFORMINFO* mpFormArray; // PaperForm-Names - USHORT mnFormCount; // PaperForm-Count - PIMPLTRAYINFO* mpTrayArray; // PaperTray-Names - USHORT mnTrayCount; // PaperTray-Count - BOOL mbDJPSupported; // is driver DJP enabled - BOOL mbGraphics; // is Graphics used - -public: - Os2SalInfoPrinter(); - virtual ~Os2SalInfoPrinter(); - - virtual SalGraphics* GetGraphics(); - virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual BOOL Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ); - virtual BOOL SetPrinterData( ImplJobSetup* pSetupData ); - virtual BOOL SetData( ULONG nFlags, ImplJobSetup* pSetupData ); - virtual void GetPageInfo( const ImplJobSetup* pSetupData, - long& rOutWidth, long& rOutHeight, - long& rPageOffX, long& rPageOffY, - long& rPageWidth, long& rPageHeight ); - virtual ULONG GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType ); - virtual ULONG GetPaperBinCount( const ImplJobSetup* pSetupData ); - virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ); - virtual void InitPaperFormats( const ImplJobSetup* pSetupData ); - virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ); -}; - -// ------------------ -// - SalPrinterData - -// ------------------ - -class SalPrinterData00 -{ -public: - Os2SalGraphics* mpGraphics; // current Printer graphics - SalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter - HDC mhDC; // printer hdc - HPS mhPS; // printer hps - ULONG mnError; // Error Code - BOOL mbFirstPage; // IsFirstPage - BOOL mbAbort; // JobAborted - BOOL mbPrintDJPSupported; // is driver PrintDJP enabled (DEVESC_NEWFRAME_WPROP) - char maCommentBuf[33]; // Comment - char maCopyBuf[10]; // Kopien -}; - -// ----------------- -// - Os2SalPrinter - -// ----------------- - -class Os2SalPrinter : public SalPrinter -{ -public: - Os2SalGraphics* mpGraphics; // current Printer graphics - Os2SalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter - Os2SalPrinter* mpNextPrinter; // next printing printer - HDC mhDC; // printer hdc - HPS mhPS; // printer hps - ULONG mnError; // Error Code - BOOL mbFirstPage; // IsFirstPage - BOOL mbAbort; // JobAborted - BOOL mbPrintDJPSupported; // is driver PrintDJP enabled (DEVESC_NEWFRAME_WPROP) - char maCommentBuf[33]; // Comment - char maCopyBuf[16]; // Kopien - //HDC mhDC; // printer hdc - //ULONG mnError; // Error Code - //ULONG mnCopies; // Kopien - //BOOL mbCollate; // Sortierte Kopien - //BOOL mbAbort; // Job Aborted - -public: - Os2SalPrinter(); - virtual ~Os2SalPrinter(); - - virtual BOOL StartJob( const XubString* pFileName, - const XubString& rJobName, - const XubString& rAppName, - ULONG nCopies, - bool bCollate, - bool bDirect, - ImplJobSetup* pSetupData ); - virtual BOOL EndJob(); - virtual BOOL AbortJob(); - virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ); - virtual BOOL EndPage(); - virtual ULONG GetErrorCode(); -}; - -#endif // _SV_SALPRN_H diff --git a/vcl/os2/inc/salsound.h b/vcl/os2/inc/salsound.h deleted file mode 100644 index 62536678625d..000000000000 --- a/vcl/os2/inc/salsound.h +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALSOUND_H -#define _SV_SALSOUND_H - -#include <tools/gen.hxx> -#include <sv.h> -#include <tools/string.hxx> -#include <vcl/salframe.hxx> -#ifndef _SV_SALSTYPE_HXX -#include <vcl/salstype.hxx> -#endif -#include <vcl/salsound.hxx> - -// ------------ -// - SalSound - -// ------------ - -//class SalSound -class Os2SalSound : public SalSound -{ -private: - - static HMODULE mhMCILib; - static ULONG mnSoundState; - static void* mpMCIFnc; - SALSOUNDPROC mpProc; - void* mpInst; - ULONG mnStartTime; - ULONG mnPlayLen; - HWND mhSoundWnd; - USHORT mnDeviceId; - BOOL mbLoop; - BOOL mbPaused; - -public: - - void ImplSetError( ULONG nMciErr ); - void ImplNotify( SoundNotification eNotification, ULONG nError ); - -public: - - BOOL Create(); - //static BOOL IsValid() { return( SOUND_STATE_VALID == Os2SalSound::mnSoundState ); } - //BOOL Init( SalFrame* pFrame, const String& rSoundName, ULONG& rSoundLen ); - //BOOL Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen ); - - void SetNotifyProc( void* pInst, SALSOUNDPROC pProc ) - { mpInst = pInst; mpProc = pProc; } -public: - Os2SalSound(); - virtual ~Os2SalSound(); - - virtual bool IsValid(); - virtual bool Init( const String& rSoundName, ULONG& rSoundLen ); - virtual void Play( ULONG nStartTime, ULONG nPlayTime, bool bLoop ); - virtual void Stop(); - virtual void Pause(); - virtual void Continue(); - virtual bool IsLoopMode() const; - virtual bool IsPlaying() const; - virtual bool IsPaused() const; - - bool ImplCreate(); - void ImplDestroy(); - static void Release(); -}; - -#endif // _SV_SALSOUND_H diff --git a/vcl/os2/inc/salsound.hxx b/vcl/os2/inc/salsound.hxx deleted file mode 100644 index 7ec2aeed1720..000000000000 --- a/vcl/os2/inc/salsound.hxx +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALSOUND_HXX -#define _SV_SALSOUND_HXX - -#include <tools/gen.hxx> -#include <sv.h> -#include <tools/string.hxx> -#include <salframe.hxx> -#ifndef _SV_SALSTYPE_HXX -#include <salstype.hxx> -#endif -#include <salsound.hxx> - -// ------------ -// - SalSound - -// ------------ - -class SalSound -{ -private: - - static HMODULE mhMCILib; - static ULONG mnSoundState; - static void* mpMCIFnc; - SALSOUNDPROC mpProc; - void* mpInst; - ULONG mnStartTime; - ULONG mnPlayLen; - HWND mhSoundWnd; - USHORT mnDeviceId; - BOOL mbLoop; - BOOL mbPaused; - -public: - - void ImplSetError( ULONG nMciErr ); - void ImplNotify( SoundNotification eNotification, ULONG nError ); - -public: - - SalSound(); - ~SalSound(); - - BOOL Create(); - static void Release(); - static BOOL IsValid() { return( SOUND_STATE_VALID == SalSound::mnSoundState ); } - - BOOL Init( SalFrame* pFrame, const String& rSoundName, ULONG& rSoundLen ); - BOOL Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen ); - void Play( ULONG nStartTime, ULONG nPlayTime, BOOL bLoop ); - void Stop(); - void Pause(); - - void SetNotifyProc( void* pInst, SALSOUNDPROC pProc ) - { mpInst = pInst; mpProc = pProc; } -}; - -#endif // _SV_SALSOUND_HXX diff --git a/vcl/os2/inc/salvd.h b/vcl/os2/inc/salvd.h deleted file mode 100644 index 8f841f941430..000000000000 --- a/vcl/os2/inc/salvd.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALVD_H -#define _SV_SALVD_H - -#include <vcl/sv.h> -#include <vcl/salvd.hxx> - -class Os2SalGraphics; - -// ----------------- -// - SalVirDevData - -// ----------------- - -//class SalVirDevData -class Os2SalVirtualDevice : public SalVirtualDevice -{ -public: - HPS mhPS; // HPS - HDC mhDC; // HDC - HBITMAP mhBmp; // Memory Bitmap - HBITMAP mhDefBmp; // Default Bitmap - Os2SalGraphics* mpGraphics; // current VirDev graphics - USHORT mnBitCount; // BitCount (0 or 1) - BOOL mbGraphics; // is Graphics used - - Os2SalVirtualDevice(); - virtual ~Os2SalVirtualDevice(); - - virtual SalGraphics* GetGraphics(); - virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual BOOL SetSize( long nNewDX, long nNewDY ); - virtual void GetSize( long& rWidth, long& rHeight ); -}; - -// Help-Functions -HBITMAP ImplCreateVirDevBitmap( HDC hDC, HPS hPS, long nDX, long nDY, - USHORT nBitCount ); - -#endif // _SV_SALVD_H diff --git a/vcl/os2/inc/svsys.h b/vcl/os2/inc/svsys.h deleted file mode 100644 index 39544b83d875..000000000000 --- a/vcl/os2/inc/svsys.h +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SVSYS_H -#define _SV_SVSYS_H - -#ifndef _SVPM_H -#include <svpm.h> -#endif - -#endif // _SV_SVSYS_H diff --git a/vcl/os2/inc/wingdi.h b/vcl/os2/inc/wingdi.h deleted file mode 100644 index d6085abbd262..000000000000 --- a/vcl/os2/inc/wingdi.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _WINGDI_ -#define _WINGDI_ - -typedef struct tagPOINT -{ - LONG x; - LONG y; -} POINT, *PPOINT, *LPPOINT; - - -typedef unsigned long DWORD; -typedef unsigned short WORD; -typedef struct -{ - WORD fract; - SHORT value; -} W32FIXED; - -typedef struct tagPOINTFX -{ - W32FIXED x; - W32FIXED y; -} POINTFX, *LPPOINTFX; - -typedef struct tagTTPOLYCURVE -{ - WORD wType; - WORD cpfx; - POINTFX apfx[1]; -} TTPOLYCURVE, *LPTTPOLYCURVE; - -typedef struct tagTTPOLYGONHEADER -{ - DWORD cb; - DWORD dwType; - POINTFX pfxStart; -} TTPOLYGONHEADER, *LPTTPOLYGONHEADER; - -typedef struct -{ - UINT gmBlackBoxX; - UINT gmBlackBoxY; - POINT gmptGlyphOrigin; - SHORT gmCellIncX; - SHORT gmCellIncY; -} GLYPHMETRICS, *LPGLYPHMETRICS; - -#define GGO_METRICS 0 -#define GGO_BITMAP 1 -#define GGO_NATIVE 2 -#define GGO_BEZIER 3 -#define GGO_GRAY2_BITMAP 4 -#define GGO_GRAY4_BITMAP 5 -#define GGO_GRAY8_BITMAP 6 -#define GGO_GLYPH_INDEX 0x80 - -#define TT_PRIM_LINE 1 -#define TT_PRIM_QSPLINE 2 -#define TT_PRIM_CSPLINE 3 -#define TT_POLYGON_TYPE 24 - -typedef struct -{ - W32FIXED eM11; - W32FIXED eM12; - W32FIXED eM21; - W32FIXED eM22; -} MAT2, *LPMAT2; - -#endif // _WINGDI_ diff --git a/vcl/os2/inc/xwphook.h b/vcl/os2/inc/xwphook.h deleted file mode 100644 index 07e00bd4c4c1..000000000000 --- a/vcl/os2/inc/xwphook.h +++ /dev/null @@ -1,620 +0,0 @@ - -/* - * xwphook.h: - * header for both xwphook.c and xwpdaemon.c. This is also - * included from a number of sources for XFLDR.DLL which need - * to interface (configure) the daemon. - */ - -/* - * Copyright (C) 1999-2002 Ulrich M”ller. - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, in version 2 as it comes in the COPYING - * file of the XWorkplace main distribution. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef XWPHOOK_HEADER_INCLUDED - #define XWPHOOK_HEADER_INCLUDED - - /* ****************************************************************** - * - * OS2.INI applications and keys - * - ********************************************************************/ - - #define INIAPP_XWPHOOK "XWorkplace:Hook" // added V0.9.0 - #define INIKEY_HOOK_HOTKEYS "Hotkeys" // added V0.9.0 - #define INIKEY_HOOK_CONFIG "Config" // added V0.9.0 - #define INIKEY_HOOK_PAGERCONFIG "PagerConfig" // V0.9.2 (2000-02-25) [umoeller] - // changed V0.9.19 (2002-05-07) [umoeller] - #define INIKEY_HOOK_PAGERWINPOS "PagerWinPos" - // changed V0.9.19 (2002-05-07) [umoeller] - #define INIKEY_HOOK_FUNCTIONKEYS "FuncKeys" // added V0.9.3 (2000-04-19) [umoeller] - #define INIKEY_HOOK_MOUSEMAPPINGS "MouseMappings" // added V0.9.19 (2002-04-20) [lafaix] - - /* ****************************************************************** - * - * Structures - * - ********************************************************************/ - - // do not change the following, or this will break - // binary compatibility of the XPager OS2.INI data - #define MAX_STICKIES 64 - #define STICKYLEN 50 - -#ifndef __NOPAGER__ - - // flags for PAGERCONFIG.aulStickyFlags - #define SF_CONTAINS 0x00000000L // default - #define SF_BEGINSWITH 0x00000001L - #define SF_ENDSWITH 0x00000002L - #define SF_EQUALS 0x00000004L - #define SF_MATCHES 0x00000008L // V0.9.19 (2002-04-17) [umoeller] - #define SF_OPERATOR_MASK 0x0000FFFFL - - #define SF_INCLUDE 0x00000000L // default - #define SF_EXCLUDE 0x00010000L - #define SF_CRITERIA_MASK 0x00010000L - - #define SF_TITLE 0x00000000L // default - #define SF_ATTRIBUTE_MASK 0xFFFE0000L - - #pragma pack(1) - - /* - *@@ PAGERCONFIG: - * XPager configuration data. - * This is stored within the HOOKDATA structure - * (statically in the hook DLL) so that both - * the daemon and the hook have access to this. - * - *@@added V0.9.2 (2000-02-25) [umoeller] - */ - - typedef struct _PAGERCONFIG - { - BYTE cDesktopsX, - cDesktopsY, - // no. of virtual Desktops (x and y) - bStartX, - bStartY; - // initial desktop at startup - - ULONG flPager; - // flags for "XPager" settings page 1 - #define PGRFL_WRAPAROUND 0x0001 - #define PGRFL_HOTKEYS 0x0002 - #define PGRFL_NOFOLLOWFOCUS 0x0004 - - #define PGRMASK_PAGE1 (PGRFL_WRAPAROUND | PGRFL_HOTKEYS) - #define PGRFL_PAGE1_DEFAULTS 0 - - // flags for "XPager" settings page 2 - #define PGRFL_PRESERVEPROPS 0x0010 - // preserve proportions of XPager win when resizing? - #define PGRFL_STAYONTOP 0x0020 - // stay on top? - #define PGRFL_FLASHTOTOP 0x0040 - #define PGRFL_MINIWINDOWS 0x0080 - // show mini windows in XPager? - #define PGRFL_MINIWIN_TITLES 0x0100 - // show mini window titles? - #define PGRFL_MINIWIN_MOUSE 0x0200 - // allow activate/lower by mouse clicks? - #define PGRFL_INCLUDESECONDARY 0x0400 - #define PGRFL_INCLUDESTICKY 0x0800 - #define PGRFL_MINIWIN_ICONS 0x1000 - // show mini window icons? - // V0.9.19 (2002-06-13) [umoeller] - - #define PGRMASK_PAGE2 ( PGRFL_PRESERVEPROPS \ - | PGRFL_STAYONTOP \ - | PGRFL_FLASHTOTOP \ - | PGRFL_MINIWINDOWS \ - | PGRFL_MINIWIN_TITLES \ - | PGRFL_MINIWIN_MOUSE \ - | PGRFL_INCLUDESECONDARY \ - | PGRFL_INCLUDESTICKY \ - | PGRFL_MINIWIN_ICONS ) - #define PGRFL_PAGE2_DEFAULTS ( PGRFL_PRESERVEPROPS \ - | PGRFL_MINIWINDOWS \ - | PGRFL_MINIWIN_TITLES \ - | PGRFL_MINIWIN_MOUSE) - - // flags for "XPager" settings page 3 - #define PGRFL_ADDSTICKYTOGGLE 0x2000 - // add "sticky" option to system menu? - // V1.0.0 (2002-09-14) [lafaix] - - #define PGRMASK_PAGE3 ( PGRFL_ADDSTICKYTOGGLE ) - #define PGRFL_PAGE3_DEFAULTS 0 - #define PGRFL_WINDOWS_KEYS 0x00010000 - // V1.0.3 (2004-10-14) [bird]: Use windows keys for left / right - - ULONG ulFlashDelay; - // "flash" delay in milliseconds, if PGRFL_FLASHTOTOP - ULONG flKeyShift; // KC_* values - - // paint settings - ULONG flPaintMode; // as in BKGNDINFO (gpih.h) - LONG lcolDesktop1, // as in BKGNDINFO (gpih.h) - lcolDesktop2; // as in BKGNDINFO (gpih.h) - - LONG lcolActiveDesktop; // color of hatching for active desktop - - LONG lcolGrid; // grid color (separators between desktops) - - LONG lcolInactiveWindow, - lcolActiveWindow, - lcolWindowFrame, - lcolInactiveText, - lcolActiveText; - - // sticky windows - ULONG cStickies; - ULONG aulStickyFlags[MAX_STICKIES]; // SF_* flags per sticky - CHAR aszStickies[MAX_STICKIES][STICKYLEN]; - - } PAGERCONFIG, *PPAGERCONFIG; - - #pragma pack() - -#endif - - // flags for HOOKCONFIG.usScrollMode - #define SM_LINEWISE 0 - #define SM_AMPLIFIED 1 - - // flags for HOOKCONFIG.ulAutoHideFlags - #define AHF_IGNOREMENUS 0x00000001L - #define AHF_IGNOREBUTTONS 0x00000002L - - // flags for HOOKCONFIG.ulAutoMoveFlags - #define AMF_ALWAYSMOVE 0x00000001L - #define AMF_IGNORENOBUTTON 0x00000002L - #define AMF_ANIMATE 0x00000004L - - /* - *@@ HOOKCONFIG: - * configuration data for the hook and the daemon. - * - * This is stored within the HOOKDATA structure - * (statically in the hook DLL) so that both - * the daemon and the hook have access to this. - * - * A mirror of this structure is put into OS2.INI - * which gets loaded by the XWorkplace settings - * objects in XFLDR.DLL to configure the hook. - * This gets (re)loaded by the daemon when XFLDR.DLL - * posts XDM_HOOKCONFIG to fnwpDaemonObject. - * - * So this is seen by the hook and the daemon; - * XFLDR.DLL only writes this back to OS2.INI and - * notifies the daemon to reload this. - * - * For every item, the safe default value is null - * so the structure can be zeroed to disable - * everything. - * - * If settings are added to this structure, they - * must be added to the bottom in order not to - * break binary compatibility between XWP versions. - * - * Note that the object hotkey _definitions_ are - * not part of this structure. Those are set using - * XDM_HOTKEYSCHANGED instead. However, object - * hotkeys are globally enabled in here (fGlobalHotkeys). - */ -#pragma pack(4) - typedef struct _HOOKCONFIG - { - // Sliding focus: - - PM_BOOL __fSlidingFocus; - // enabled? - ULONG __ulSlidingFocusDelay; - // delay in ms; 0 = off - - PM_BOOL __fSlidingBring2Top; - // bring windows to top or preserve Z-order - PM_BOOL __fSlidingIgnoreDesktop; - // ignore Desktop windows - PM_BOOL __fSlidingIgnoreSeamless; - // TRUE: ignore seamless Win-OS/2 windows - // FALSE: always bring them to top - - // Screen corner objects: - HOBJECT ahobjDummy[4]; // was four screen corner objects; - // we extended the array to 8 items - // so the array had to be moved to the - // bottom in order not to break binary - // compatibility - - BYTE bMonitorDrives[30]; // array of 1-byte BOOLs; if any of these - // is "1", the corresponding drive letter - // will be monitored for media change - // (index 1 = A, index 2 = B, index 3 = C, ...). - // Index 0 is unused to match logical drive numbers. - - // More mouse mappings: V0.9.1 (99-12-03) - - PM_BOOL fChordWinList; // deprecated V0.9.19 (2002-04-20) [lafaix] - // show window list on mb1+2 chord - PM_BOOL fSysMenuMB2TitleBar; // deprecated V0.9.19 (2002-04-20) [lafaix] - // show system menu on mb2 title-bar click - - // Mouse-button-3 scrolling: V0.9.1 (99-12-03) - - PM_BOOL fMB3Scroll; // deprecated V0.9.19 (2002-04-20) [lafaix] - // scroll window contents on MB3Drag - PM_BOOL fMB3ScrollReverse; // deprecated V0.9.19 (2002-04-20) [lafaix] - // reverse scrolling - USHORT usScrollMode; // deprecated V0.9.19 (2002-04-20) [lafaix] - // one of the following: - // -- SM_LINEWISE (0): scroll fixed, line-wise - // -- SM_AMPLIFIED (1): scroll amplified, relative to window size - USHORT usMB3ScrollMin; - // minimum pixels that mouse must be moved; - // 0 means 1, 1 means 2, ... - SHORT sAmplification; - // amplification (-9 thru +10) - // the amplification in percent is calculated like this: - // percent = 100 + (sAmplification * 10) - // so we get: - // 0 --> 100% - // 2 --> 120% - // 10 --> 200% - // -2 --> 80% - // -9 --> 10% - - // Auto-hide mouse pointer: V0.9.1 (99-12-03) - PM_BOOL __fAutoHideMouse; - ULONG __ulAutoHideDelay; - // delay in seconds; 0 means 1 second, 2 means 3, ... - - // Global object hotkeys enabled: - // this can be disabled even if any hotkeys are defined - // because the hotkeys themselves are stored separately - // in shared memory - PM_BOOL __fGlobalHotkeys; - - // XPager configuration - PM_BOOL fRemoved1, // _fXPagerStayOnTop, - fRemoved2; //__fSlidingIgnoreXPager; - // removed V0.9.19 (2002-05-07) [umoeller] - - // Sliding menus - PM_BOOL fSlidingMenus; - // enabled? - ULONG ulSubmenuDelay; - // delay in ms; 0 = off - PM_BOOL fMenuImmediateHilite; - - // Mouse-button-3 single-clicks to MB1 double-clicks - // V0.9.4 (2000-06-12) [umoeller] - PM_BOOL fMB3Click2MB1DblClk; // deprecated V0.9.19 (2002-04-20) [lafaix] - - // Screen corner objects: - // moved the array down here (there's a dummy above) - // V0.9.4 (2000-06-12) [umoeller] - HOBJECT ahobjHotCornerObjects[8]; - // Indices: - // 0 = lower left corner, - // 1 = top left corner, - // 2 = lower right corner, - // 3 = top right corner; - // borders added V0.9.4 (2000-06-12) [umoeller]: - // 4 = top border, - // 5 = left border, - // 6 = right border, - // 7 = bottom border. - // V0.9.18 (2002-02-12) [pr] - #define SCREENCORNER_MIN 0 - #define SCREENCORNER_BOTTOMLEFT 0 - #define SCREENCORNER_TOPLEFT 1 - #define SCREENCORNER_BOTTOMRIGHT 2 - #define SCREENCORNER_TOPRIGHT 3 - #define SCREENCORNER_TOP 4 - #define SCREENCORNER_LEFT 5 - #define SCREENCORNER_RIGHT 6 - #define SCREENCORNER_BOTTOM 7 - #define SCREENCORNER_MAX 7 - // If any item is NULLHANDLE, it means the - // corner is inactive (no function defined). - // If the hiword of the item is 0xFFFF, this - // means a special function has been defined: - // (#define's added V0.9.19 (2002-04-17) [umoeller]): - #define SPECIALOBJ_FIRST 0xFFFF0000 - #define SPECIALOBJ_SHOWWINDOWLIST 0xFFFF0000 - #define SPECIALOBJ_DESKTOPCONTEXTMENU 0xFFFF0001 - #define SPECIALOBJ_PAGER_SHOW 0xFFFF0002 - // the following added (2001-01-26) [lafaix] - #define SPECIALOBJ_PAGER_UP 0xFFFF0003 - #define SPECIALOBJ_PAGER_RIGHT 0xFFFF0004 - #define SPECIALOBJ_PAGER_DOWN 0xFFFF0005 - #define SPECIALOBJ_PAGER_LEFT 0xFFFF0006 - // the following added V0.9.18 [pr] - #define SPECIALOBJ_SCREENWRAP 0xFFFF0007 - // Otherwise (> 0 and < 0xFFFF0000), we have - // a "real" object handle, and a regular WPS - // object is to be opened. - - // special treatment for conditional-cascade submenus when - // using sliding menus (V0.9.6 (2000-10-27) [umoeller]) - PM_BOOL fConditionalCascadeSensitive; - - // more XPager configuration V0.9.7 (2000-12-08) [umoeller] - PM_BOOL fRemoved3; // __fSlidingIgnoreXCenter; - // removed V0.9.19 (2002-05-07) [umoeller] - - // screen corner objects sensitivity; in percent of the - // adjacents borders. 0 = off, 50 = borders objects disabled - // V0.9.9 (2001-03-15) [lafaix] - ULONG ulCornerSensitivity; - - // Mouse-button-3 autoscroll and push to bottom features - PM_BOOL fMB3AutoScroll; // deprecated V0.9.19 (2002-04-20) [lafaix] - PM_BOOL fMB3Push2Bottom; // deprecated V0.9.19 (2002-04-20) [lafaix] - - // Auto hide and automatic pointer movement options - // V0.9.14 (2001-08-02) [lafaix] - ULONG __ulAutoHideFlags; - PM_BOOL __fAutoMoveMouse; - ULONG __ulAutoMoveFlags; - ULONG __ulAutoMoveDelay; // V0.9.14 (2001-08-21) [umoeller] - ULONG __ulMouseMappingsCount; // V0.9.19 (2002-04-20) [lafaix] - } HOOKCONFIG, *PHOOKCONFIG; -#pragma pack() - - /* - *@@ GLOBALHOTKEY: - * single XWorkplace object hotkey definition. - * Arrays of this are allocated in shared memory and - * used by xwphook.c, xwpdaemn.c, and also XFldObject - * for hotkey manipulation and detection. - */ - - typedef struct _GLOBALHOTKEY - { - USHORT usFlags; - // Keyboard control codes: - // SHORT1FROMMP(mp1) of WM_CHAR, filtered. - // Only the following flags will be set: - // -- KC_CTRL - // -- KC_ALT - // -- KC_SHIFT - // -- KC_VIRTUALKEY - // -- KC_INVALIDCOMP: special flag used if the - // scan code represents one of the user-defined - // function keys in the XWPKeyboard object. - // KC_CTRL, KC_ALT, KC_SHIFT work always, - // no matter if we're in a PM or VIO session. - // However, for some reason, KC_VIRTUALKEY is - // never set in VIO sessions. We still store it - // in this structure though to be able to display - // the hotkey in the configuration pages. - // The hook will filter that out since the scan - // code is good enough to identify the key. - UCHAR ucScanCode; - // Hardware scan code: - // CHAR4FROMMP(mp1) of WM_CHAR. - // As opposed to what we do with folder hotkeys, - // this must be stored also, because we must use - // the scan code for WM_CHAR processing in the hook - // to identify hotkeys. We cannot use usKeyCode - // because that's different in VIO sessions, while - // this one is always the same. - // Even if any of Ctrl, Alt, Shift are pressed, this - // has the scan code of the additional key which was - // pressed. - USHORT usKeyCode; - // key code: - // if KC_VIRTUALKEY is set in usFlags, this has usvk, - // otherwise usch from WM_CHAR. - // This is only used to be able to display the hotkey - // in the hotkey configuration dialogs; we do _not_ use - // this to check WM_CHAR messages in the hook, because - // this is different between PM and VIO sessions. - ULONG ulHandle; - // handle to post to thread-1 object window (kernel.c); - // this is normally the HOBJECT of the object to be - // opened. - } GLOBALHOTKEY, *PGLOBALHOTKEY; - - /* - *@@ MOUSEMAPPING: - * single XWorkplace mouse mapping definition. - * Arrays of this are allocated in shared memory and - * used by xwphook.c, xwpdaemn.c, and also XWPMouse - * for mouse mappings manipulation and detection. - * - *@@added V0.9.19 (2002-04-20) [lafaix] - */ - - typedef struct _MOUSEMAPPING - { - USHORT usEvent; - // One of the MME_* values (or MME_XBUTTON_FIRST+n - // to denote extra button n, 0 <= n < 32). - // standard mouse events - #define MME_BUTTON1CLICK 0x0001 - #define MME_BUTTON2CLICK 0x0002 - #define MME_BUTTON3CLICK 0x0003 - #define MME_BUTTON1DRAG 0x0004 - #define MME_BUTTON2DRAG 0x0005 - #define MME_BUTTON3DRAG 0x0006 - #define MME_CHORD 0x0007 - // wheel/stick events - #define MME_UP 0x1001 - #define MME_DOWN 0x1002 - #define MME_LEFT 0x1003 - #define MME_RIGHT 0x1004 - // the 2X and 3X variants are handy when mapping an action - // to a wheel/stick movement. They map at least 2 (or 3) - // consecutive events, and hence disambiguate an unexpected - // wheel/stick event. - #define MME_UP2X 0x2001 - #define MME_DOWN2X 0x2002 - #define MME_LEFT2X 0x2003 - #define MME_RIGHT2X 0x2004 - #define MME_UP3X 0x3001 - #define MME_DOWN3X 0x3002 - #define MME_LEFT3X 0x3003 - #define MME_RIGHT3X 0x3004 - // extra buttons - #define MME_XBUTTON_FIRST 0x4000 - // type helpers - #define MME_TYPE_MASK 0xF000 - #define MME_TYPE_STANDARD 0x0000 - #define MME_TYPE_WHEEL 0x1000 - #define MME_TYPE_WHEEL2X 0x2000 - #define MME_TYPE_WHEEL3X 0x3000 - #define MME_TYPE_XBUTTON 0x4000 - #define MME_TYPE_DISABLED 0x8000 - - USHORT usModifiers; - // A possibly empty combination of KC_SHIFT, KC_CTRL, - // and KC_ALT. - CHAR achLocation[32]; - // The class name upon which this mapping applies. - // An empty location (i.e., achLocation[0] = 0) means - // a global mapping. - CHAR achPluginName[8]; - // The plugin library providing the action defined for - // this mapping. An empty location (i.e., - // achPluginName[0] = 0) means a buildin action. - USHORT usAction; - // The action (relative to the plugin) defined for - // this event. - BYTE abSetup[16]; - // A private area possibly refining the action. - } MOUSEMAPPING, *PMOUSEMAPPING; - - /* - *@@ FUNCTIONKEY: - * XWorkplace function key description. - * An array of these is returned by - * hifQueryFunctionKeys(). - * - *@@added V0.9.3 (2000-04-19) [umoeller] - */ - - typedef struct _FUNCTIONKEY - { - UCHAR ucScanCode; // hardware scan code; - // CHAR4FROMMP(mp1) of WM_CHAR - CHAR szDescription[30]; // key description (e.g. "Win left") - PM_BOOL fModifier; // TRUE if the scan code represents - // a modifier key which can be pressed - // together with another key, similar - // to Ctrl or Alt or Del; this will - // allow us to do things like "WinLeft + C" - } FUNCTIONKEY, *PFUNCTIONKEY; - - /* ****************************************************************** - * - * Messages - * - ********************************************************************/ - - #define XDM_HOOKINSTALL (WM_USER + 400) - - #define XDM_DESKTOPREADY (WM_USER + 401) - - #define XDM_HOOKCONFIG (WM_USER + 402) - -#ifndef __NOPAGER__ - #define XDM_STARTSTOPPAGER (WM_USER + 403) - - #define XDM_PAGERCONFIG (WM_USER + 404) - // flags for XDM_PAGERCONFIG: - #define PGRCFG_REPAINT 0x0001 // invalidates mini windows - #define PGRCFG_REFORMAT 0x0004 // causes PGRM_POSITIONFRAME, - // repaints background too - #define PGRCFG_STICKIES 0x0008 // sticky windows have changed -#endif - - #define XDM_HOTKEYPRESSED (WM_USER + 405) - - #define XDM_HOTKEYSCHANGED (WM_USER + 406) - - #define XDM_FUNCTIONKEYSCHANGED (WM_USER + 407) - -#ifndef __NOSLIDINGFOCUS__ - #define XDM_SLIDINGFOCUS (WM_USER + 408) -#endif - - #define XDM_SLIDINGMENU (WM_USER + 409) - - #define XDM_HOTCORNER (WM_USER + 410) - - #define XDM_WMCHORDWINLIST (WM_USER + 411) - - // added V0.9.9 (2001-03-18) [lafaix] - #define XDM_BEGINSCROLL (WM_USER + 413) - #define XDM_SETPOINTER (WM_USER + 414) - #define XDM_ENDSCROLL (WM_USER + 415) - - // added V0.9.12 (2001-05-12) [umoeller] - #define XDM_RECOVERWINDOWS (WM_USER + 416) - - #define XDM_ADDDISKWATCH (WM_USER + 417) - - /* - *@@ ADDDISKWATCH: - * struct used with XDM_ADDDISKWATCH. - * - *@@added V0.9.14 (2001-08-01) [umoeller] - */ - - typedef struct _ADDDISKWATCH - { - ULONG ulLogicalDrive; // disk to be monitored - HWND hwndNotify; // window to be notified on change - ULONG ulMessage; // message to be posted to window - } ADDDISKWATCH, *PADDDISKWATCH; - - #define XDM_REMOVEDISKWATCH (WM_USER + 418) - - #define XDM_QUERYDISKS (WM_USER + 419) - - #define XDM_ADDCLICKWATCH (WM_USER + 420) - - #define XDM_MOUSECLICKED (WM_USER + 421) - -#ifndef __NOMOVEMENT2FEATURES__ - #define XDM_MOVEPTRTOBUTTON (WM_USER + 422) -#endif - - #define XDM_DISABLEHOTKEYSTEMP (WM_USER + 423) - - #define XDM_STARTAPP (WM_USER + 424) - - #define XDM_ADDWINLISTWATCH (WM_USER + 425) - - #define XDM_WINDOWCHANGE (WM_USER + 426) - - #define XDM_ICONCHANGE (WM_USER + 427) - - #define XDM_QUERYWINLIST (WM_USER + 428) - - #define XDM_REMOVEWINLISTWATCH (WM_USER + 429) // V0.9.19 (2002-06-14) [lafaix] - - #define XDM_REMOVECLICKWATCH (WM_USER + 430) // V0.9.19 (2002-06-14) [lafaix] - -#ifndef __NOPAGER__ - #define XDM_TOGGLETRANSIENTSTICKY (WM_USER + 431) // V1.0.0 (2002-07-26) [lafaix] - #define XDM_ISTRANSIENTSTICKY (WM_USER + 432) -#endif - - #define XDM_NLSCHANGED (WM_USER + 433) // V1.0.0 (2002-09-15) [lafaix] -#endif - - - diff --git a/vcl/os2/source/app/makefile.mk b/vcl/os2/source/app/makefile.mk deleted file mode 100644 index 80aeb7f568fb..000000000000 --- a/vcl/os2/source/app/makefile.mk +++ /dev/null @@ -1,59 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=SV -TARGET=salapp - -# --- Settings ----------------------------------------------------- - -#.INCLUDE : svpre.mk -.INCLUDE : settings.mk -#.INCLUDE : sv.mk -.INCLUDE : $(PRJ)$/util$/makefile2.pmk - - -# --- Files -------------------------------------------------------- - -YD00_CXXFILES=\ - salshl.cxx \ - salinst.cxx \ - sallang.cxx \ - saltimer.cxx \ - salsys.cxx - -SLOFILES= $(SLO)$/salshl.obj \ - $(SLO)$/printf.obj \ - $(SLO)$/salinfo.obj \ - $(SLO)$/salinst.obj \ - $(SLO)$/sallang.obj \ - $(SLO)$/saltimer.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/vcl/os2/source/app/printf.c b/vcl/os2/source/app/printf.c deleted file mode 100644 index 7cfcf4efc559..000000000000 --- a/vcl/os2/source/app/printf.c +++ /dev/null @@ -1,284 +0,0 @@ -/* ----------------------------------------------------------------- */ -/* PRINTF: diverts PRINTF calls to an OS/2 Named Queue */ -/* Copyright (c) IBM Corporation, 1991, 1992 */ -/* ----------------------------------------------------------------- */ -/* This version for OS/2 2.x, 32-bit programs. Mike Cowlishaw */ -/* */ -/* This routine, when linked into an .EXE instead of the usual C */ -/* runtime, sends the edited result string to a named queue (if */ -/* it exists). If the queue does not exist, then all printf data */ -/* are discarded (ignored). */ -/* */ -/* The result string is accumulated until a line feed (LF) character */ -/* is received; the whole line is then sent to the queue. Lines are */ -/* automatically broken at a set (tailorable) length, if necessary. */ -/* */ -/* This routine may be tailored by altering the #defines at the */ -/* top: */ -/* */ -/* PRINTFID - An ID string that is prefixed to each line of */ -/* data before being sent to the queue. This */ -/* can be any string, or the null string. */ -/* PRINTFMAXLEN - Maximum length of string that can be formatted */ -/* in a single call. */ -/* Results are unpredictable if this length is */ -/* exceeded. Default is 250. */ -/* PRINTFLINELEN - Maximum length of a line that will be sent. */ -/* This excludes the prefix and its blank. If the */ -/* calls to printf cause a line to be generated */ -/* that is longer than this, the line will be */ -/* broken at this point. */ -/* PRINTFTHREADS - Maximum number of threads expected. This may */ -/* need to be increased if the process limitation */ -/* is removed, or you can save a little storage */ -/* by decreasing it. PRINTFs from threads larger */ -/* than this number are ignored. */ -/* PRINTFQNAME - The name of the public queue that the result */ -/* is to be sent to. Normally '\QUEUES\PRINTF32'. */ -/* Note that the \QUEUES\ part is required. */ -/* */ -/* Returns: */ -/* n: Count of data characters, if successfully received */ -/* 0: If no queue existed (i.e., no server) */ -/* <0: An error occurred (e.g., out of memory) */ -/* */ -/* Restrictions: */ -/* 1. Total length of data (length of PRINTFID, + PRINTFMAXLEN) */ -/* must be less than 32K-1. */ -/* 2. This has only been tested under IBM C Set/2 compiler. It */ -/* may need modification for other compilers. */ -/* 3. This version uses a static array to point to the per-thread */ -/* data. The code could be made read-only by hanging this */ -/* array (and the other static information) off a system-owned */ -/* anchor of some kind. */ -/* 4. To use PRINTF within other than the main thread in a */ -/* program, that thread must be started with _beginthread */ -/* (not DosCreateThread). This restriction is a consequence of */ -/* the use of C library routines (sprintf) in PRINTF, and may */ -/* not apply to all compilers. */ -/* 5. If the last PRINTF done by a thread does not end in '\n' */ -/* then the final part-line may be lost, or appear later. */ -/* */ -/* Protocol: */ -/* PRINTF writes its data to the named queue using the following */ -/* protocol: */ -/* Address -- Holds the address of the string to be sent. This */ -/* is a 0-terminated string) starting at offset 0. */ -/* Length -- The length of the data, including terminator. */ -/* A negative length indicates a BELL in the data. */ -/* Request -- Timestamp (when queue was written) in C long */ -/* integer format (as returned by time()). */ -/* This may be 0L if not required. */ -/* */ -/* Notes: */ -/* 1. PMPRINTF uses a queue and shared memory messages because: */ -/* (a) It makes collection at the receiving end very easy. */ -/* (b) I wanted to experiment with queues and shared memory. */ -/* This make not be the most cost-effective method. */ -/* 2. Typical IBM C Set/2 compiler invocation: */ -/* icc /c /Gm /O+ /Q /J /Kabgop */ -/* If you get linking errors (duplicate symbols, etc.), try */ -/* recompiling PRINTF.C with the same options as you use for */ -/* your main program. */ -/* 3. PRINTF sends the timestamp across the queue as a GMT long */ -/* integer, the result from a call to the C function time(). */ -/* This will only be correct if the environment variable TZ has */ -/* been set (e.g., TZ=EST5EDT), or you are in the same time */ -/* zone as the default for your compiler. */ -/* For more information, see the tzset() function description */ -/* in your C compiler manual. */ - -/* ----- Customization variables ----- */ -#define PRINTFID "" -#define PRINTFMAXLEN 300 -#define PRINTFLINELEN 100 -#define PRINTFTHREADS 54 -#define PRINTFQNAME "\\QUEUES\\PRINTF32" - -/* ----- Includes and externals ----- */ -#include <stdlib.h> /* standard C functions */ -#include <stddef.h> /* .. */ -#include <string.h> /* .. */ -#include <time.h> /* .. */ -#include <stdarg.h> /* .. */ -#include <stdio.h> /* (needed to pick up real name) */ -#define INCL_DOS /* Operating system definitions */ -#include <os2.h> /* For OS/2 functions */ - -#define max(a,b) (a>b ? a : b) - -/* ----- Local defines ----- */ -#define PRINTFIDSIZE sizeof(PRINTFID) -#define PRINTFMAXBUF PRINTFIDSIZE+PRINTFLINELEN - -/* ----- Per-thread output buffer and current indices into line ---- */ -struct perthread { - LONG lineindex; /* where next char */ - LONG tidemark; /* rightmost char */ - int bell; /* TRUE if line has bell */ - UCHAR line[PRINTFMAXBUF]; /* accumulator */ - }; - -/* ----- Local static variables ----- */ -static ULONG ourpid=0; /* our process ID */ -static ULONG servepid=0; /* process IDs of the server */ -static HQUEUE qhandle=0; /* handle for the queue */ -static struct perthread *tps[PRINTFTHREADS+1]; /* -> per-thread data */ - -/* ----- Local subroutine ----- */ -static int printf_(struct perthread *); - -/* ----------------------------------------------------------------- */ -/* The "printf" function. Note this has a variable number of */ -/* arguments. */ -/* ----------------------------------------------------------------- */ -int debug_printf(const char *f, ...) - { - TIB *ptib; /* process/thread id structures */ - PIB *ppib; /* .. */ - TID ourtid; /* thread ID */ - struct perthread *tp; /* pointer to per-thread data */ - int rc; /* returncode */ - ULONG urc; /* returncode */ - - urc=DosOpenQueue(&servepid, &qhandle, PRINTFQNAME); /* Open the Q */ - /* Non-0 RC means Q does not exist or cannot be opened */ - if (urc==343) return 0; /* queue does not exist, so quit */ - if (urc!=0) return -1; /* report any other error */ - - /* First determine our thread ID (and hence get access to the */ - /* correct per-thread data. If the per-thread data has not been */ - /* allocated, then allocate it now. It is never freed, once */ - /* allocated, as PRINTF is not notified of end-of-thread. */ - DosGetInfoBlocks(&ptib,&ppib); /* get process/thread info */ - ourtid=ptib->tib_ptib2->tib2_ultid; /* .. and copy TID */ - if (ourtid>PRINTFTHREADS) /* too many threads .. */ - return 0; /* .. so quit, quietly */ - tp=tps[ourtid]; /* copy to local pointer */ - if (tp==NULL) { /* uninitialized (NULL=0) */ - /* allocate a per-thread structure */ - tp=(struct perthread *)malloc(sizeof(struct perthread)); - if (tp==NULL) return -1; /* out of memory -- return error */ - tps[ourtid]=tp; /* save for future calls */ - strcpy(tp->line,PRINTFID); /* initialize: line.. */ - tp->lineindex=PRINTFIDSIZE-1; /* ..where next char */ - tp->tidemark =PRINTFIDSIZE-2; /* ..rightmost char */ - tp->bell=FALSE; /* ..if line has bell */ - if (ourpid==0) ourpid=ppib->pib_ulpid; /* save PID for all to use */ - } - - { /* Block for declarations -- only needed if queue exists, etc. */ - LONG count; /* count of characters formatted */ - UCHAR buffer[PRINTFMAXLEN+1]; /* formatting area */ - LONG i, newind; /* work */ - UCHAR ch; /* .. */ - va_list argptr; /* -> variable argument list */ - - va_start(argptr, f); /* get pointer to argument list */ - count=vsprintf(buffer, f, argptr); - va_end(argptr); /* done with variable arguments */ - - if (count<0) return count-1000;/* bad start */ - - if (count>PRINTFMAXLEN) { - /* Disaster -- we are probably "dead", but just in case we */ - /* are not, carry on with truncated data. */ - count=PRINTFMAXLEN; - } - buffer[count]='\0'; /* ensure terminated */ - /* OK, ready to go with the data now in BUFFER */ - /* We copy from the formatted string to the output (line) buffer, */ - /* taking note of certain control characters and sending a line */ - /* the queue whenever we see a LF control, or when the line */ - /* fills (causing a forced break). */ - for (i=0; ; i++) { - ch=buffer[i]; if (!ch) break; - switch(ch) { - case '\r': /* carriage return */ - tp->lineindex=PRINTFIDSIZE-1; /* back to start of line */ - break; - case '\n': /* new line */ - case '\f': /* form feed */ - rc=printf_(tp); /* print a line */ - if (rc!=0) return rc; /* error */ - break; - case '\t': /* tab */ - newind=tp->lineindex-PRINTFIDSIZE+1; /* offset into data */ - newind=tp->lineindex+5-newind%5; /* new index requested */ - if (newind>=PRINTFMAXBUF) newind=PRINTFMAXBUF; /* clamp */ - for (; tp->lineindex<newind; tp->lineindex++) { - if (tp->lineindex>tp->tidemark) { /* beyond current end */ - tp->line[tp->lineindex]=' '; /* add space */ - tp->tidemark=tp->lineindex; - } - } - break; - case '\v': /* vertical tab */ - /* ignore it */ - break; - case '\b': /* backspace */ - tp->lineindex=max(tp->lineindex-1,PRINTFIDSIZE); - break; - case '\a': /* alert (bell) */ - tp->bell=TRUE; - break; - default: /* ordinary character */ - tp->line[tp->lineindex]=ch; - if (tp->lineindex>tp->tidemark) /* is rightmost.. */ - tp->tidemark=tp->lineindex; - tp->lineindex++; /* step for next */ - } /* switch */ - if (tp->lineindex>=PRINTFMAXBUF) { - rc=printf_(tp); /* print a line */ - if (rc!=0) return rc; /* error */ - } - - } /* copy loop */ - return count; /* all formatted data processed */ - } /* block */ - } /* printf */ - -/* ----- printf_(tp) -- Local subroutine to send a line ------------ */ -/* A line has been completed (or overflowed): write it to the queue. */ -int printf_(struct perthread *tp) /* pointer to per-thread data */ - { - ULONG urc; /* unsigned returncode */ - PSZ pszTo, pszFrom; /* character pointers */ - PVOID addr; /* address of output data */ - long size; /* total size of output data */ - time_t timenow; /* holds current time */ - - tp->line[tp->tidemark+1]='\0'; /* add terminator */ - size=tp->tidemark+2; /* total length of data */ - - /* Get some shared memory that can be given away */ - urc=DosAllocSharedMem(&addr, NULL, (unsigned)size, - OBJ_GIVEABLE|PAG_WRITE|PAG_COMMIT); - if (urc!=0) return -2; /* error */ - - pszTo=addr; /* copy for clarity */ - pszFrom=&(tp->line[0]); /* pointer to source */ - strcpy(pszTo,pszFrom); /* copy the string to shared memory */ - - if (ourpid!=servepid) { /* (no giveaway needed if to self) */ - urc=DosGiveSharedMem(addr, servepid, PAG_READ); /* give access */ - if (urc!=0) return -3;} /* error */ - - /* Write the selector, size, and timestamp to the queue */ - if (tp->bell) size=-size; /* BELL passed by negation */ - time(&timenow); /* optional - else use 0 */ - urc=DosWriteQueue(qhandle, /* handle */ - (unsigned)timenow, /* 'request' (timestamp) */ - (unsigned)size, /* 'length' (length/bell) */ - addr, /* 'address' (address) */ - 0); /* priority (FIFO if enabled) */ - if (urc!=0) return -4; /* error */ - if (ourpid!=servepid) { /* if given away.. */ - urc=DosFreeMem(addr); /* .. *we* are done with it */ - if (urc!=0) return -5;} /* error */ - /* Reset the line buffer and indices */ - tp->lineindex=PRINTFIDSIZE-1; /* where next char */ - tp->tidemark =PRINTFIDSIZE-2; /* rightmost char */ - tp->bell =FALSE; /* true if line has bell */ - return 0; /* success! */ - } /* printf_ */ diff --git a/vcl/os2/source/app/salinfo.cxx b/vcl/os2/source/app/salinfo.cxx deleted file mode 100644 index e48aacd4c521..000000000000 --- a/vcl/os2/source/app/salinfo.cxx +++ /dev/null @@ -1,182 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define INCL_PM -#define INCL_DOS -#define INCL_GPI -#include <svpm.h> - -#include <tools/string.hxx> -#include <salsys.h> -#include <salframe.h> -#include <salinst.h> -#include "saldata.hxx" -#include <tools/debug.hxx> -#include <vcl/svdata.hxx> -#include <rtl/ustrbuf.hxx> -#include "vcl/window.hxx" - -#ifndef _SV_SALGTYPE_HXX -//#include <salgtype.hxx> -#endif - -#define CHAR_POINTER(THE_OUSTRING) ::rtl::OUStringToOString (THE_OUSTRING, RTL_TEXTENCODING_UTF8).pData->buffer - -class Os2SalSystem : public SalSystem -{ -public: - Os2SalSystem() {} - virtual ~Os2SalSystem(); - - virtual unsigned int GetDisplayScreenCount(); - virtual Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ); - //virtual bool GetSalSystemDisplayInfo( DisplayInfo& rInfo ); - - virtual bool IsMultiDisplay(); - virtual unsigned int GetDefaultDisplayNumber(); - virtual Rectangle GetDisplayWorkAreaPosSizePixel( unsigned int nScreen ); - virtual rtl::OUString GetScreenName( unsigned int nScreen ); - - virtual int ShowNativeMessageBox( const String& rTitle, - const String& rMessage, - int nButtonCombination, - int nDefaultButton); -}; - -SalSystem* Os2SalInstance::CreateSalSystem() -{ - return new Os2SalSystem(); -} - -Os2SalSystem::~Os2SalSystem() -{ -} - -// ----------------------------------------------------------------------- -#if 0 -bool Os2SalSystem::GetSalSystemDisplayInfo( DisplayInfo& rInfo ) -{ - HDC hDC; - if( hDC = WinQueryWindowDC(HWND_DESKTOP) ) - { - LONG bitCount; - DevQueryCaps(hDC, CAPS_COLOR_BITCOUNT, CAPS_COLOR_BITCOUNT, &bitCount); - rInfo.nWidth = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); - rInfo.nHeight = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ); - rInfo.nDepth = bitCount; - return true; - } - else - return false; -} -#endif - -unsigned int Os2SalSystem::GetDisplayScreenCount() -{ - return 1; -} - -Rectangle Os2SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) -{ - Rectangle aRet; - aRet = Rectangle( Point(), Point( WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ), - WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ) ) ); - return aRet; -} - -// ----------------------------------------------------------------------- -/* We have to map the button identifier to the identifier used by the Os232 - Platform SDK to specify the default button for the MessageBox API. - The first dimension is the button combination, the second dimension - is the button identifier. -*/ -static int DEFAULT_BTN_MAPPING_TABLE[][8] = -{ - // Undefined OK CANCEL ABORT RETRY IGNORE YES NO - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1 }, //OK - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1 }, //OK_CANCEL - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3, MB_DEFBUTTON1, MB_DEFBUTTON1 }, //ABORT_RETRY_IGNO - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON3, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON2 }, //YES_NO_CANCEL - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON2 }, //YES_NO - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1 } //RETRY_CANCEL -}; - -static int COMBI_BTN_MAPPING_TABLE[] = -{ - MB_OK, MB_OKCANCEL, MB_ABORTRETRYIGNORE, MB_YESNO, MB_YESNOCANCEL, MB_RETRYCANCEL -}; - -int Os2SalSystem::ShowNativeMessageBox(const String& rTitle, const String& rMessage, int nButtonCombination, int nDefaultButton) -{ - DBG_ASSERT( nButtonCombination >= SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK && - nButtonCombination <= SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL && - nDefaultButton >= SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK && - nDefaultButton <= SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, "Invalid arguments!" ); - - int nFlags = MB_APPLMODAL | MB_WARNING | COMBI_BTN_MAPPING_TABLE[nButtonCombination]; - - if (nButtonCombination >= SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK && - nButtonCombination <= SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL && - nDefaultButton >= SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK && - nDefaultButton <= SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO) - nFlags |= DEFAULT_BTN_MAPPING_TABLE[nButtonCombination][nDefaultButton]; - - //#107209 hide the splash screen if active - ImplSVData* pSVData = ImplGetSVData(); - if (pSVData->mpIntroWindow) - pSVData->mpIntroWindow->Hide(); - - return WinMessageBox( - HWND_DESKTOP, HWND_DESKTOP, - (PSZ)CHAR_POINTER(rMessage), - (PSZ)CHAR_POINTER(rTitle), - 0, nFlags); -} - - -unsigned int Os2SalSystem::GetDefaultDisplayNumber() -{ - return 0; -} - -bool Os2SalSystem::IsMultiDisplay() -{ - return false; -} - -Rectangle Os2SalSystem::GetDisplayWorkAreaPosSizePixel( unsigned int nScreen ) -{ - return GetDisplayScreenPosSizePixel( nScreen ); -} - -rtl::OUString Os2SalSystem::GetScreenName( unsigned int nScreen ) -{ - rtl::OUStringBuffer aBuf( 32 ); - aBuf.appendAscii( "VirtualScreen " ); - aBuf.append( sal_Int32(nScreen) ); - return aBuf.makeStringAndClear(); -} diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx deleted file mode 100644 index 9d74f281d680..000000000000 --- a/vcl/os2/source/app/salinst.cxx +++ /dev/null @@ -1,861 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define INCL_DOSMISC -#define INCL_DOSMODULEMGR -#define INCL_DOSPROCESS - -#include <string.h> -#include <svpm.h> -#include <process.h> - -#define _SV_SALINST_CXX - -#ifndef _VOS_MUTEX_HXX -#include <vos/mutex.hxx> -#endif -#include <tools/debug.hxx> - -#ifndef _SV_SALIDS_HRC -#include <salids.hrc> -#endif -#include <vcl/apptypes.hxx> -#include <saldata.hxx> -#include <salinst.h> -#include <salframe.h> -#include <salobj.h> -#include <saltimer.h> -#include <salbmp.h> -#include <vcl/salimestatus.hxx> -#include <vcl/timer.hxx> -#include <tools/solarmutex.hxx> - -// ======================================================================= - -void SalAbort( const XubString& rErrorText ) -{ - ImplFreeSalGDI(); - - if( !rErrorText.Len() ) - fprintf( stderr, "Application Error " ); - else - fprintf( stderr, "%s ", - ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() ); - abort(); -} - -// ======================================================================= - -ULONG GetCurrentThreadId() -{ - PTIB pptib = NULL; - PPIB pppib = NULL; - - DosGetInfoBlocks( &pptib, &pppib ); - return pptib->tib_ptib2->tib2_ultid; -} - -// ======================================================================= - -MRESULT EXPENTRY SalComWndProc( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 ); - -// ======================================================================= - -class SalYieldMutex : public vos::OMutex -{ -public: - Os2SalInstance* mpInstData; - ULONG mnCount; - ULONG mnThreadId; - -public: - SalYieldMutex( Os2SalInstance* pInstData ); - - virtual void SAL_CALL acquire(); - virtual void SAL_CALL release(); - virtual sal_Bool SAL_CALL tryToAcquire(); - - ULONG GetAcquireCount( ULONG nThreadId ); -}; - -// ----------------------------------------------------------------------- - -SalYieldMutex::SalYieldMutex( Os2SalInstance* pInstData ) -{ - mpInstData = pInstData; - mnCount = 0; - mnThreadId = 0; -} - -// ----------------------------------------------------------------------- - -void SalYieldMutex::acquire() -{ - OMutex::acquire(); - mnCount++; - mnThreadId = GetCurrentThreadId(); -} - -// ----------------------------------------------------------------------- - -void SalYieldMutex::release() -{ - ULONG nThreadId = GetCurrentThreadId(); - if ( mnThreadId != nThreadId ) - OMutex::release(); - else - { - SalData* pSalData = GetSalData(); - if ( pSalData->mnAppThreadId != nThreadId ) - { - if ( mnCount == 1 ) - { - mpInstData->mpSalWaitMutex->acquire(); - if ( mpInstData->mnYieldWaitCount ) - WinPostMsg( mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 ); - mnThreadId = 0; - mnCount--; - OMutex::release(); - mpInstData->mpSalWaitMutex->release(); - } - else - { - mnCount--; - OMutex::release(); - } - } - else - { - if ( mnCount == 1 ) - mnThreadId = 0; - mnCount--; - OMutex::release(); - } - } -} - -// ----------------------------------------------------------------------- - -sal_Bool SalYieldMutex::tryToAcquire() -{ - if ( OMutex::tryToAcquire() ) - { - mnCount++; - mnThreadId = GetCurrentThreadId(); - return sal_True; - } - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -ULONG SalYieldMutex::GetAcquireCount( ULONG nThreadId ) -{ - if ( nThreadId == mnThreadId ) - return mnCount; - else - return 0; -} - -// ----------------------------------------------------------------------- - -void ImplSalYieldMutexAcquireWithWait() -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( !pInst ) - return; - - // If we are the main thread, then we must wait with wait, because - // in if we don't reschedule, then we create deadlocks if a Windows - // Function is called from another thread. If we arn't the main thread, - // than we call qcquire directly. - ULONG nThreadId = GetCurrentThreadId(); - SalData* pSalData = GetSalData(); - if ( pSalData->mnAppThreadId == nThreadId ) - { - // Wenn wir den Mutex nicht bekommen, muessen wir solange - // warten, bis wir Ihn bekommen - BOOL bAcquire = FALSE; - do - { - if ( pInst->mpSalYieldMutex->tryToAcquire() ) - bAcquire = TRUE; - else - { - pInst->mpSalWaitMutex->acquire(); - if ( pInst->mpSalYieldMutex->tryToAcquire() ) - { - bAcquire = TRUE; - pInst->mpSalWaitMutex->release(); - } - else - { - pInst->mnYieldWaitCount++; - pInst->mpSalWaitMutex->release(); - QMSG aTmpMsg; - WinGetMsg( pSalData->mhAB, &aTmpMsg, pInst->mhComWnd, SAL_MSG_RELEASEWAITYIELD, SAL_MSG_RELEASEWAITYIELD ); - pInst->mnYieldWaitCount--; - if ( pInst->mnYieldWaitCount ) - WinPostMsg( pInst->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0 , 0 ); - } - } - } - while ( !bAcquire ); - } - else - pInst->mpSalYieldMutex->acquire(); -} - -// ----------------------------------------------------------------------- - -BOOL ImplSalYieldMutexTryToAcquire() -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( pInst ) - return pInst->mpSalYieldMutex->tryToAcquire(); - else - return FALSE; -} - -// ----------------------------------------------------------------------- - -void ImplSalYieldMutexAcquire() -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( pInst ) - pInst->mpSalYieldMutex->acquire(); -} - -// ----------------------------------------------------------------------- - -void ImplSalYieldMutexRelease() -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( pInst ) - pInst->mpSalYieldMutex->release(); -} - -// ----------------------------------------------------------------------- - -ULONG ImplSalReleaseYieldMutex() -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( !pInst ) - return 0; - - SalYieldMutex* pYieldMutex = pInst->mpSalYieldMutex; - ULONG nCount = pYieldMutex->GetAcquireCount( GetCurrentThreadId() ); - ULONG n = nCount; - while ( n ) - { - pYieldMutex->release(); - n--; - } - - return nCount; -} - -// ----------------------------------------------------------------------- - -void ImplSalAcquireYieldMutex( ULONG nCount ) -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( !pInst ) - return; - - SalYieldMutex* pYieldMutex = pInst->mpSalYieldMutex; - while ( nCount ) - { - pYieldMutex->acquire(); - nCount--; - } -} - -// ----------------------------------------------------------------------- - -bool Os2SalInstance::CheckYieldMutex() -{ - bool bRet = true; - SalData* pSalData = GetSalData(); - ULONG nCurThreadId = GetCurrentThreadId(); - if ( pSalData->mnAppThreadId != nCurThreadId ) - { - if ( pSalData->mpFirstInstance ) - { - SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; - if ( pYieldMutex->mnThreadId != nCurThreadId ) - { - bRet = false; - } - } - } - else - { - if ( pSalData->mpFirstInstance ) - { - SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; - if ( pYieldMutex->mnThreadId != nCurThreadId ) - { - bRet = false; - } - } - } - return bRet; -} - -// ======================================================================= - -void InitSalData() -{ - SalData* pSalData = new SalData; - memset( pSalData, 0, sizeof( SalData ) ); - SetSalData( pSalData ); -} - -// ----------------------------------------------------------------------- - -void DeInitSalData() -{ - SalData* pSalData = GetSalData(); - if ( pSalData->mpFontMetrics ) - delete pSalData->mpFontMetrics; - delete pSalData; - SetSalData( NULL ); -} - -// ----------------------------------------------------------------------- - -void InitSalMain() -{ - PPIB pib; - PTIB tib; - HAB hAB; - HMQ hMQ; - SalData* pData = GetAppSalData(); -#if OSL_DEBUG_LEVEL>0 -printf("InitSalMain\n"); -#endif - - // morph application to PM - DosGetInfoBlocks(&tib, &pib); - // Change flag from VIO to PM: - if (pib->pib_ultype==2) pib->pib_ultype = 3; - - // create anchor block - hAB = WinInitialize( 0 ); - if ( !hAB ) - return; - - // create message queue - hMQ = WinCreateMsgQueue( hAB, 60 ); - if ( !hMQ ) - { - WinTerminate( hAB ); - return; - } - - if ( pData ) // Im AppServer NULL - { - // Ankerblock und Messagequeue merken - pData->mhAB = hAB; - pData->mhMQ = hMQ; - } - -} - -void DeInitSalMain() -{ -#if OSL_DEBUG_LEVEL>0 -printf("DeInitSalMain\n"); -#endif - - SalData* pData = GetAppSalData(); - // destroy message queue and anchor block - WinDestroyMsgQueue( pData->mhMQ ); - WinTerminate( pData->mhAB ); - -} - -// ----------------------------------------------------------------------- - -SalInstance* CreateSalInstance() -{ - SalData* pSalData = GetSalData(); - - // determine the os2 version - ULONG nMayor; - ULONG nMinor; - DosQuerySysInfo( QSV_VERSION_MAJOR, QSV_VERSION_MAJOR, &nMayor, sizeof( nMayor ) ); - DosQuerySysInfo( QSV_VERSION_MINOR, QSV_VERSION_MINOR, &nMinor, sizeof( nMinor ) ); - aSalShlData.mnVersion = (USHORT)(nMayor*10 + nMinor); - - pSalData->mnAppThreadId = GetCurrentThreadId(); - - // register frame class - if ( !WinRegisterClass( pSalData->mhAB, (PSZ)SAL_FRAME_CLASSNAME, - (PFNWP)SalFrameWndProc, CS_MOVENOTIFY /* 17/08 CS_HITTEST | CS_MOVENOTIFY */, - SAL_FRAME_WNDEXTRA ) ) - { - return NULL; - } - // register subframe class - if ( !WinRegisterClass( pSalData->mhAB, (PSZ)SAL_SUBFRAME_CLASSNAME, - (PFNWP)SalFrameWndProc, CS_SAVEBITS| CS_MOVENOTIFY, - SAL_FRAME_WNDEXTRA ) ) - { - return NULL; - } - // register object class - if ( !WinRegisterClass( pSalData->mhAB, (PSZ)SAL_COM_CLASSNAME, - (PFNWP)SalComWndProc, 0, 0 )) - { - return NULL; - } - - HWND hComWnd = WinCreateWindow( HWND_OBJECT, (PCSZ)SAL_COM_CLASSNAME, - (PCSZ)"", 0, 0, 0, 0, 0, - HWND_OBJECT, HWND_TOP, - 222, NULL, NULL); - if ( !hComWnd ) - return NULL; - -#if OSL_DEBUG_LEVEL>0 - debug_printf("CreateSalInstance hComWnd %x\n", hComWnd); -#endif - Os2SalInstance* pInst = new Os2SalInstance; - - // init instance (only one instance in this version !!!) - pSalData->mpFirstInstance = pInst; - pInst->mhAB = pSalData->mhAB; - pInst->mhMQ = pSalData->mhMQ; - pInst->mnArgc = pSalData->mnArgc; - pInst->mpArgv = pSalData->mpArgv; - pInst->mhComWnd = hComWnd; - - // AppIcon ermitteln - ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, pInst->mhAppIcon); - - // init static GDI Data - ImplInitSalGDI(); - - return pInst; -} - -// ----------------------------------------------------------------------- - -void DestroySalInstance( SalInstance* pInst ) -{ - SalData* pSalData = GetSalData(); - - // (only one instance in this version !!!) - ImplFreeSalGDI(); - -#ifdef ENABLE_IME - // IME-Daten freigeben - if ( pSalData->mpIMEData ) - ImplReleaseSALIMEData(); -#endif - - // reset instance - if ( pSalData->mpFirstInstance == pInst ) - pSalData->mpFirstInstance = NULL; - - delete pInst; -} - -// ----------------------------------------------------------------------- - -Os2SalInstance::Os2SalInstance() -{ - mhComWnd = 0; - mpSalYieldMutex = new SalYieldMutex( this ); - mpSalWaitMutex = new vos::OMutex; - mnYieldWaitCount = 0; - mpSalYieldMutex->acquire(); - ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); -} - -// ----------------------------------------------------------------------- - -Os2SalInstance::~Os2SalInstance() -{ - ::tools::SolarMutex::SetSolarMutex( 0 ); - mpSalYieldMutex->release(); - delete mpSalYieldMutex; - delete mpSalWaitMutex; - WinDestroyWindow( mhComWnd); -} - -// ----------------------------------------------------------------------- - -vos::IMutex* Os2SalInstance::GetYieldMutex() -{ - return mpSalYieldMutex; -} -// ----------------------------------------------------------------------- - -ULONG Os2SalInstance::ReleaseYieldMutex() -{ - return ImplSalReleaseYieldMutex(); -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::AcquireYieldMutex( ULONG nCount ) -{ - ImplSalAcquireYieldMutex( nCount ); -} - -// ----------------------------------------------------------------------- - -static void ImplSalYield( BOOL bWait, BOOL bHandleAllCurrentEvents ) -{ - QMSG aMsg; - bool bWasMsg = false, bOneEvent = false; - bool bQuit = false; - - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1; - do - { - if ( WinPeekMsg( pInst->mhAB, &aMsg, 0, 0, 0, PM_REMOVE ) ) - { - WinDispatchMsg( pInst->mhAB, &aMsg ); - bOneEvent = bWasMsg = true; - if (aMsg.msg == WM_QUIT) - bQuit = true; - } - else - bOneEvent = false; - } while( --nMaxEvents && bOneEvent ); - - if ( bWait && ! bWasMsg ) - { - if ( WinGetMsg( pInst->mhAB, &aMsg, 0, 0, 0 ) ) - WinDispatchMsg( pInst->mhAB, &aMsg ); - else - bQuit = true; - } - - if (bQuit) - { - ImplSalYieldMutexAcquireWithWait(); - Os2SalFrame* pFrame = GetSalData()->mpFirstFrame; - if ( pFrame ) - { - if (pFrame->CallCallback( SALEVENT_SHUTDOWN, 0 )) - WinCancelShutdown( pFrame->mhAB, FALSE ); - } - ImplSalYieldMutexRelease(); - } - -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) -{ - SalYieldMutex* pYieldMutex = mpSalYieldMutex; - SalData* pSalData = GetSalData(); - ULONG nCurThreadId = GetCurrentThreadId(); - ULONG nCount = pYieldMutex->GetAcquireCount( nCurThreadId ); - ULONG n = nCount; - while ( n ) - { - pYieldMutex->release(); - n--; - } - if ( pSalData->mnAppThreadId != nCurThreadId ) - { - // #97739# A SendMessage call blocks until the called thread (here: the main thread) - // returns. During a yield however, messages are processed in the main thread that might - // result in a new message loop due to opening a dialog. Thus, SendMessage would not - // return which will block this thread! - // Solution: just give up the time slice and hope that messages are processed - // by the main thread anyway (where all windows are created) - // If the mainthread is not currently handling messages, then our SendMessage would - // also do nothing, so this seems to be reasonable. - - // #i18883# only sleep if potential deadlock scenario, ie, when a dialog is open - if( ImplGetSVData()->maAppData.mnModalMode ) - DosSleep(1); - else - WinSendMsg( mhComWnd, SAL_MSG_THREADYIELD, (MPARAM)bWait, (MPARAM)bHandleAllCurrentEvents ); - - n = nCount; - while ( n ) - { - pYieldMutex->acquire(); - n--; - } - } - else - { - ImplSalYield( bWait, bHandleAllCurrentEvents ); - - n = nCount; - while ( n ) - { - ImplSalYieldMutexAcquireWithWait(); - n--; - } - } -} - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalComWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - //debug_printf( "SalComWndProc hWnd 0x%x nMsg %d\n", hWnd, nMsg); - - switch ( nMsg ) - { - case SAL_MSG_PRINTABORTJOB: - //ImplSalPrinterAbortJobAsync( (HDC)wParam ); - break; - case SAL_MSG_THREADYIELD: - ImplSalYield( (bool)nMP1, (bool) nMP2); - return 0; - // If we get this message, because another GetMessage() call - // has recieved this message, we must post this message to - // us again, because in the other case we wait forever. - case SAL_MSG_RELEASEWAITYIELD: - { - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( pInst && pInst->mnYieldWaitCount ) - WinPostMsg( hWnd, SAL_MSG_RELEASEWAITYIELD, nMP1, nMP2 ); - } - return 0; - case SAL_MSG_STARTTIMER: - ImplSalStartTimer( (ULONG)nMP2, FALSE); - return 0; - case SAL_MSG_CREATEFRAME: - return (MRESULT)ImplSalCreateFrame( GetSalData()->mpFirstInstance, (HWND)nMP2, (ULONG)nMP1 ); - case SAL_MSG_DESTROYFRAME: - delete (SalFrame*)nMP2; - return 0; - case SAL_MSG_DESTROYHWND: - //We only destroy the native window here. We do NOT destroy the SalFrame contained - //in the structure (GetWindowPtr()). - if (WinDestroyWindow((HWND)nMP2) == 0) - { - OSL_ENSURE(0, "DestroyWindow failed!"); - //Failure: We remove the SalFrame from the window structure. So we avoid that - // the window structure may contain an invalid pointer, once the SalFrame is deleted. - SetWindowPtr((HWND)nMP2, 0); - } - return 0; - case SAL_MSG_CREATEOBJECT: - return (MRESULT)ImplSalCreateObject( GetSalData()->mpFirstInstance, (Os2SalFrame*)(ULONG)nMP2 ); - case SAL_MSG_DESTROYOBJECT: - delete (SalObject*)nMP2; - return 0; - case SAL_MSG_CREATESOUND: - //return (MRESULT)((Os2SalSound*)nMP2)->ImplCreate(); - return 0; - case SAL_MSG_DESTROYSOUND: - //((Os2SalSound*)nMP2)->ImplDestroy(); - return 0; - case SAL_MSG_POSTTIMER: - SalTimerProc( 0, 0, SALTIMERPROC_RECURSIVE, (ULONG)nMP2 ); - break; - case WM_TIMER: - SalTimerProc( hWnd, 0, 0, 0 ); - break; - } - - return WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); -} - -// ----------------------------------------------------------------------- - -bool Os2SalInstance::AnyInput( USHORT nType ) -{ - SalData* pSalData = GetSalData(); - QMSG aQMSG; - - if ( (nType & (INPUT_ANY)) == INPUT_ANY ) - { - // Any Input - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, 0, 0, PM_NOREMOVE ) ) - return TRUE; - } - else - { - if ( nType & INPUT_MOUSE ) - { - // Test auf Mouseinput - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, - WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE ) ) - return TRUE; - } - - if ( nType & INPUT_KEYBOARD ) - { - // Test auf Keyinput - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, - WM_CHAR, WM_CHAR, PM_NOREMOVE ) ) - return !(SHORT1FROMMP( aQMSG.mp1 ) & KC_KEYUP); - } - - if ( nType & INPUT_PAINT ) - { - // Test auf Paintinput - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, - WM_PAINT, WM_PAINT, PM_NOREMOVE ) ) - return TRUE; - } - - if ( nType & INPUT_TIMER ) - { - // Test auf Timerinput - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, - WM_TIMER, WM_TIMER, PM_NOREMOVE ) ) - return TRUE; - } - - if ( nType & INPUT_OTHER ) - { - // Test auf sonstigen Input - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, 0, 0, PM_NOREMOVE ) ) - return TRUE; - } - } - - return FALSE; -} - -// ----------------------------------------------------------------------- - -SalFrame* Os2SalInstance::CreateChildFrame( SystemParentData* pSystemParentData, ULONG nSalFrameStyle ) -{ - // Um auf Main-Thread umzuschalten - return (SalFrame*)WinSendMsg( mhComWnd, SAL_MSG_CREATEFRAME, (MPARAM)nSalFrameStyle, (MPARAM)pSystemParentData->hWnd ); -} - -// ----------------------------------------------------------------------- - -SalFrame* Os2SalInstance::CreateFrame( SalFrame* pParent, ULONG nSalFrameStyle ) -{ - // Um auf Main-Thread umzuschalten - HWND mhWndClient; -//31/05/06 YD use client as owner(parent) so positioning will not need to -// take care of borders and captions - if ( pParent ) - mhWndClient = static_cast<Os2SalFrame*>(pParent)->mhWndClient; - else - mhWndClient = 0; - return (SalFrame*)WinSendMsg( mhComWnd, SAL_MSG_CREATEFRAME, (MPARAM)nSalFrameStyle, (MPARAM)mhWndClient ); -} - - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DestroyFrame( SalFrame* pFrame ) -{ - WinSendMsg( mhComWnd, SAL_MSG_DESTROYFRAME, 0, (MPARAM)pFrame ); -} - -// ----------------------------------------------------------------------- - -SalObject* Os2SalInstance::CreateObject( SalFrame* pParent, - SystemWindowData* /*pWindowData*/, // SystemWindowData meaningless on Windows - BOOL /*bShow*/ ) -{ - // Um auf Main-Thread umzuschalten - return (SalObject*)WinSendMsg( mhComWnd, SAL_MSG_CREATEOBJECT, 0, (MPARAM)pParent ); -} - - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DestroyObject( SalObject* pObject ) -{ - WinSendMsg( mhComWnd, SAL_MSG_DESTROYOBJECT, 0, (MPARAM)pObject ); -} - -// ----------------------------------------------------------------------- - -void* Os2SalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) -{ - rReturnedBytes = 1; - rReturnedType = AsciiCString; - return (void*) ""; -} - -void Os2SalInstance::AddToRecentDocumentList(const rtl::OUString& /*rFileUrl*/, const rtl::OUString& /*rMimeType*/) -{ -} - -// ----------------------------------------------------------------------- - -SalTimer* Os2SalInstance::CreateSalTimer() -{ - return new Os2SalTimer(); -} - -// ----------------------------------------------------------------------- - -SalBitmap* Os2SalInstance::CreateSalBitmap() -{ - return new Os2SalBitmap(); -} - -// ----------------------------------------------------------------------- - -class Os2ImeStatus : public SalI18NImeStatus -{ - public: - Os2ImeStatus() {} - virtual ~Os2ImeStatus() {} - - // asks whether there is a status window available - // to toggle into menubar - virtual bool canToggle() { return false; } - virtual void toggle() {} -}; - -SalI18NImeStatus* Os2SalInstance::CreateI18NImeStatus() -{ - return new Os2ImeStatus(); -} - -// ----------------------------------------------------------------------- - -const ::rtl::OUString& SalGetDesktopEnvironment() -{ - static ::rtl::OUString aDesktopEnvironment( RTL_CONSTASCII_USTRINGPARAM( "OS/2" ) ); - return aDesktopEnvironment; -} - -SalSession* Os2SalInstance::CreateSalSession() -{ - return NULL; -} - diff --git a/vcl/os2/source/app/sallang.cxx b/vcl/os2/source/app/sallang.cxx deleted file mode 100644 index f23705077ac3..000000000000 --- a/vcl/os2/source/app/sallang.cxx +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SALLANG_HXX -#include <sallang.hxx> -#endif - -// ======================================================================= - -// ----------------------------------------------------------------------- -// English (US/UK/AUS/CAN/NZ/EIRE/SAFRICA/JAMAICA/CARRIBEAN) -static const wchar_t* aImplLangEnglishTab[LSTR_COUNT] = -{ - L"Shift", // LSTR_KEY_SHIFT - L"Ctrl", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Up", // LSTR_KEY_UP - L"Down", // LSTR_KEY_DOWN - L"Left", // LSTR_KEY_LEFT - L"Right", // LSTR_KEY_RIGHT - L"Home", // LSTR_KEY_HOME - L"End", // LSTR_KEY_END - L"PageUp", // LSTR_KEY_PAGEUP - L"PageDown", // LSTR_KEY_PAGEDOWN - L"Enter", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Backspace", // LSTR_KEY_BACKSPACE - L"Space", // LSTR_KEY_SPACE - L"Insert", // LSTR_KEY_INSERT - L"Del", // LSTR_KEY_DELETE -}; - -// ======================================================================= - -const sal_Unicode** ImplGetLangTab( LanguageType eLang ) -{ - // Sprachtabelle ermitteln - const wchar_t** pLangTab; - //switch ( International::GetNeutralLanguage( eLang ) ) - switch ( eLang ) - { -#if 0 - case LANGUAGE_DANISH: - pLangTab = aImplLangDanishTab; - break; - - case LANGUAGE_DUTCH: - case LANGUAGE_DUTCH_BELGIAN: - pLangTab = aImplLangDutchTab; - break; - - case LANGUAGE_FINNISH: - pLangTab = aImplLangFinnishTab; - break; - - case LANGUAGE_FRENCH: - pLangTab = aImplLangFrenchTab; - break; - - case LANGUAGE_GERMAN: - pLangTab = aImplLangGermanTab; - break; - - case LANGUAGE_ITALIAN: - pLangTab = aImplLangItalianTab; - break; - - case LANGUAGE_NORWEGIAN: - case LANGUAGE_NORWEGIAN_BOKMAL: - pLangTab = aImplLangNorwegianTab; - break; - - case LANGUAGE_PORTUGUESE: - case LANGUAGE_PORTUGUESE_BRAZILIAN: - pLangTab = aImplLangPortugueseTab; - break; - - case LANGUAGE_SPANISH: - pLangTab = aImplLangSpanishTab; - break; - - case LANGUAGE_SWEDISH: - pLangTab = aImplLangSwedishTab; - break; -#endif - default: - pLangTab = aImplLangEnglishTab; - break; - } - - return (const sal_Unicode**)pLangTab; -} diff --git a/vcl/os2/source/app/salshl.cxx b/vcl/os2/source/app/salshl.cxx deleted file mode 100644 index 637ddd748f33..000000000000 --- a/vcl/os2/source/app/salshl.cxx +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svpm.h> - -#define _SV_SALSHL_CXX -#include <saldata.hxx> -#include <tools/debug.hxx> - -// ======================================================================= - -SalShlData aSalShlData; - -HMODULE ImplGetModule(void); -static HMODULE mhMod = ImplGetModule(); - -// ======================================================================= - -APIRET APIENTRY DosQueryModFromEIP (HMODULE *phMod, ULONG *pObjNum, - ULONG BuffLen, PCHAR pBuff, ULONG *pOffset, ULONG Address); - -HMODULE ImplGetModule(void) -{ - HMODULE hMod; - ULONG ObjNum; - CHAR Buff[2*_MAX_PATH]; - ULONG Offset; - APIRET rc; - - // get module handle (and name) - rc = DosQueryModFromEIP( &hMod, &ObjNum, sizeof( Buff), Buff, &Offset, (ULONG)ImplGetModule); - if (rc) - return NULL; - // return module handle - aSalShlData.mhMod = hMod; - return hMod; -} - -// ======================================================================= - -HPOINTER ImplLoadSalCursor( int nId ) -{ - DBG_ASSERT( aSalShlData.mhMod, "no DLL instance handle" ); - - HPOINTER hPointer = WinLoadPointer( HWND_DESKTOP, aSalShlData.mhMod, nId ); - - DBG_ASSERT( hPointer, "pointer not found in sal resource" ); -#if OSL_DEBUG_LEVEL>0 - if (!hPointer) - debug_printf( "ImplLoadSalCursor: pointer %d not found in sal resource\n", nId); -#endif - return hPointer; -} - -// ----------------------------------------------------------------------- - -BOOL ImplLoadSalIcon( int nId, HPOINTER& rIcon) -{ - DBG_ASSERT( aSalShlData.mhMod, "no DLL instance handle" ); - - SalData* pSalData = GetSalData(); - - // check the cache first - SalIcon *pSalIcon = pSalData->mpFirstIcon; - while( pSalIcon ) - { - if( pSalIcon->nId != nId ) - pSalIcon = pSalIcon->pNext; - else - { - rIcon = pSalIcon->hIcon; - return (rIcon != 0); - } - } - - // Try at first to load the icons from the application exe file - rIcon = WinLoadPointer( HWND_DESKTOP, NULL, nId ); - if ( !rIcon ) - { - // If the application don't provide these icons, then we try - // to load the icon from the VCL resource - rIcon = WinLoadPointer( HWND_DESKTOP, aSalShlData.mhMod, nId ); - } - - if( rIcon ) - { - // add to icon cache - pSalIcon = new SalIcon(); - pSalIcon->nId = nId; - pSalIcon->hIcon = rIcon; - pSalIcon->pNext = pSalData->mpFirstIcon; - pSalData->mpFirstIcon = pSalIcon; - } - - return (rIcon != 0); -} - -// ======================================================================= - diff --git a/vcl/os2/source/app/saltimer.cxx b/vcl/os2/source/app/saltimer.cxx deleted file mode 100644 index bcdeec94ef25..000000000000 --- a/vcl/os2/source/app/saltimer.cxx +++ /dev/null @@ -1,140 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svpm.h> - -#define _SV_SALTIMER_CXX -#include <saldata.hxx> -#include <saltimer.h> -#include <salinst.h> - -// ======================================================================= - -// Maximale Periode -#define MAX_SYSPERIOD 65533 -#define IDTIMER 10 - -// ======================================================================= - -void ImplSalStartTimer( ULONG nMS, BOOL bMutex ) -{ - SalData* pSalData = GetSalData(); - - // Periode darf nicht zu gross sein, da OS2 2.11 mit USHORT arbeitet - // Remenber the time of the timer - pSalData->mnTimerMS = nMS; - if ( !bMutex ) - pSalData->mnTimerOrgMS = nMS; - - // Periode darf nicht zu gross sein, da Windows mit USHORT arbeitet - if ( nMS > MAX_SYSPERIOD ) - nMS = MAX_SYSPERIOD; - - // Gibt es einen Timer, dann zerstoren - if ( pSalData->mnTimerId ) - WinStopTimer( pSalData->mhAB, pSalData->mpFirstInstance->mhComWnd, pSalData->mnTimerId ); - - // Make a new timer with new period - pSalData->mnTimerId = WinStartTimer( pSalData->mhAB, pSalData->mpFirstInstance->mhComWnd, IDTIMER, nMS ); - pSalData->mnNextTimerTime = pSalData->mnLastEventTime + nMS; -} - -// ----------------------------------------------------------------------- - -Os2SalTimer::~Os2SalTimer() -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalTimer::Start( ULONG nMS ) -{ - // Um auf Main-Thread umzuschalten - SalData* pSalData = GetSalData(); - if ( pSalData->mpFirstInstance ) - { - if ( pSalData->mnAppThreadId != GetCurrentThreadId() ) - WinPostMsg( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (MPARAM)nMS ); - else - WinSendMsg( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (MPARAM)nMS ); - } - else - ImplSalStartTimer( nMS, FALSE); -} - -// ----------------------------------------------------------------------- - -void Os2SalTimer::Stop() -{ - SalData* pSalData = GetSalData(); - - // Exitstiert ein Timer, dann diesen zerstoeren - if ( pSalData->mnTimerId ) { - WinStopTimer( pSalData->mhAB, pSalData->mpFirstInstance->mhComWnd, pSalData->mnTimerId ); - pSalData->mnTimerId = 0; - pSalData->mnNextTimerTime = 0; - } -} - -// ----------------------------------------------------------------------- - -void SalTimerProc( HWND, UINT, UINT nId, ULONG ) -{ - SalData* pSalData = GetSalData(); - ImplSVData* pSVData = ImplGetSVData(); - - // Test for MouseLeave - SalTestMouseLeave(); - - bool bRecursive = pSalData->mbInTimerProc && (nId != SALTIMERPROC_RECURSIVE); - if ( pSVData->mpSalTimer && ! bRecursive ) - { - // Try to aquire the mutex. If we don't get the mutex then we - // try this a short time later again. - if ( ImplSalYieldMutexTryToAcquire() ) - { - bRecursive = pSalData->mbInTimerProc && (nId != SALTIMERPROC_RECURSIVE); - if ( pSVData->mpSalTimer && ! bRecursive ) - { - pSalData->mbInTimerProc = TRUE; - pSVData->mpSalTimer->CallCallback(); - pSalData->mbInTimerProc = FALSE; - ImplSalYieldMutexRelease(); - - // Run the timer in the correct time, if we start this - // with a small timeout, because we don't get the mutex - if ( pSalData->mnTimerId && - (pSalData->mnTimerMS != pSalData->mnTimerOrgMS) ) - ImplSalStartTimer( pSalData->mnTimerOrgMS, FALSE ); - } - } - else - ImplSalStartTimer( 10, TRUE ); - } - -} - diff --git a/vcl/os2/source/gdi/makefile.mk b/vcl/os2/source/gdi/makefile.mk deleted file mode 100644 index b411c1eb2ce2..000000000000 --- a/vcl/os2/source/gdi/makefile.mk +++ /dev/null @@ -1,56 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=SV -TARGET=salgdi - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -YD00_CXXFILES= salgdi.cxx \ - salgdi2.cxx \ - salgdi3.cxx \ - salvd.cxx \ - salprn.cxx \ - salbmp.cxx - -SLOFILES= $(SLO)$/salgdi.obj \ - $(SLO)$/salgdi2.obj \ - $(SLO)$/salgdi3.obj \ - $(SLO)$/salvd.obj \ - $(SLO)$/salprn.obj \ - $(SLO)$/salbmp.obj \ - $(SLO)$/os2layout.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/vcl/os2/source/gdi/os2layout.cxx b/vcl/os2/source/gdi/os2layout.cxx deleted file mode 100644 index 924770c86869..000000000000 --- a/vcl/os2/source/gdi/os2layout.cxx +++ /dev/null @@ -1,1056 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/svwin.h> - -#include <rtl/ustring.hxx> -#include <osl/module.h> -#include <salgdi.h> -#include <saldata.hxx> -#include <vcl/sallayout.hxx> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -#include <cstdio> -#include <malloc.h> - -#ifdef GCP_KERN_HACK - #include <algorithm> -#endif // GCP_KERN_HACK - -// for GetMirroredChar -#include <vcl/svapp.hxx> - -#include <hash_map> -typedef std::hash_map<int,int> IntMap; - -#define DROPPED_OUTGLYPH 0xFFFF - -using namespace rtl; - -// ======================================================================= - -// OS/2 specific physical font instance -class ImplOs2FontEntry : public ImplFontEntry -{ -public: - ImplOs2FontEntry( ImplFontSelectData& ); - ~ImplOs2FontEntry(); - -private: - // TODO: also add HFONT??? Watch out for issues with too many active fonts... - -#ifdef GCP_KERN_HACK -public: - bool HasKernData() const; - void SetKernData( int, const KERNINGPAIRS* ); - int GetKerning( sal_Unicode, sal_Unicode ) const; -private: - KERNINGPAIRS* mpKerningPairs; - int mnKerningPairs; -#endif // GCP_KERN_HACK - -public: - int GetCachedGlyphWidth( int nCharCode ) const; - void CacheGlyphWidth( int nCharCode, int nCharWidth ); -private: - IntMap maWidthMap; -}; - -// ----------------------------------------------------------------------- - -inline void ImplOs2FontEntry::CacheGlyphWidth( int nCharCode, int nCharWidth ) -{ - maWidthMap[ nCharCode ] = nCharWidth; -} - -inline int ImplOs2FontEntry::GetCachedGlyphWidth( int nCharCode ) const -{ - IntMap::const_iterator it = maWidthMap.find( nCharCode ); - if( it == maWidthMap.end() ) - return -1; - return it->second; -} - -// ======================================================================= - -class Os2Layout : public SalLayout -{ -public: - Os2Layout( HDC, const ImplOs2FontData&, ImplOs2FontEntry& ); - virtual void InitFont() const; - void SetFontScale( float f ) { mfFontScale = f; } - float GetFontScale() const { return mfFontScale; } - -protected: - HPS mhPS; // OS2 device handle - FATTRS mhFont; - int mnBaseAdv; // x-offset relative to Layout origin - float mfFontScale; // allows metrics emulation of huge font sizes - - const ImplOs2FontData& mrOs2FontData; - ImplOs2FontEntry& mrOs2FontEntry; -}; - -// ======================================================================= - -class Os2SalLayout : public Os2Layout -{ -public: - Os2SalLayout( HPS, BYTE nCharSet, const ImplOs2FontData&, ImplOs2FontEntry& ); - virtual ~Os2SalLayout(); - - virtual bool LayoutText( ImplLayoutArgs& ); - virtual void AdjustLayout( ImplLayoutArgs& ); - virtual void DrawText( SalGraphics& ) const; - - virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&, - sal_Int32* pGlyphAdvances, int* pCharIndexes ) const; - - virtual long FillDXArray( long* pDXArray ) const; - virtual int GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const; - virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const; - - // for glyph+font+script fallback - virtual void MoveGlyph( int nStart, long nNewXPos ); - virtual void DropGlyph( int nStart ); - virtual void Simplify( bool bIsBase ); - -protected: - void Justify( long nNewWidth ); - void ApplyDXArray( const ImplLayoutArgs& ); - -protected: - -private: - int mnGlyphCount; - int mnCharCount; - sal_Unicode* mpOutGlyphs; - int* mpGlyphAdvances; // if possible this is shared with mpGlyphAdvances[] - int* mpGlyphOrigAdvs; - int* mpCharWidths; // map rel char pos to char width - int* mpChars2Glyphs; // map rel char pos to abs glyph pos - int* mpGlyphs2Chars; // map abs glyph pos to abs char pos - bool* mpGlyphRTLFlags; // BiDi status for glyphs: true=>RTL - mutable long mnWidth; - bool mbDisableGlyphs; - - int mnNotdefWidth; - BYTE mnCharSet; - -}; - -// ======================================================================= - -Os2Layout::Os2Layout( HPS hPS, const ImplOs2FontData& rWFD, ImplOs2FontEntry& rWFE ) -: mhPS( hPS ), - mnBaseAdv( 0 ), - mfFontScale( 1.0 ), - mrOs2FontData( rWFD ), - mrOs2FontEntry( rWFE ) -{ - BOOL fSuccess; - fSuccess = Ft2QueryLogicalFont( mhPS, LCID_BASE, NULL, &mhFont, sizeof(FATTRS)); -} - -// ----------------------------------------------------------------------- - -void Os2Layout::InitFont() const -{ - // select fallback level 0 font - APIRET rc = Ft2CreateLogFont( mhPS, NULL, LCID_BASE, (PFATTRS)&mhFont); -} - -// ======================================================================= - -Os2SalLayout::Os2SalLayout( HPS hPS, BYTE nCharSet, - const ImplOs2FontData& rOs2FontData, ImplOs2FontEntry& rOs2FontEntry ) -: Os2Layout( hPS, rOs2FontData, rOs2FontEntry ), - mnGlyphCount( 0 ), - mnCharCount( 0 ), - mpOutGlyphs( NULL ), - mpGlyphAdvances( NULL ), - mpGlyphOrigAdvs( NULL ), - mpCharWidths( NULL ), - mpChars2Glyphs( NULL ), - mpGlyphs2Chars( NULL ), - mpGlyphRTLFlags( NULL ), - mnWidth( 0 ), - mnNotdefWidth( -1 ), - mnCharSet( nCharSet ), - mbDisableGlyphs( false ) -{ - mbDisableGlyphs = true; -} - -// ----------------------------------------------------------------------- - -Os2SalLayout::~Os2SalLayout() -{ - delete[] mpGlyphRTLFlags; - delete[] mpGlyphs2Chars; - delete[] mpChars2Glyphs; - if( mpCharWidths != mpGlyphAdvances ) - delete[] mpCharWidths; - delete[] mpGlyphOrigAdvs; - delete[] mpGlyphAdvances; - delete[] mpOutGlyphs; -} - -// ----------------------------------------------------------------------- - -bool Os2SalLayout::LayoutText( ImplLayoutArgs& rArgs ) -{ - // prepare layout - // TODO: fix case when recyclying old Os2SalLayout object - mbDisableGlyphs |= ((rArgs.mnFlags & SAL_LAYOUT_DISABLE_GLYPH_PROCESSING) != 0); - mnCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos; - - if( !mbDisableGlyphs ) - { - // Win32 glyph APIs have serious problems with vertical layout - // => workaround is to use the unicode methods then - if( rArgs.mnFlags & SAL_LAYOUT_VERTICAL ) - mbDisableGlyphs = true; - else - // use cached value from font face - mbDisableGlyphs = mrOs2FontData.IsGlyphApiDisabled(); - } - - // TODO: use a cached value for bDisableAsianKern from upper layers -#if 0 - if( rArgs.mnFlags & SAL_LAYOUT_KERNING_ASIAN ) - { - TEXTMETRICA aTextMetricA; - if( ::GetTextMetricsA( mhDC, &aTextMetricA ) - && !(aTextMetricA.tmPitchAndFamily & TMPF_FIXED_PITCH) ) - rArgs.mnFlags &= ~SAL_LAYOUT_KERNING_ASIAN; - } -#endif - - // layout text - int i, j; - - mnGlyphCount = 0; - bool bVertical = (rArgs.mnFlags & SAL_LAYOUT_VERTICAL) != 0; - - // count the number of chars to process if no RTL run - rArgs.ResetPos(); - bool bHasRTL = false; - while( rArgs.GetNextRun( &i, &j, &bHasRTL ) && !bHasRTL ) - mnGlyphCount += j - i; - - // if there are RTL runs we need room to remember individual BiDi flags - if( bHasRTL ) - { - mpGlyphRTLFlags = new bool[ mnCharCount ]; - for( i = 0; i < mnCharCount; ++i ) - mpGlyphRTLFlags[i] = false; - } - - // rewrite the logical string if needed to prepare for the API calls - const sal_Unicode* pBidiStr = rArgs.mpStr + rArgs.mnMinCharPos; - if( (mnGlyphCount != mnCharCount) || bVertical ) - { - // we need to rewrite the pBidiStr when any of - // - BiDirectional layout - // - vertical layout - // - partial runs (e.g. with control chars or for glyph fallback) - // are involved - sal_Unicode* pRewrittenStr = (sal_Unicode*)alloca( mnCharCount * sizeof(sal_Unicode) ); - pBidiStr = pRewrittenStr; - - // note: glyph to char mapping is relative to first character - mpChars2Glyphs = new int[ mnCharCount ]; - mpGlyphs2Chars = new int[ mnCharCount ]; - for( i = 0; i < mnCharCount; ++i ) - mpChars2Glyphs[i] = mpGlyphs2Chars[i] = -1; - - mnGlyphCount = 0; - rArgs.ResetPos(); - bool bIsRTL = false; - while( rArgs.GetNextRun( &i, &j, &bIsRTL ) ) - { - do - { - // get the next leftmost character in this run - int nCharPos = bIsRTL ? --j : i++; - sal_Unicode cChar = rArgs.mpStr[ nCharPos ]; - - // in the RTL case mirror the character and remember its RTL status - if( bIsRTL ) - { - cChar = ::GetMirroredChar( cChar ); - mpGlyphRTLFlags[ mnGlyphCount ] = true; - } - - // for vertical writing use vertical alternatives - if( bVertical ) - { - sal_Unicode cVert = ::GetVerticalChar( cChar ); - if( cVert ) - cChar = cVert; - } - - // rewrite the original string - // update the mappings between original and rewritten string - pRewrittenStr[ mnGlyphCount ] = cChar; - mpGlyphs2Chars[ mnGlyphCount ] = nCharPos; - mpChars2Glyphs[ nCharPos - rArgs.mnMinCharPos ] = mnGlyphCount; - ++mnGlyphCount; - } while( i < j ); - } - } - - mpOutGlyphs = new sal_Unicode[ mnGlyphCount ]; - mpGlyphAdvances = new int[ mnGlyphCount ]; - - if( rArgs.mnFlags & (SAL_LAYOUT_KERNING_PAIRS | SAL_LAYOUT_KERNING_ASIAN) ) - mpGlyphOrigAdvs = new int[ mnGlyphCount ]; - -#ifndef GCP_KERN_HACK - DWORD nGcpOption = 0; - // enable kerning if requested - if( rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS ) - nGcpOption |= GCP_USEKERNING; -#endif // GCP_KERN_HACK - - LONG lLcid = Ft2QueryCharSet( mhPS); - - for( i = 0; i < mnGlyphCount; ++i ) - mpOutGlyphs[i] = pBidiStr[ i ]; - mnWidth = 0; - for( i = 0; i < mnGlyphCount; ++i ) - { - const sal_Unicode* pCodes = &pBidiStr[i]; - // check for surrogate pairs - if( (pCodes[0] & 0xFC00) == 0xDC00 ) - continue; - bool bSurrogate = ((pCodes[0] & 0xFC00) == 0xD800); - - // get the width of the corresponding code point - int nCharCode = pCodes[0]; - if( bSurrogate ) - nCharCode = 0x10000 + ((pCodes[0] & 0x03FF) << 10) + (pCodes[1] & 0x03FF); - int nGlyphWidth = mrOs2FontEntry.GetCachedGlyphWidth( nCharCode ); - if( nGlyphWidth == -1 ) - { - if (!Ft2QueryStringWidthW( mhPS, (LPWSTR)&pCodes[0], 1, (LONG*)&nGlyphWidth)) - nGlyphWidth = 0; - mrOs2FontEntry.CacheGlyphWidth( nCharCode, nGlyphWidth ); - } - mpGlyphAdvances[ i ] = nGlyphWidth; - mnWidth += nGlyphWidth; - - // remaining codes of surrogate pair get a zero width - if( bSurrogate ) - mpGlyphAdvances[ i+1 ] = 0; - - // check with the font face if glyph fallback is needed - if( mrOs2FontData.HasChar( nCharCode ) ) - continue; - // Type1 charmaps are not complete (or buggy), use FT2 to check again - if (Ft2FontSupportsUnicodeChar( mhPS, lLcid, TRUE, nCharCode)) - continue; - -#if OSL_DEBUG_LEVEL>0 - debug_printf("Os2SalLayout::LayoutText font does not support unicode char\n"); -#endif - // request glyph fallback at this position in the string - bool bRTL = mpGlyphRTLFlags ? mpGlyphRTLFlags[i] : false; - int nCharPos = mpGlyphs2Chars ? mpGlyphs2Chars[i]: i + rArgs.mnMinCharPos; - rArgs.NeedFallback( nCharPos, bRTL ); - if( bSurrogate ) - rArgs.NeedFallback( nCharPos+1, bRTL ); - - if( rArgs.mnFlags & SAL_LAYOUT_FOR_FALLBACK ) - { - // when we already are layouting for glyph fallback - // then a new unresolved glyph is not interesting - mnNotdefWidth = 0; - mpOutGlyphs[i] = DROPPED_OUTGLYPH; - if( mbDisableGlyphs && bSurrogate ) - mpOutGlyphs[i+1] = DROPPED_OUTGLYPH; - } - else - { - if( mnNotdefWidth < 0 ) - { - // get the width of the NotDef glyph - LONG aExtent; - mnNotdefWidth = 0; - if (Ft2QueryStringWidthW( mhPS, (LPWSTR)&rArgs.mpStr[ nCharPos ], 1, &aExtent)) - mnNotdefWidth = aExtent; - } - // use a better NotDef glyph - if( !mbDisableGlyphs ) - mpOutGlyphs[i] = 0; - } - - // replace the current glyph with the NotDef glyph - mnWidth += mnNotdefWidth - mpGlyphAdvances[i]; - mpGlyphAdvances[i] = mnNotdefWidth; - if( mpGlyphOrigAdvs ) - mpGlyphOrigAdvs[i] = mnNotdefWidth; - } - -#ifdef GCP_KERN_HACK - // apply kerning if the layout engine has not yet done it - if( rArgs.mnFlags & (SAL_LAYOUT_KERNING_ASIAN|SAL_LAYOUT_KERNING_PAIRS) ) - { -#else // GCP_KERN_HACK - // apply just asian kerning - if( rArgs.mnFlags & SAL_LAYOUT_KERNING_ASIAN ) - { - if( !(rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS) ) -#endif // GCP_KERN_HACK - for( i = 0; i < mnGlyphCount; ++i ) - mpGlyphOrigAdvs[i] = mpGlyphAdvances[i]; - - // #99658# also apply asian kerning on the substring border - int nLen = mnGlyphCount; - if( rArgs.mnMinCharPos + nLen < rArgs.mnLength ) - ++nLen; - for( i = 1; i < nLen; ++i ) - { -#ifdef GCP_KERN_HACK - if( rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS ) - { - int nKernAmount = mrOs2FontEntry.GetKerning( pBidiStr[i-1], pBidiStr[i] ); - mpGlyphAdvances[ i-1 ] += nKernAmount; - mnWidth += nKernAmount; - } - else if( rArgs.mnFlags & SAL_LAYOUT_KERNING_ASIAN ) -#endif // GCP_KERN_HACK - - if( (0x3000 == (0xFF00 & pBidiStr[i-1])) - && (0x3000 == (0xFF00 & pBidiStr[i])) ) - { - long nKernFirst = +CalcAsianKerning( pBidiStr[i-1], true, bVertical ); - long nKernNext = -CalcAsianKerning( pBidiStr[i], false, bVertical ); - - long nDelta = (nKernFirst < nKernNext) ? nKernFirst : nKernNext; - if( nDelta<0 && nKernFirst!=0 && nKernNext!=0 ) - { - nDelta = (nDelta * mpGlyphAdvances[i-1] + 2) / 4; - mpGlyphAdvances[i-1] += nDelta; - mnWidth += nDelta; - } - } - } - } - - // calculate virtual char widths - if( !mpGlyphs2Chars ) - mpCharWidths = mpGlyphAdvances; - else - { - mpCharWidths = new int[ mnCharCount ]; - for( i = 0; i < mnCharCount; ++i ) - mpCharWidths[ i ] = 0; - for( i = 0; i < mnGlyphCount; ++i ) - { - int j = mpGlyphs2Chars[ i ] - rArgs.mnMinCharPos; - if( j >= 0 ) - mpCharWidths[ j ] += mpGlyphAdvances[ i ]; - } - } - - // scale layout metrics if needed - if( mfFontScale != 1.0 ) - { - mnWidth *= mfFontScale; - mnBaseAdv *= mfFontScale; - for( i = 0; i < mnCharCount; ++i ) - mpCharWidths[ i ] *= mfFontScale; - if( mpGlyphAdvances != mpCharWidths ) - for( i = 0; i < mnGlyphCount; ++i ) - mpGlyphAdvances[ i ] *= mfFontScale; - if( mpGlyphOrigAdvs && (mpGlyphOrigAdvs != mpGlyphAdvances) ) - for( i = 0; i < mnGlyphCount; ++i ) - mpGlyphOrigAdvs[ i ] *= mfFontScale; - } - - return true; -} - -// ----------------------------------------------------------------------- - -int Os2SalLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int& nStart, - sal_Int32* pGlyphAdvances, int* pCharIndexes ) const -{ - // return zero if no more glyph found - if( nStart >= mnGlyphCount ) - return 0; - - // calculate glyph position relative to layout base - // TODO: avoid for nStart!=0 case by reusing rPos - long nXOffset = mnBaseAdv; - for( int i = 0; i < nStart; ++i ) - nXOffset += mpGlyphAdvances[ i ]; - - // calculate absolute position in pixel units - Point aRelativePos( nXOffset, 0 ); - rPos = GetDrawPosition( aRelativePos ); - - int nCount = 0; - while( nCount < nLen ) - { - // update return values {nGlyphIndex,nCharPos,nGlyphAdvance} - long nGlyphIndex = mpOutGlyphs[ nStart ]; - if( mbDisableGlyphs ) - { - if( mnLayoutFlags & SAL_LAYOUT_VERTICAL ) - { - sal_Unicode cChar = (sal_Unicode)(nGlyphIndex & GF_IDXMASK); -#ifdef GNG_VERT_HACK - if( mrOs2FontData.HasGSUBstitutions( mhPS ) - && mrOs2FontData.IsGSUBstituted( cChar ) ) - nGlyphIndex |= GF_ROTL | GF_GSUB; - else -#endif // GNG_VERT_HACK - { - nGlyphIndex |= GetVerticalFlags( cChar ); - if( !(nGlyphIndex & GF_ROTMASK) ) - nGlyphIndex |= GF_VERT; - } - } - nGlyphIndex |= GF_ISCHAR; - } - ++nCount; - *(pGlyphs++) = nGlyphIndex; - if( pGlyphAdvances ) - *(pGlyphAdvances++) = mpGlyphAdvances[ nStart ]; - if( pCharIndexes ) - { - int nCharPos; - if( !mpGlyphs2Chars ) - nCharPos = nStart + mnMinCharPos; - else - nCharPos = mpGlyphs2Chars[nStart]; - *(pCharIndexes++) = nCharPos; - } - - // stop at last glyph - if( ++nStart >= mnGlyphCount ) - break; - - // stop when next x-position is unexpected - if( !pGlyphAdvances && mpGlyphOrigAdvs ) - if( mpGlyphAdvances[nStart-1] != mpGlyphOrigAdvs[nStart-1] ) - break; - } - - return nCount; -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::DrawText( SalGraphics& rGraphics ) const -{ - if( mnGlyphCount <= 0 ) - return; - - Point aPos = GetDrawPosition( Point( mnBaseAdv, 0 ) ); - POINTL aPt; - APIRET rc; - - aPt.x = aPos.X(); - aPt.y = static_cast<Os2SalGraphics&>(rGraphics).mnHeight - aPos.Y(); - - // ft2lib doesn't work with printer hps, so we fallback to codepage printing - // until cp1200 support will work. - if (static_cast<Os2SalGraphics&>(rGraphics).mbPrinter) { - // convert to codepage - ByteString str( mpOutGlyphs, gsl_getSystemTextEncoding() ); - // gliph size is not recalculated, so it could be wrong! - rc = Ft2CharStringPosAtA( static_cast<Os2SalGraphics&>(rGraphics).mhPS, - &aPt, NULL, CHS_VECTOR, mnGlyphCount, (PSZ)str.GetBuffer(), - (LONG*)mpGlyphAdvances, 0); - } else { - // try unicode rendering to screen - rc = Ft2CharStringPosAtW( static_cast<Os2SalGraphics&>(rGraphics).mhPS, - &aPt, NULL, CHS_VECTOR, mnGlyphCount, (LPWSTR)mpOutGlyphs, - (LONG*)mpGlyphAdvances, 0); - if (rc == GPI_ERROR) { - // if *W fails, convert to codepage and use *A (fallback to GPI into ft2) - ByteString str( mpOutGlyphs, gsl_getSystemTextEncoding() ); -#if OSL_DEBUG_LEVEL>10 - debug_printf("Os2SalLayout::DrawText HPS %08x PosAtW failed '%s'!\n",static_cast<Os2SalGraphics&>(rGraphics).mhPS,str.GetBuffer()); -#endif - // gliph size is not recalculated, so it could be wrong! - rc = Ft2CharStringPosAtA( static_cast<Os2SalGraphics&>(rGraphics).mhPS, - &aPt, NULL, CHS_VECTOR, mnGlyphCount, (PSZ)str.GetBuffer(), - (LONG*)mpGlyphAdvances, 0); - } - } -} - -// ----------------------------------------------------------------------- - -long Os2SalLayout::FillDXArray( long* pDXArray ) const -{ - if( !mnWidth ) - { - long mnWidth = mnBaseAdv; - for( int i = 0; i < mnGlyphCount; ++i ) - mnWidth += mpGlyphAdvances[ i ]; - } - - if( pDXArray != NULL ) - { - for( int i = 0; i < mnCharCount; ++i ) - pDXArray[ i ] = mpCharWidths[ i ]; - } - - return mnWidth; -} - -// ----------------------------------------------------------------------- - -int Os2SalLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const -// NOTE: the nFactor is used to prevent rounding errors for small nCharExtra values -{ - if( mnWidth ) - if( (mnWidth * nFactor + mnCharCount * nCharExtra) <= nMaxWidth ) - return STRING_LEN; - - long nExtraWidth = mnBaseAdv * nFactor; - for( int n = 0; n < mnCharCount; ++n ) - { - // skip unused characters - if( mpChars2Glyphs && (mpChars2Glyphs[n] < 0) ) - continue; - // add char widths until max - nExtraWidth += mpCharWidths[ n ] * nFactor; - if( nExtraWidth >= nMaxWidth ) - return (mnMinCharPos + n); - nExtraWidth += nCharExtra; - } - - return STRING_LEN; -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::GetCaretPositions( int nMaxIdx, long* pCaretXArray ) const -{ - long nXPos = mnBaseAdv; - - if( !mpGlyphs2Chars ) - { - for( int i = 0; i < nMaxIdx; i += 2 ) - { - pCaretXArray[ i ] = nXPos; - nXPos += mpGlyphAdvances[ i>>1 ]; - pCaretXArray[ i+1 ] = nXPos; - } - } - else - { - int i; - for( i = 0; i < nMaxIdx; ++i ) - pCaretXArray[ i ] = -1; - - // assign glyph positions to character positions - for( i = 0; i < mnGlyphCount; ++i ) - { - int nCurrIdx = mpGlyphs2Chars[ i ] - mnMinCharPos; - long nXRight = nXPos + mpCharWidths[ nCurrIdx ]; - nCurrIdx *= 2; - if( !(mpGlyphRTLFlags && mpGlyphRTLFlags[i]) ) - { - // normal positions for LTR case - pCaretXArray[ nCurrIdx ] = nXPos; - pCaretXArray[ nCurrIdx+1 ] = nXRight; - } - else - { - // reverse positions for RTL case - pCaretXArray[ nCurrIdx ] = nXRight; - pCaretXArray[ nCurrIdx+1 ] = nXPos; - } - nXPos += mpGlyphAdvances[ i ]; - } - } -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::Justify( long nNewWidth ) -{ - long nOldWidth = mnWidth; - mnWidth = nNewWidth; - - if( mnGlyphCount <= 0 ) - return; - - if( nNewWidth == nOldWidth ) - return; - - // the rightmost glyph cannot be stretched - const int nRight = mnGlyphCount - 1; - nOldWidth -= mpGlyphAdvances[ nRight ]; - nNewWidth -= mpGlyphAdvances[ nRight ]; - - // count stretchable glyphs - int nStretchable = 0, i; - for( i = 0; i < nRight; ++i ) - if( mpGlyphAdvances[i] >= 0 ) - ++nStretchable; - - // stretch these glyphs - int nDiffWidth = nNewWidth - nOldWidth; - for( i = 0; (i < nRight) && (nStretchable > 0); ++i ) - { - if( mpGlyphAdvances[i] <= 0 ) - continue; - int nDeltaWidth = nDiffWidth / nStretchable; - mpGlyphAdvances[i] += nDeltaWidth; - --nStretchable; - nDiffWidth -= nDeltaWidth; - } -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) -{ - SalLayout::AdjustLayout( rArgs ); - - // adjust positions if requested - if( rArgs.mpDXArray ) - ApplyDXArray( rArgs ); - else if( rArgs.mnLayoutWidth ) - Justify( rArgs.mnLayoutWidth ); - else - return; - - // recalculate virtual char widths if they were changed - if( mpCharWidths != mpGlyphAdvances ) - { - int i; - if( !mpGlyphs2Chars ) - { - // standard LTR case - for( i = 0; i < mnGlyphCount; ++i ) - mpCharWidths[ i ] = mpGlyphAdvances[ i ]; - } - else - { - // BiDi or complex case - for( i = 0; i < mnCharCount; ++i ) - mpCharWidths[ i ] = 0; - for( i = 0; i < mnGlyphCount; ++i ) - { - int j = mpGlyphs2Chars[ i ] - rArgs.mnMinCharPos; - if( j >= 0 ) - mpCharWidths[ j ] += mpGlyphAdvances[ i ]; - } - } - } -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::ApplyDXArray( const ImplLayoutArgs& rArgs ) -{ - // try to avoid disturbance of text flow for LSB rounding case; - const long* pDXArray = rArgs.mpDXArray; - - int i = 0; - long nOldWidth = mnBaseAdv; - for(; i < mnCharCount; ++i ) - { - int j = !mpChars2Glyphs ? i : mpChars2Glyphs[i]; - if( j >= 0 ) - { - nOldWidth += mpGlyphAdvances[ j ]; - int nDiff = nOldWidth - pDXArray[ i ]; - - // disabled because of #104768# - // works great for static text, but problems when typing - // if( nDiff>+1 || nDiff<-1 ) - // only bother with changing anything when something moved - if( nDiff != 0 ) - break; - } - } - if( i >= mnCharCount ) - return; - - if( !mpGlyphOrigAdvs ) - { - mpGlyphOrigAdvs = new int[ mnGlyphCount ]; - for( i = 0; i < mnGlyphCount; ++i ) - mpGlyphOrigAdvs[ i ] = mpGlyphAdvances[ i ]; - } - - mnWidth = mnBaseAdv; - for( i = 0; i < mnCharCount; ++i ) - { - int j = !mpChars2Glyphs ? i : mpChars2Glyphs[i]; - if( j >= 0 ) - mpGlyphAdvances[j] = pDXArray[i] - mnWidth; - mnWidth = pDXArray[i]; - } -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::MoveGlyph( int nStart, long nNewXPos ) -{ - if( nStart > mnGlyphCount ) - return; - - // calculate the current x-position of the requested glyph - // TODO: cache absolute positions - int nXPos = mnBaseAdv; - for( int i = 0; i < nStart; ++i ) - nXPos += mpGlyphAdvances[i]; - - // calculate the difference to the current glyph position - int nDelta = nNewXPos - nXPos; - - // adjust the width of the layout if it was already cached - if( mnWidth ) - mnWidth += nDelta; - - // depending on whether the requested glyph is leftmost in the layout - // adjust either the layout's or the requested glyph's relative position - if( nStart > 0 ) - mpGlyphAdvances[ nStart-1 ] += nDelta; - else - mnBaseAdv += nDelta; -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::DropGlyph( int nStart ) -{ - mpOutGlyphs[ nStart ] = DROPPED_OUTGLYPH; -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::Simplify( bool bIsBase ) -{ - // return early if no glyph has been dropped - int i = mnGlyphCount; - while( (--i >= 0) && (mpOutGlyphs[ i ] != DROPPED_OUTGLYPH) ); - if( i < 0 ) - return; - - // convert the layout to a sparse layout if it is not already - if( !mpGlyphs2Chars ) - { - mpGlyphs2Chars = new int[ mnGlyphCount ]; - mpCharWidths = new int[ mnCharCount ]; - // assertion: mnGlyphCount == mnCharCount - for( int k = 0; k < mnGlyphCount; ++k ) - { - mpGlyphs2Chars[ k ] = mnMinCharPos + k; - mpCharWidths[ k ] = mpGlyphAdvances[ k ]; - } - } - - // remove dropped glyphs that are rightmost in the layout - for( i = mnGlyphCount; --i >= 0; ) - { - if( mpOutGlyphs[ i ] != DROPPED_OUTGLYPH ) - break; - if( mnWidth ) - mnWidth -= mpGlyphAdvances[ i ]; - int nRelCharPos = mpGlyphs2Chars[ i ] - mnMinCharPos; - if( nRelCharPos >= 0 ) - mpCharWidths[ nRelCharPos ] = 0; - } - mnGlyphCount = i + 1; - - // keep original glyph widths around - if( !mpGlyphOrigAdvs ) - { - mpGlyphOrigAdvs = new int[ mnGlyphCount ]; - for( int k = 0; k < mnGlyphCount; ++k ) - mpGlyphOrigAdvs[ k ] = mpGlyphAdvances[ k ]; - } - - // remove dropped glyphs inside the layout - int nNewGC = 0; - for( i = 0; i < mnGlyphCount; ++i ) - { - if( mpOutGlyphs[ i ] == DROPPED_OUTGLYPH ) - { - // adjust relative position to last valid glyph - int nDroppedWidth = mpGlyphAdvances[ i ]; - mpGlyphAdvances[ i ] = 0; - if( nNewGC > 0 ) - mpGlyphAdvances[ nNewGC-1 ] += nDroppedWidth; - else - mnBaseAdv += nDroppedWidth; - - // zero the virtual char width for the char that has a fallback - int nRelCharPos = mpGlyphs2Chars[ i ] - mnMinCharPos; - if( nRelCharPos >= 0 ) - mpCharWidths[ nRelCharPos ] = 0; - } - else - { - if( nNewGC != i ) - { - // rearrange the glyph array to get rid of the dropped glyph - mpOutGlyphs[ nNewGC ] = mpOutGlyphs[ i ]; - mpGlyphAdvances[ nNewGC ] = mpGlyphAdvances[ i ]; - mpGlyphOrigAdvs[ nNewGC ] = mpGlyphOrigAdvs[ i ]; - mpGlyphs2Chars[ nNewGC ] = mpGlyphs2Chars[ i ]; - } - ++nNewGC; - } - } - - mnGlyphCount = nNewGC; - if( mnGlyphCount <= 0 ) - mnWidth = mnBaseAdv = 0; -} - -// ======================================================================= - -SalLayout* Os2SalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel ) -{ - Os2SalLayout* pLayout = NULL; - DBG_ASSERT( mpOs2FontEntry[nFallbackLevel], "WinSalGraphics mpWinFontEntry==NULL"); - - const ImplOs2FontData& rFontFace = *mpOs2FontData[ nFallbackLevel ]; - ImplOs2FontEntry& rFontInstance = *mpOs2FontEntry[ nFallbackLevel ]; - - { -#ifdef GCP_KERN_HACK - if( (rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS) && !rFontInstance.HasKernData() ) - { - // TODO: directly cache kerning info in the rFontInstance - // TODO: get rid of kerning methods+data in WinSalGraphics object - GetKernPairs( 0, NULL ); - rFontInstance.SetKernData( mnFontKernPairCount, mpFontKernPairs ); - } -#endif // GCP_KERN_HACK - - //BYTE eCharSet = ANSI_CHARSET; - //if( mpLogFont ) - // eCharSet = mpLogFont->lfCharSet; - pLayout = new Os2SalLayout( mhPS, 0, rFontFace, rFontInstance ); - } - - if( mfFontScale != 1.0 ) - pLayout->SetFontScale( mfFontScale ); - - return pLayout; -} - -// ======================================================================= - -ImplOs2FontEntry::ImplOs2FontEntry( ImplFontSelectData& rFSD ) -: ImplFontEntry( rFSD ), - maWidthMap( 512 ) -#ifdef GCP_KERN_HACK - ,mpKerningPairs( NULL ) - ,mnKerningPairs( -1 ) -#endif // GCP_KERN_HACK -{ -} - -// ----------------------------------------------------------------------- - -ImplOs2FontEntry::~ImplOs2FontEntry() -{ -#ifdef GCP_KERN_HACK - delete[] mpKerningPairs; -#endif // GCP_KERN_HACK -} - -// ----------------------------------------------------------------------- - -#ifdef GCP_KERN_HACK -bool ImplOs2FontEntry::HasKernData() const -{ - return (mnKerningPairs >= 0); -} - -// ----------------------------------------------------------------------- - -void ImplOs2FontEntry::SetKernData( int nPairCount, const KERNINGPAIRS* pPairData ) -{ - mnKerningPairs = nPairCount; - mpKerningPairs = new KERNINGPAIRS[ mnKerningPairs ]; - ::memcpy( mpKerningPairs, (const void*)pPairData, nPairCount*sizeof(KERNINGPAIRS) ); -} - -// ----------------------------------------------------------------------- - -int ImplOs2FontEntry::GetKerning( sal_Unicode cLeft, sal_Unicode cRight ) const -{ - int nKernAmount = 0; - if( mpKerningPairs ) - { - const KERNINGPAIRS aRefPair = { cLeft, cRight, 0 }; - const KERNINGPAIRS* pFirstPair = mpKerningPairs; - const KERNINGPAIRS* pEndPair = mpKerningPairs + mnKerningPairs; - const KERNINGPAIRS* pPair = std::lower_bound( pFirstPair, - pEndPair, aRefPair, ImplCmpKernData ); - if( (pPair != pEndPair) - && (pPair->sFirstChar == aRefPair.sFirstChar) - && (pPair->sSecondChar == aRefPair.sSecondChar) ) - nKernAmount = pPair->lKerningAmount; - } - - return nKernAmount; -} -#endif // GCP_KERN_HACK - -// ======================================================================= - -ImplFontData* ImplOs2FontData::Clone() const -{ - if( mpUnicodeMap ) - mpUnicodeMap->AddReference(); - ImplFontData* pClone = new ImplOs2FontData( *this ); - return pClone; -} - -// ----------------------------------------------------------------------- - -ImplFontEntry* ImplOs2FontData::CreateFontInstance( ImplFontSelectData& rFSD ) const -{ - //debug_printf("ImplOs2FontData::CreateFontInstance\n"); - ImplFontEntry* pEntry = new ImplOs2FontEntry( rFSD ); - return pEntry; -} - -// ======================================================================= - diff --git a/vcl/os2/source/gdi/salbmp.cxx b/vcl/os2/source/gdi/salbmp.cxx deleted file mode 100644 index 3d8f86ddcd1e..000000000000 --- a/vcl/os2/source/gdi/salbmp.cxx +++ /dev/null @@ -1,737 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svpm.h> - -#define _SV_SALBMP_CXX -#include <rtl/alloc.h> -#include <vcl/salbtype.hxx> -#include <salgdi.h> -#include <saldata.hxx> -#include <salbmp.h> -#include <vcl/bitmap.hxx> // for BitmapSystemData -#include <string.h> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -// ----------- -// - Inlines - -// ----------- - -inline void ImplSetPixel4( const HPBYTE pScanline, long nX, const BYTE cIndex ) -{ - BYTE& rByte = pScanline[ nX >> 1 ]; - - ( nX & 1 ) ? ( rByte &= 0xf0, rByte |= ( cIndex & 0x0f ) ) : - ( rByte &= 0x0f, rByte |= ( cIndex << 4 ) ); -} - -// ------------- -// - Os2SalBitmap - -// ------------- - -Os2SalBitmap::Os2SalBitmap() : - mhDIB ( 0 ), - mhDIB1Subst ( 0 ), - mhDDB ( 0 ), - mnBitCount ( 0 ) -{ -} - -// ------------------------------------------------------------------ - -Os2SalBitmap::~Os2SalBitmap() -{ - Destroy(); -} - -// ------------------------------------------------------------------ - -bool Os2SalBitmap::Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle ) -{ - BOOL bRet = TRUE; - - if( bDIB ) - mhDIB = (HANDLE) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, TRUE ) : hBitmap ); - else - mhDDB = (HBITMAP) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, FALSE ) : hBitmap ); - - if( mhDIB ) - { - // bitmap-header is the beginning of memory block - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) mhDIB; - - maSize = Size( pBIH->cx, pBIH->cy ); - mnBitCount = pBIH->cBitCount; - - if( mnBitCount ) - mnBitCount = ( mnBitCount <= 1 ) ? 1 : ( mnBitCount <= 4 ) ? 4 : ( mnBitCount <= 8 ) ? 8 : 24; - } - else if( mhDDB ) - { - BITMAPINFOHEADER2 aDDBInfoHeader; - - aDDBInfoHeader.cbFix = sizeof( aDDBInfoHeader ); - - if( GpiQueryBitmapInfoHeader( mhDDB, &aDDBInfoHeader ) ) - { - maSize = Size( aDDBInfoHeader.cx, aDDBInfoHeader.cy ); - mnBitCount = aDDBInfoHeader.cPlanes * aDDBInfoHeader.cBitCount; - - if( mnBitCount ) - { - mnBitCount = ( mnBitCount <= 1 ) ? 1 : - ( mnBitCount <= 4 ) ? 4 : - ( mnBitCount <= 8 ) ? 8 : 24; - } - } - else - { - mhDDB = 0; - bRet = FALSE; - } - - } - else - bRet = FALSE; - - return bRet; -} - -// ------------------------------------------------------------------ - -bool Os2SalBitmap::Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ) -{ - bool bRet = FALSE; - - mhDIB = ImplCreateDIB( rSize, nBitCount, rPal ); - - if( mhDIB ) - { - maSize = rSize; - mnBitCount = nBitCount; - bRet = TRUE; - } - - return bRet; -} - -// ------------------------------------------------------------------ - -bool Os2SalBitmap::Create( const SalBitmap& rSSalBitmap ) -{ - bool bRet = FALSE; - const Os2SalBitmap& rSalBitmap = static_cast<const Os2SalBitmap&>(rSSalBitmap); - - if ( rSalBitmap.mhDIB || rSalBitmap.mhDDB ) - { - HANDLE hNewHdl = ImplCopyDIBOrDDB( rSalBitmap.mhDIB ? rSalBitmap.mhDIB : rSalBitmap.mhDDB, - rSalBitmap.mhDIB != 0 ); - - if( hNewHdl ) - { - if( rSalBitmap.mhDIB ) - mhDIB = (HANDLE) hNewHdl; - else if( rSalBitmap.mhDDB ) - mhDDB = (HBITMAP) hNewHdl; - - maSize = rSalBitmap.maSize; - mnBitCount = rSalBitmap.mnBitCount; - bRet = TRUE; - } - } - - return bRet; -} - -// ------------------------------------------------------------------ - -bool Os2SalBitmap::Create( const SalBitmap& rSSalBmp, SalGraphics* pSGraphics ) -{ - bool bRet = FALSE; - const Os2SalBitmap& rSalBmp = static_cast<const Os2SalBitmap&>(rSSalBmp); - Os2SalGraphics* pGraphics = static_cast<Os2SalGraphics*>(pSGraphics); - - if( rSalBmp.mhDIB ) - { - HPS hPS = pGraphics->mhPS; - HBITMAP hNewDDB; - BITMAPINFOHEADER2 aInfoHeader; - const Size aSize( rSalBmp.GetSize() ); - long nFormat[ 2 ]; - - memset( &aInfoHeader, 0, sizeof( aInfoHeader ) ); - aInfoHeader.cbFix = 16; - aInfoHeader.cx = aSize.Width(); - aInfoHeader.cy = aSize.Height(); - - GpiQueryDeviceBitmapFormats( hPS, 2L, (PLONG) &nFormat ); - aInfoHeader.cPlanes = nFormat[ 0 ]; - aInfoHeader.cBitCount = nFormat[ 1 ]; - - // ! wegen Postscript-Treiber - if( !aInfoHeader.cBitCount ) - aInfoHeader.cBitCount = 24; - else if( ( aInfoHeader.cPlanes == 1 ) && ( aInfoHeader.cBitCount == 1 ) ) - aInfoHeader.cBitCount = 4; - - // BitCount == 1 ist wegen aller moeglichen Treiberfehler nicht moeglich - if( rSalBmp.GetBitCount() == 1 ) - { - HANDLE hTmp = ImplCreateDIB4FromDIB1( rSalBmp.mhDIB ); - PBYTE pBits = (PBYTE) hTmp + *(ULONG*) hTmp + ImplGetDIBColorCount( hTmp ) * sizeof( RGB2 ); - - hNewDDB = GpiCreateBitmap( hPS, &aInfoHeader, CBM_INIT, pBits, (PBITMAPINFO2) hTmp ); - rtl_freeMemory( (void*)hTmp ); - } - else - { - PBYTE pBits = (PBYTE) rSalBmp.mhDIB + *(ULONG*) rSalBmp.mhDIB + ImplGetDIBColorCount( rSalBmp.mhDIB ) * sizeof( RGB2 ); - hNewDDB = GpiCreateBitmap( hPS, &aInfoHeader, CBM_INIT, pBits, (PBITMAPINFO2) rSalBmp.mhDIB ); - } - - aInfoHeader.cbFix = sizeof( aInfoHeader ); - - if( hNewDDB && GpiQueryBitmapInfoHeader( hNewDDB, &aInfoHeader ) ) - { - mhDDB = hNewDDB; - maSize = Size( aInfoHeader.cx, aInfoHeader.cy ); - mnBitCount = aInfoHeader.cPlanes * aInfoHeader.cBitCount; - - if( mnBitCount ) - { - mnBitCount = ( mnBitCount <= 1 ) ? 1 : - ( mnBitCount <= 4 ) ? 4 : - ( mnBitCount <= 8 ) ? 8 : 24; - } - - bRet = TRUE; - } - else if( hNewDDB ) - GpiDeleteBitmap( hNewDDB ); - } - - return bRet; -} - -// ------------------------------------------------------------------ - -bool Os2SalBitmap::Create( const SalBitmap& rSSalBmp, USHORT nNewBitCount ) -{ - bool bRet = FALSE; - const Os2SalBitmap& rSalBmp = static_cast<const Os2SalBitmap&>(rSSalBmp); - - if( rSalBmp.mhDDB ) - { - mhDIB = ImplCreateDIB( rSalBmp.maSize, nNewBitCount, BitmapPalette() ); - - if( mhDIB ) - { - // bitmap-header is the beginning of memory block - PBITMAPINFO2 pBI = (PBITMAPINFO2) mhDIB; - const int nLines = (int) rSalBmp.maSize.Height(); - PBYTE pBits = (PBYTE) pBI + *(ULONG*) pBI + ImplGetDIBColorCount( mhDIB ) * sizeof( RGB2 ); - SIZEL aSizeL = { rSalBmp.maSize.Width(), nLines }; - HAB hAB = GetSalData()->mhAB; - DEVOPENSTRUC aDevOpenStruc = { NULL, (PSZ)"DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - HDC hMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - HPS hMemPS = Ft2CreatePS( hAB, hMemDC, &aSizeL, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - HBITMAP hMemOld = (HBITMAP) Ft2SetBitmap( hMemPS, rSalBmp.mhDDB ); - - if( GpiQueryBitmapBits( hMemPS, 0, nLines, pBits, pBI ) == nLines ) - { - maSize = rSalBmp.maSize; - mnBitCount = nNewBitCount; - bRet = TRUE; - } - else - { - rtl_freeMemory( (void*)mhDIB ); - mhDIB = 0; - } - - Ft2SetBitmap( hMemPS, hMemOld ); - Ft2DestroyPS( hMemPS ); - DevCloseDC( hMemDC ); - } - } - - return bRet; -} - -// ------------------------------------------------------------------ - -void Os2SalBitmap::Destroy() -{ - if( mhDIB ) - rtl_freeMemory( (void*)mhDIB ); - else if( mhDDB ) - GpiDeleteBitmap( mhDDB ); - - if( mhDIB1Subst ) - { - rtl_freeMemory( (void*)mhDIB1Subst ); - mhDIB1Subst = NULL; - } - - maSize = Size(); - mnBitCount = 0; -} - -// ------------------------------------------------------------------ - -void Os2SalBitmap::ImplReplacehDIB1Subst( HANDLE hDIB1Subst ) -{ - if( mhDIB1Subst ) - rtl_freeMemory( (void*)mhDIB1Subst ); - - mhDIB1Subst = hDIB1Subst; -} - -// ------------------------------------------------------------------ - -USHORT Os2SalBitmap::ImplGetDIBColorCount( HANDLE hDIB ) -{ - USHORT nColors = 0; - - if( hDIB ) - { - // bitmap infos can be found at the beginning of the memory - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) hDIB; - - if( pBIH->cBitCount <= 8 ) - { - if( pBIH->cclrUsed ) - nColors = (USHORT) pBIH->cclrUsed; - else - nColors = 1 << pBIH->cBitCount; - } - } - - return nColors; -} - -// ------------------------------------------------------------------ - -HANDLE Os2SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBits, const BitmapPalette& rPal ) -{ - DBG_ASSERT( nBits == 1 || nBits == 4 || nBits == 8 || nBits == 24, "Unsupported BitCount!" ); - - HANDLE hDIB = 0; - - if ( rSize.Width() && rSize.Height() && ( nBits == 1 || nBits == 4 || nBits == 8 || nBits == 24 ) ) - { - const ULONG nImageSize = AlignedWidth4Bytes( nBits * rSize.Width() ) * rSize.Height(); - const USHORT nColors = ( nBits <= 8 ) ? ( 1 << nBits ) : 0; - - hDIB = (HANDLE) rtl_allocateZeroMemory( sizeof( BITMAPINFOHEADER2 ) + nColors * sizeof( RGB2 ) + nImageSize ); - - if( hDIB ) - { - // bitmap infos can be found at the beginning of the memory - PBITMAPINFO2 pBI = (PBITMAPINFO2) hDIB; - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) pBI; - - pBIH->cbFix = sizeof( BITMAPINFOHEADER2 ); - pBIH->cx = rSize.Width(); - pBIH->cy = rSize.Height(); - pBIH->cPlanes = 1; - pBIH->cBitCount = nBits; - pBIH->ulCompression = BCA_UNCOMP; // BI_RGB; - pBIH->cbImage = nImageSize; - pBIH->cxResolution = 0; - pBIH->cyResolution = 0; - pBIH->cclrUsed = 0; - pBIH->cclrImportant = 0; - - // Rest auf 0 setzen - memset( (PBYTE) &pBIH->usUnits, 0, (PBYTE) pBI->argbColor - (PBYTE) &pBIH->usUnits ); - - if( nColors ) - { - const USHORT nMinCount = Min( nColors, rPal.GetEntryCount() ); - - if( nMinCount ) - memcpy( pBI->argbColor, rPal.ImplGetColorBuffer(), nMinCount * sizeof( RGB2 ) ); - } - } - } - - return hDIB; -} - -// ------------------------------------------------------------------ - -HANDLE Os2SalBitmap::ImplCreateDIB4FromDIB1( HANDLE hDIB1 ) -{ - PBITMAPINFO2 pBI = (PBITMAPINFO2) hDIB1; - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) pBI; - PBYTE pBits = (PBYTE) pBI + *(ULONG*) pBIH + Os2SalBitmap::ImplGetDIBColorCount( hDIB1 ) * sizeof( RGB2 ); - ULONG nWidth = pBIH->cx, nHeight = pBIH->cy; - ULONG nAligned = AlignedWidth4Bytes( nWidth ); - ULONG nAligned4 = AlignedWidth4Bytes( nWidth << 2 ); - ULONG nSize4 = sizeof( BITMAPINFOHEADER2 ) + ( sizeof( RGB2 ) << 4 ) + nAligned4 * nHeight; - PBYTE pDIB4 = (PBYTE) rtl_allocateZeroMemory( nSize4 ); - PBITMAPINFO2 pBI4 = (PBITMAPINFO2) pDIB4; - PBITMAPINFOHEADER2 pBIH4 = (PBITMAPINFOHEADER2) pBI4; - BYTE aMap[ 4 ] = { 0x00, 0x01, 0x10, 0x11 }; - - memset( pBIH4, 0, sizeof( BITMAPINFOHEADER2 ) ); - pBIH4->cbFix = sizeof( BITMAPINFOHEADER2 ); - pBIH4->cx = nWidth; - pBIH4->cy = nHeight; - pBIH4->cPlanes = 1; - pBIH4->cBitCount = 4; - - // die ersten beiden Eintraege der 1Bit-Farbtabelle kopieren - memcpy( pBI4->argbColor, pBI->argbColor, sizeof( RGB2 ) << 1 ); - - PBYTE pBits4 = (PBYTE) pBI4 + *(ULONG*) pBIH4 + ( sizeof( RGB2 ) << 4 ); - - // 4Bit-DIB-Bilddaten setzen - for( ULONG nY = 0UL; nY < nHeight; nY++ ) - { - PBYTE pTmp = pBits; pBits += nAligned; - PBYTE pTmp4 = pBits4; pBits4 += nAligned4; - - for( ULONG nX = 0UL; nX < nWidth; nX += 8UL ) - { - *pTmp4++ = aMap[ ( *pTmp >> 6 ) & 3 ]; - *pTmp4++ = aMap[ ( *pTmp >> 4 ) & 3 ]; - *pTmp4++ = aMap[ ( *pTmp >> 2 ) & 3 ]; - *pTmp4++ = aMap[ *pTmp++ & 3 ]; - } - } - - return (HANDLE) pDIB4; -} - -// ------------------------------------------------------------------ - -HANDLE Os2SalBitmap::ImplCopyDIBOrDDB( HANDLE hHdl, BOOL bDIB ) -{ - HANDLE hCopy = 0; - - if( bDIB && hHdl ) - { - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) hHdl; - const ULONG nSize = sizeof( BITMAPINFOHEADER2 ) - + ImplGetDIBColorCount( hHdl ) * sizeof( RGB2 ) + - ( pBIH->cbImage ? pBIH->cbImage : AlignedWidth4Bytes( pBIH->cx * pBIH->cBitCount ) ); - - BYTE* pCopy = (BYTE*)rtl_allocateZeroMemory( nSize ); - memcpy( pCopy, (BYTE*) hHdl, nSize ); - hCopy = (HANDLE) pCopy; - } - else if( hHdl ) - { - HAB hAB = GetSalData()->mhAB; - HDC hSrcMemDC; - HDC hDestMemDC; - HPS hSrcMemPS; - HPS hDestMemPS; - HBITMAP hCopyBitmap; - BITMAPINFOHEADER2 aInfoHeader; - DEVOPENSTRUC aDevOpenStruc; - SIZEL size; - - aInfoHeader.cbFix = sizeof( BITMAPINFOHEADER2 ); - GpiQueryBitmapInfoHeader( hHdl, &aInfoHeader ); - size.cx = aInfoHeader.cx; - size.cy = aInfoHeader.cy; - - // Memory DCs erzeugen - aDevOpenStruc.pszLogAddress = 0; - aDevOpenStruc.pszDriverName = (PSZ)"DISPLAY"; - - hSrcMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 2, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - hDestMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 2, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - - // Memory PSs erzeugen - hSrcMemPS = Ft2CreatePS( hAB, hSrcMemDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - hDestMemPS = Ft2CreatePS( hAB, hDestMemDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - - Ft2SetBitmap( hSrcMemPS, hHdl ); - - if( !hHdl ) - { - memset( &aInfoHeader, 0, sizeof( BITMAPINFOHEADER2 ) ); - aInfoHeader.cbFix = sizeof( BITMAPINFOHEADER2 ); - aInfoHeader.cx = 0; - aInfoHeader.cy = 0; - aInfoHeader.cPlanes = 1; - aInfoHeader.cBitCount = 1; - } - - hCopy = GpiCreateBitmap( hDestMemPS, &aInfoHeader, 0, NULL, NULL ); - Ft2SetBitmap( hDestMemPS, hCopy ); - - POINTL pts[3]; - - pts[0].x = 0; - pts[0].y = 0; - pts[1].x = size.cx; - pts[1].y = size.cy; - pts[2].x = 0; - pts[2].y = 0; - - GpiBitBlt( hDestMemPS, hSrcMemPS, 3, pts, ROP_SRCCOPY, BBO_IGNORE ); - - Ft2SetBitmap( hSrcMemPS, (HBITMAP)0L); - Ft2SetBitmap( hDestMemPS, (HBITMAP)0L); - Ft2Associate( hSrcMemPS, NULLHANDLE ); - Ft2Associate( hDestMemPS, NULLHANDLE ); - Ft2DestroyPS( hSrcMemPS ); - Ft2DestroyPS( hDestMemPS ); - DevCloseDC( hSrcMemDC ); - DevCloseDC( hDestMemDC ); - } - - return hCopy; -} - -// ------------------------------------------------------------------ - -BitmapBuffer* Os2SalBitmap::AcquireBuffer( bool bReadOnly ) -{ - BitmapBuffer* pBuffer = NULL; - - if( mhDIB ) - { - // bitmap infos can be found at the beginning of the memory - PBITMAPINFO2 pBI = (PBITMAPINFO2) mhDIB; - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) pBI; - - if( ( pBIH->ulCompression == BCA_RLE4 ) || ( pBIH->ulCompression == BCA_RLE8 ) ) - { - Size aSizePix( pBIH->cx, pBIH->cy ); - HANDLE hNewDIB = ImplCreateDIB( aSizePix, pBIH->cBitCount, BitmapPalette() ); - - if( hNewDIB ) - { - // bitmap infos can be found at the beginning of the memory - PBITMAPINFO2 pNewBI = (PBITMAPINFO2) hNewDIB; - PBITMAPINFOHEADER2 pNewBIH = (PBITMAPINFOHEADER2) pNewBI; - const USHORT nColorCount = ImplGetDIBColorCount( hNewDIB ); - const ULONG nOffset = *(ULONG*) pBI + nColorCount * sizeof( RGB2 ); - BYTE* pOldBits = (BYTE*) pBI + nOffset; - BYTE* pNewBits = (BYTE*) pNewBI + nOffset; - - memcpy( pNewBI, pBI, nOffset ); - pNewBIH->ulCompression = 0; - ImplDecodeRLEBuffer( pOldBits, pNewBits, aSizePix, pBIH->ulCompression == BCA_RLE4 ); - - rtl_freeMemory( (void*)mhDIB ); - - mhDIB = hNewDIB; - pBI = pNewBI; - pBIH = pNewBIH; - } - } - - if( pBIH->cPlanes == 1 ) - { - pBuffer = new BitmapBuffer; - - pBuffer->mnFormat = BMP_FORMAT_BOTTOM_UP | - ( pBIH->cBitCount == 1 ? BMP_FORMAT_1BIT_MSB_PAL : - pBIH->cBitCount == 4 ? BMP_FORMAT_4BIT_MSN_PAL : - pBIH->cBitCount == 8 ? BMP_FORMAT_8BIT_PAL : - pBIH->cBitCount == 16 ? BMP_FORMAT_16BIT_TC_LSB_MASK : - pBIH->cBitCount == 24 ? BMP_FORMAT_24BIT_TC_BGR : - pBIH->cBitCount == 32 ? BMP_FORMAT_32BIT_TC_MASK : 0UL ); - - if( BMP_SCANLINE_FORMAT( pBuffer->mnFormat ) ) - { - pBuffer->mnWidth = maSize.Width(); - pBuffer->mnHeight = maSize.Height(); - pBuffer->mnScanlineSize = AlignedWidth4Bytes( maSize.Width() * pBIH->cBitCount ); - pBuffer->mnBitCount = (USHORT) pBIH->cBitCount; - - if( pBuffer->mnBitCount <= 8 ) - { - const USHORT nPalCount = ImplGetDIBColorCount( mhDIB ); - - pBuffer->maPalette.SetEntryCount( nPalCount ); - - if( nPalCount ) - memcpy( pBuffer->maPalette.ImplGetColorBuffer(), pBI->argbColor, nPalCount * sizeof( RGB2 ) ); - - pBuffer->mpBits = (BYTE*) pBI + *(ULONG*) pBI + nPalCount * sizeof( RGB2 ); - } - else - pBuffer->mpBits = (BYTE*) pBI + *(ULONG*) pBI; - } - else - { - delete pBuffer; - pBuffer = NULL; - } - } - } - - if( pBuffer && mhDIB1Subst ) - { - rtl_freeMemory( (void*)mhDIB1Subst ); - mhDIB1Subst = 0; - } - - return pBuffer; -} - -// ------------------------------------------------------------------ - -void Os2SalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) -{ - if( pBuffer ) - { - if( mhDIB ) - { - if( !bReadOnly && !!pBuffer->maPalette ) - { - // bitmap infos can be found at the beginning of the memory - PBITMAPINFO2 pBI = (PBITMAPINFO2) mhDIB; - const USHORT nCount = pBuffer->maPalette.GetEntryCount(); - - if( nCount ) - memcpy( pBI->argbColor, pBuffer->maPalette.ImplGetColorBuffer(), nCount * sizeof( RGB2 ) ); - } - } - - delete pBuffer; - } -} - -// ------------------------------------------------------------------ - -void Os2SalBitmap::ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf, - const Size& rSizePixel, BOOL bRLE4 ) -{ - HPBYTE pRLE = (HPBYTE) pSrcBuf; - HPBYTE pDIB = (HPBYTE) pDstBuf; - HPBYTE pRow = (HPBYTE) pDstBuf; - ULONG nWidthAl = AlignedWidth4Bytes( rSizePixel.Width() * ( bRLE4 ? 4UL : 8UL ) ); - HPBYTE pLast = pDIB + rSizePixel.Height() * nWidthAl - 1; - ULONG nCountByte; - ULONG nRunByte; - ULONG nX = 0; - ULONG i; - BYTE cTmp; - BOOL bEndDecoding = FALSE; - - if( pRLE && pDIB ) - { - do - { - if( !( nCountByte = *pRLE++ ) ) - { - nRunByte = *pRLE++; - - if( nRunByte > 2UL ) - { - if( bRLE4 ) - { - nCountByte = nRunByte >> 1UL; - - for( i = 0; i < nCountByte; i++ ) - { - cTmp = *pRLE++; - ImplSetPixel4( pDIB, nX++, cTmp >> 4 ); - ImplSetPixel4( pDIB, nX++, cTmp & 0x0f ); - } - - if( nRunByte & 1 ) - ImplSetPixel4( pDIB, nX++, *pRLE++ >> 4 ); - - if( ( ( nRunByte + 1 ) >> 1 ) & 1 ) - pRLE++; - } - else - { - memcpy( &pDIB[ nX ], pRLE, nRunByte ); - pRLE += nRunByte; - nX += nRunByte; - - if( nRunByte & 1 ) - pRLE++; - } - } - else if( !nRunByte ) - { - pDIB = ( pRow += nWidthAl ); - nX = 0UL; - } - else if( nRunByte == 1 ) - bEndDecoding = TRUE; - else - { - nX += *pRLE++; - pDIB = ( pRow += ( *pRLE++ ) * nWidthAl ); - } - } - else - { - cTmp = *pRLE++; - - if( bRLE4 ) - { - nRunByte = nCountByte >> 1; - - for( i = 0; i < nRunByte; i++ ) - { - ImplSetPixel4( pDIB, nX++, cTmp >> 4 ); - ImplSetPixel4( pDIB, nX++, cTmp & 0x0f ); - } - - if( nCountByte & 1 ) - ImplSetPixel4( pDIB, nX++, cTmp >> 4 ); - } - else - { - for( i = 0; i < nCountByte; i++ ) - pDIB[ nX++ ] = cTmp; - } - } - } - while( !bEndDecoding && ( pDIB <= pLast ) ); - } -} - -bool Os2SalBitmap::GetSystemData( BitmapSystemData& rData ) -{ - bool bRet = false; - if( mhDIB || mhDDB ) - { - bRet = true; - rData.pDIB = (void*)mhDIB; - rData.pDDB = (void*)mhDDB; - } - return bRet; -} diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx deleted file mode 100644 index 069abb1026e3..000000000000 --- a/vcl/os2/source/gdi/salgdi.cxx +++ /dev/null @@ -1,1038 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> -#include <svpm.h> - -#define _SV_SALGDI_CXX -#include <tools/debug.hxx> -#include <saldata.hxx> -#include <salgdi.h> -#include <tools/debug.hxx> -#include <salframe.h> -#include <tools/poly.hxx> -#ifndef _RTL_STRINGBUF_HXX -#include <rtl/strbuf.hxx> -#endif -#include "vcl/region.h" - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -// ----------- -// - Defines - -// ----------- - -// ClipRegions funktionieren immer noch nicht auf allen getesteten Druckern -#define SAL_PRINTER_CLIPPATH 1 -// #define SAL_PRINTER_POLYPATH 1 - -// ======================================================================= - -void ImplInitSalGDI() -{ -} - -// ----------------------------------------------------------------------- - -void ImplFreeSalGDI() -{ - SalData* pSalData = GetSalData(); - - // delete icon cache - SalIcon* pIcon = pSalData->mpFirstIcon; - while( pIcon ) - { - SalIcon* pTmp = pIcon->pNext; - WinDestroyPointer( pIcon->hIcon ); - delete pIcon; - pIcon = pTmp; - } - -} - -// ======================================================================= - -void ImplSalInitGraphics( Os2SalGraphics* pData ) -{ - GpiCreateLogColorTable( pData->mhPS, LCOL_RESET, LCOLF_RGB, 0, 0, NULL ); -} - -// ----------------------------------------------------------------------- - -void ImplSalDeInitGraphics( Os2SalGraphics* pData ) -{ -} - -// ======================================================================= - -Os2SalGraphics::Os2SalGraphics() -{ - for( int i = 0; i < MAX_FALLBACK; ++i ) - { - mhFonts[ i ] = 0; - mpOs2FontData[ i ] = NULL; - mpOs2FontEntry[ i ] = NULL; - } - - mfFontScale = 1.0; - - mhPS = 0; - mhDC = 0; - mbLine = FALSE; - mbFill = FALSE; - mbXORMode = FALSE; - mnFontMetricCount = 0; - mpFontMetrics = NULL; - mpClipRectlAry = NULL; - - mhDefFont = 0; - mpFontKernPairs = NULL; - mnFontKernPairCount = 0; - mbFontKernInit = FALSE; - -} - -// ----------------------------------------------------------------------- - -Os2SalGraphics::~Os2SalGraphics() -{ - Ft2DeleteSetId( mhPS, LCID_BASE); - - if ( mpFontMetrics ) - delete mpFontMetrics; - - if ( mpFontKernPairs ) - delete mpFontKernPairs; - -} - -// ----------------------------------------------------------------------- - -static SalColor ImplGetROPSalColor( SalROPColor nROPColor ) -{ - SalColor nSalColor; - - switch( nROPColor ) - { - case SAL_ROP_0: - nSalColor = MAKE_SALCOLOR( 0, 0, 0 ); - break; - - case SAL_ROP_1: - case SAL_ROP_INVERT: - nSalColor = MAKE_SALCOLOR( 255, 255, 255 ); - break; - } - - return nSalColor; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::GetResolution( long& rDPIX, long& rDPIY ) -{ - // since OOo asks for DPI, I will query FONT_RES, which seems to be - // more correct than _RESOLUTION fields (on my wide screen lcd) - // and does not require conversion - DevQueryCaps( mhDC, CAPS_HORIZONTAL_FONT_RES, 1, &rDPIX ); - DevQueryCaps( mhDC, CAPS_VERTICAL_FONT_RES, 1, &rDPIY ); -} - -// ----------------------------------------------------------------------- - -USHORT Os2SalGraphics::GetBitCount() -{ - LONG nBitCount; - DevQueryCaps( mhDC, CAPS_COLOR_BITCOUNT, 1, &nBitCount ); - return (USHORT)nBitCount; -} - -// ----------------------------------------------------------------------- - -long Os2SalGraphics::GetGraphicsWidth() const -{ - if( mhWnd ) - { - Os2SalFrame* pFrame = (Os2SalFrame*)GetWindowPtr( mhWnd ); - if( pFrame ) - { - if( pFrame->maGeometry.nWidth ) - return pFrame->maGeometry.nWidth; - else - { - // TODO: perhaps not needed, maGeometry should always be up-to-date - RECTL aRect; - WinQueryWindowRect( mhWnd, &aRect ); - return aRect.xRight; - } - } - } - - return 0; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::ResetClipRegion() -{ -#ifdef SAL_PRINTER_CLIPPATH - if ( mbPrinter ) - GpiSetClipPath( mhPS, 0, SCP_RESET ); - else -#endif - { - HRGN hOldRegion; - - GpiSetClipRegion( mhPS, NULL, &hOldRegion ); - if ( hOldRegion ) - GpiDestroyRegion( mhPS, hOldRegion ); - } -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::setClipRegion( const Region& i_rClip ) -{ - ULONG nCount = i_rClip.GetRectCount(); - - mpClipRectlAry = new RECTL[ nCount ]; - mnClipElementCount = 0; - - ImplRegionInfo aInfo; - long nX, nY, nW, nH; - bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); - while( bRegionRect ) - { - if ( nW && nH ) - { - RECTL* pClipRect = &mpClipRectlAry[ mnClipElementCount ]; - pClipRect->xLeft = nX; - pClipRect->yTop = mnHeight - nY; - pClipRect->xRight = nX + nW; - pClipRect->yBottom = mnHeight - (nY + nH); - mnClipElementCount++; - } - bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); - } -#ifdef SAL_PRINTER_CLIPPATH - if ( mbPrinter ) - { - GpiSetClipPath( mhPS, 0, SCP_RESET ); - GpiBeginPath( mhPS, 1L ); - - for( int i = 0; i < mnClipElementCount; i++ ) - { - POINTL aPt; - RECTL* pClipRect = &mpClipRectlAry[ i ]; - - aPt.x = pClipRect->xLeft; - aPt.y = pClipRect->yTop-1; - Ft2Move( mhPS, &aPt ); - - aPt.x = pClipRect->xRight-1; - aPt.y = pClipRect->yBottom; - - Ft2Box( mhPS, DRO_OUTLINE, &aPt, 0, 0 ); - } - - GpiEndPath( mhPS ); - GpiSetClipPath( mhPS, 1L, SCP_ALTERNATE | SCP_AND ); - } - else -#endif - { - HRGN hClipRegion = GpiCreateRegion( mhPS, - mnClipElementCount, - mpClipRectlAry ); - HRGN hOldRegion; - - GpiSetClipRegion( mhPS, hClipRegion, &hOldRegion ); - if( hOldRegion ) - GpiDestroyRegion( mhPS, hOldRegion ); - } - - delete [] mpClipRectlAry; - - return true; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetLineColor() -{ - // don't draw line! - mbLine = FALSE; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetLineColor( SalColor nSalColor ) -{ - LINEBUNDLE lb; - - // set color - lb.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); - - Ft2SetAttrs( mhPS, - PRIM_LINE, - LBB_COLOR, - 0, - &lb ); - - // draw line! - mbLine = TRUE; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetFillColor() -{ - // don't fill area! - mbFill = FALSE; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetFillColor( SalColor nSalColor ) -{ - AREABUNDLE ab; - - // set color - ab.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); - - Ft2SetAttrs( mhPS, - PRIM_AREA, - ABB_COLOR, - 0, - &ab ); - - // fill area! - mbFill = TRUE; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetXORMode( bool bSet, bool ) -{ - mbXORMode = bSet; - LONG nMixMode = bSet ? FM_XOR : FM_OVERPAINT; - - // set mix mode for lines - LINEBUNDLE lb; - lb.usMixMode = nMixMode; - Ft2SetAttrs( mhPS, - PRIM_LINE, - LBB_MIX_MODE, - 0, - &lb ); - - // set mix mode for areas - AREABUNDLE ab; - ab.usMixMode = nMixMode; - Ft2SetAttrs( mhPS, - PRIM_AREA, - ABB_MIX_MODE, - 0, - &ab ); - - // set mix mode for text - CHARBUNDLE cb; - cb.usMixMode = nMixMode; - Ft2SetAttrs( mhPS, - PRIM_CHAR, - CBB_MIX_MODE, - 0, - &cb ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetROPLineColor( SalROPColor nROPColor ) -{ - SetLineColor( ImplGetROPSalColor( nROPColor ) ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetROPFillColor( SalROPColor nROPColor ) -{ - SetFillColor( ImplGetROPSalColor( nROPColor ) ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawPixel( long nX, long nY ) -{ - POINTL aPt; - - aPt.x = nX; - aPt.y = TY( nY ); - - // set color - Ft2SetPel( mhPS, &aPt ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) -{ - // save old color - LINEBUNDLE oldLb; - GpiQueryAttrs( mhPS, - PRIM_LINE, - LBB_COLOR, - &oldLb ); - - // set new color - LINEBUNDLE lb; - lb.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); - Ft2SetAttrs( mhPS, - PRIM_LINE, - LBB_COLOR, - 0, - &lb ); - - // set color of pixel - POINTL aPt; - aPt.x = nX; - aPt.y = TY( nY ); - Ft2SetPel( mhPS, &aPt ); - - // restore old color - Ft2SetAttrs( mhPS, - PRIM_LINE, - LBB_COLOR, - 0, - &oldLb ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) -{ - // OS2 zeichnet den Endpunkt mit - POINTL aPt; - aPt.x = nX1; - aPt.y = TY( nY1 ); - Ft2Move( mhPS, &aPt ); - aPt.x = nX2; - aPt.y = TY( nY2 ); - GpiLine( mhPS, &aPt ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) -{ - POINTL aPt; - long lControl; - - if ( mbFill ) - { - if ( mbLine ) - lControl = DRO_OUTLINEFILL; - else - lControl = DRO_FILL; - } - else - { - if ( mbLine ) - lControl = DRO_OUTLINE; - else - return; - } - - aPt.x = nX; - aPt.y = TY( nY ); - Ft2Move( mhPS, &aPt ); - aPt.x = nX + nWidth - 1; - aPt.y = TY( nY + nHeight - 1 ); - Ft2Box( mhPS, lControl, &aPt, 0, 0 ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ) -{ - // convert all points to sys orientation - POINTL* pOS2PtAry = new POINTL[ nPoints ]; - POINTL* pTempOS2PtAry = pOS2PtAry; - const SalPoint* pTempPtAry = pPtAry; - ULONG nTempPoints = nPoints; - long nHeight = mnHeight - 1; - - while( nTempPoints-- ) - { - (*pTempOS2PtAry).x = (*pTempPtAry).mnX; - (*pTempOS2PtAry).y = nHeight - (*pTempPtAry).mnY; - pTempOS2PtAry++; - pTempPtAry++; - } - - Ft2Move( mhPS, pOS2PtAry ); - GpiPolyLine( mhPS, nPoints, pOS2PtAry ); - delete [] pOS2PtAry; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawPolygon( ULONG nPoints, const SalPoint* pPtAry ) -{ - PM_POLYGON aPolygon; - - // create polygon - aPolygon.aPointl = new POINTL[ nPoints ]; - aPolygon.ulPoints = nPoints; - - // convert all points to sys orientation - POINTL* pTempOS2PtAry = aPolygon.aPointl; - const SalPoint* pTempPtAry = pPtAry; - ULONG nTempPoints = nPoints; - long nHeight = mnHeight - 1; - - while( nTempPoints-- ) - { - (*pTempOS2PtAry).x = (*pTempPtAry).mnX; - (*pTempOS2PtAry).y = nHeight - (*pTempPtAry).mnY; - pTempOS2PtAry++; - pTempPtAry++; - } - - // Innenleben zeichnen - if ( mbFill ) - { -#ifdef SAL_PRINTER_POLYPATH - if ( mbPrinter ) - { - Ft2BeginPath( mhPS, 1 ); - Ft2Move( mhPS, aPolygon.aPointl ); - Ft2PolyLine( mhPS, aPolygon.ulPoints, aPolygon.aPointl ); - Ft2EndPath( mhPS ); - Ft2FillPath( mhPS, 1, 0 ); - - if ( mbLine ) - { - Ft2Move( mhPS, aPolygon.aPointl ); - Ft2PolyLine( mhPS, aPolygon.ulPoints, aPolygon.aPointl ); - } - } - else -#endif - { - ULONG nOptions = POLYGON_ALTERNATE; - - if ( mbLine ) - nOptions |= POLYGON_BOUNDARY; - else - nOptions |= POLYGON_NOBOUNDARY; - - Ft2Move( mhPS, aPolygon.aPointl ); - GpiPolygons( mhPS, 1, &aPolygon, nOptions, POLYGON_EXCL ); - } - } - else - { - if ( mbLine ) - { - Ft2Move( mhPS, aPolygon.aPointl ); - GpiPolyLine( mhPS, nPoints, aPolygon.aPointl ); - } - } - - delete [] aPolygon.aPointl; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, - PCONSTSALPOINT* pPtAry ) -{ - ULONG i; - long nHeight = mnHeight - 1; - PM_POLYGON* aPolygonAry = new PM_POLYGON[ nPoly ]; - - for( i = 0; i < nPoly; i++ ) - { - const SalPoint * pTempPtAry = (const SalPoint*)pPtAry[ i ]; - - // create polygon - ULONG nTempPoints = pPoints[ i ]; - POINTL * pTempOS2PtAry = new POINTL[ nTempPoints ]; - - // convert all points to sys orientation - aPolygonAry[ i ].ulPoints = nTempPoints; - aPolygonAry[ i ].aPointl = pTempOS2PtAry; - - while( nTempPoints-- ) - { - (*pTempOS2PtAry).x = (*pTempPtAry).mnX; - (*pTempOS2PtAry).y = nHeight - (*pTempPtAry).mnY; - pTempOS2PtAry++; - pTempPtAry++; - } - } - - // Innenleben zeichnen - if ( mbFill ) - { -#ifdef SAL_PRINTER_POLYPATH - if ( mbPrinter ) - { - Ft2BeginPath( mhPS, 1 ); - for ( i = 0; i < nPoly; i++ ) - { - Ft2Move( mhPS, aPolygonAry[i].aPointl ); - Ft2PolyLine( mhPS, aPolygonAry[i].ulPoints, aPolygonAry[i].aPointl ); - } - Ft2EndPath( mhPS ); - Ft2FillPath( mhPS, 1, 0 ); - } - else -#endif - { - ULONG nOptions = POLYGON_ALTERNATE; - - if ( mbLine ) - nOptions |= POLYGON_BOUNDARY; - else - nOptions |= POLYGON_NOBOUNDARY; - - Ft2Move( mhPS, aPolygonAry[ 0 ].aPointl ); - GpiPolygons( mhPS, nPoly, aPolygonAry, nOptions, POLYGON_EXCL ); - } - } - else - { - if ( mbLine ) - { - for( i = 0; i < nPoly; i++ ) - { - Ft2Move( mhPS, aPolygonAry[ i ].aPointl ); - GpiPolyLine( mhPS, aPolygonAry[ i ].ulPoints, aPolygonAry[ i ].aPointl ); - } - } - } - - // cleanup - for( i = 0; i < nPoly; i++ ) - delete [] aPolygonAry[ i ].aPointl; - delete [] aPolygonAry; -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fTransparency*/ ) -{ - // TODO: implement and advertise OutDevSupport_B2DDraw support - return false; -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::drawPolyLine( - const basegfx::B2DPolygon& /*rPolygon*/, - double /*fTransparency*/, - const basegfx::B2DVector& /*rLineWidths*/, - basegfx::B2DLineJoin /*eLineJoin*/) -{ - // TODO: implement - return false; -} - -// ----------------------------------------------------------------------- - -sal_Bool Os2SalGraphics::drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) -{ - return sal_False; -} - -// ----------------------------------------------------------------------- - -sal_Bool Os2SalGraphics::drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) -{ - return sal_False; -} - -// ----------------------------------------------------------------------- - -sal_Bool Os2SalGraphics::drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, - const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ) -{ - return sal_False; -} - -// ======================================================================= - -// MAXIMUM BUFSIZE EQ 0xFFFF -#define POSTSCRIPT_BUFSIZE 0x4000 -// we only try to get the BoundingBox in the first 4096 bytes -#define POSTSCRIPT_BOUNDINGSEARCH 0x1000 - -static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize ) -{ - while ( nComp-- >= nSize ) - { - ULONG i; - for ( i = 0; i < nSize; i++ ) - { - if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) ) - break; - } - if ( i == nSize ) - return pSource; - pSource++; - } - return NULL; -} - - -static BOOL ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize ) -{ - BOOL bRetValue = FALSE; - BYTE* pDest = ImplSearchEntry( pSource, (BYTE*)"%%BoundingBox:", nSize, 14 ); - if ( pDest ) - { - nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0; - pDest += 14; - - int nSizeLeft = nSize - ( pDest - pSource ); - if ( nSizeLeft > 100 ) - nSizeLeft = 100; // only 100 bytes following the bounding box will be checked - - int i; - for ( i = 0; ( i < 4 ) && nSizeLeft; i++ ) - { - int nDivision = 1; - BOOL bDivision = FALSE; - BOOL bNegative = FALSE; - BOOL bValid = TRUE; - - while ( ( --nSizeLeft ) && ( *pDest == ' ' ) || ( *pDest == 0x9 ) ) pDest++; - BYTE nByte = *pDest; - while ( nSizeLeft && ( nByte != ' ' ) && ( nByte != 0x9 ) && ( nByte != 0xd ) && ( nByte != 0xa ) ) - { - switch ( nByte ) - { - case '.' : - if ( bDivision ) - bValid = FALSE; - else - bDivision = TRUE; - break; - case '-' : - bNegative = TRUE; - break; - default : - if ( ( nByte < '0' ) || ( nByte > '9' ) ) - nSizeLeft = 1; // error parsing the bounding box values - else if ( bValid ) - { - if ( bDivision ) - nDivision*=10; - nNumb[i] *= 10; - nNumb[i] += nByte - '0'; - } - break; - } - nSizeLeft--; - nByte = *(++pDest); - } - if ( bNegative ) - nNumb[i] = -nNumb[i]; - if ( bDivision && ( nDivision != 1 ) ) - nNumb[i] /= nDivision; - } - if ( i == 4 ) - bRetValue = TRUE; - } - return bRetValue; -} - -#if 0 -static void ImplWriteDouble( BYTE** pBuf, double nNumber ) -{ -// *pBuf += sprintf( (char*)*pBuf, "%f", nNumber ); - - if ( nNumber < 0 ) - { - *(*pBuf)++ = (BYTE)'-'; - nNumber = -nNumber; - } - ULONG nTemp = (ULONG)nNumber; - const String aNumber1( nTemp ); - ULONG nLen = aNumber1.Len(); - - for ( USHORT n = 0; n < nLen; n++ ) - *(*pBuf)++ = aNumber1[ n ]; - - nTemp = (ULONG)( ( nNumber - nTemp ) * 100000 ); - if ( nTemp ) - { - *(*pBuf)++ = (BYTE)'.'; - const String aNumber2( nTemp ); - - ULONG nLen = aNumber2.Len(); - if ( nLen < 8 ) - { - for ( n = 0; n < ( 5 - nLen ); n++ ) - { - *(*pBuf)++ = (BYTE)'0'; - } - } - for ( USHORT n = 0; n < nLen; n++ ) - { - *(*pBuf)++ = aNumber2[ n ]; - } - } - *(*pBuf)++ = ' '; -} -#endif - -inline void ImplWriteString( BYTE** pBuf, const char* sString ) -{ - strcpy( (char*)*pBuf, sString ); - *pBuf += strlen( sString ); -} - -BOOL Os2SalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ) -{ - if ( !mbPrinter ) - return FALSE; - - BOOL bRet = FALSE; - LONG nLong = 0; - if ( !(DevQueryCaps( mhDC, CAPS_TECHNOLOGY, 1, &nLong ) && - (CAPS_TECH_POSTSCRIPT == nLong)) ) - return FALSE; - - BYTE* pBuf = new BYTE[ POSTSCRIPT_BUFSIZE ]; - double nBoundingBox[4]; - - if ( pBuf && ImplGetBoundingBox( nBoundingBox, (BYTE*)pPtr, nSize ) ) - { - LONG pOS2DXAry[4]; // hack -> print always 2 white space - POINTL aPt; - aPt.x = 0; - aPt.y = 0; - PCH pStr = (PCH) " "; - for( long i = 0; i < 4; i++ ) - pOS2DXAry[i] = i; - Ft2CharStringPosAt( mhPS, &aPt, NULL, 0, 2, (PCH)pStr,(PLONG)&pOS2DXAry[0] ); - - OStringBuffer aBuf( POSTSCRIPT_BUFSIZE ); - - // reserve place for a USHORT - aBuf.append( "aa" ); - - // #107797# Write out EPS encapsulation header - // ---------------------------------------------------------------------------------- - - // directly taken from the PLRM 3.0, p. 726. Note: - // this will definitely cause problems when - // recursively creating and embedding PostScript files - // in OOo, since we use statically-named variables - // here (namely, b4_Inc_state_salWin, dict_count_salWin and - // op_count_salWin). Currently, I have no idea on how to - // work around that, except from scanning and - // interpreting the EPS for unused identifiers. - - // append the real text - aBuf.append( "\n\n/b4_Inc_state_salWin save def\n" - "/dict_count_salWin countdictstack def\n" - "/op_count_salWin count 1 sub def\n" - "userdict begin\n" - "/showpage {} def\n" - "0 setgray 0 setlinecap\n" - "1 setlinewidth 0 setlinejoin\n" - "10 setmiterlimit [] 0 setdash newpath\n" - "/languagelevel where\n" - "{\n" - " pop languagelevel\n" - " 1 ne\n" - " {\n" - " false setstrokeadjust false setoverprint\n" - " } if\n" - "} if\n\n" ); - -#if 0 - // #i10737# Apply clipping manually - // ---------------------------------------------------------------------------------- - - // Windows seems to ignore any clipping at the HDC, - // when followed by a POSTSCRIPT_PASSTHROUGH - - // Check whether we've got a clipping, consisting of - // exactly one rect (other cases should be, but aren't - // handled currently) - - // TODO: Handle more than one rectangle here (take - // care, the buffer can handle only POSTSCRIPT_BUFSIZE - // characters!) - if ( mhRegion != 0 && - mpStdClipRgnData != NULL && - mpClipRgnData == mpStdClipRgnData && - mpClipRgnData->rdh.nCount == 1 ) - { - RECT* pRect = &(mpClipRgnData->rdh.rcBound); - - aBuf.append( "\nnewpath\n" ); - aBuf.append( pRect->left ); - aBuf.append( " " ); - aBuf.append( pRect->top ); - aBuf.append( " moveto\n" ); - aBuf.append( pRect->right ); - aBuf.append( " " ); - aBuf.append( pRect->top ); - aBuf.append( " lineto\n" ); - aBuf.append( pRect->right ); - aBuf.append( " " ); - aBuf.append( pRect->bottom ); - aBuf.append( " lineto\n" ); - aBuf.append( pRect->left ); - aBuf.append( " " ); - aBuf.append( pRect->bottom ); - aBuf.append( " lineto\n" - "closepath\n" - "clip\n" - "newpath\n" ); - } -#endif - - // #107797# Write out buffer - // ---------------------------------------------------------------------------------- - *((USHORT*)aBuf.getStr()) = (USHORT)( aBuf.getLength() - 2 ); - //Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 ); - DevEscape( mhDC, DEVESC_RAWDATA, aBuf.getLength(), - (PBYTE)aBuf.getStr(), 0, NULL ); - - double dM11 = nWidth / ( nBoundingBox[2] - nBoundingBox[0] ); - double dM22 = - ( nHeight / (nBoundingBox[1] - nBoundingBox[3] ) ); - - // reserve a USHORT again - aBuf.setLength( 2 ); - aBuf.append( "\n\n[" ); - aBuf.append( dM11 ); - aBuf.append( " 0 0 " ); - aBuf.append( dM22 ); - aBuf.append( ' ' ); - aBuf.append( nX - ( dM11 * nBoundingBox[0] ) ); - aBuf.append( ' ' ); - aBuf.append( nY - ( dM22 * nBoundingBox[3] ) ); - aBuf.append( "] concat\n" - "%%BeginDocument:\n" ); - *((USHORT*)aBuf.getStr()) = (USHORT)( aBuf.getLength() - 2 ); - DevEscape( mhDC, DEVESC_RAWDATA, aBuf.getLength(), - (PBYTE)aBuf.getStr(), 0, NULL ); -#if 0 - BYTE* pTemp = pBuf; - ImplWriteString( &pTemp, "save\n[ " ); - ImplWriteDouble( &pTemp, dM11 ); - ImplWriteDouble( &pTemp, 0 ); - ImplWriteDouble( &pTemp, 0 ); - ImplWriteDouble( &pTemp, dM22 ); - ImplWriteDouble( &pTemp, nX - ( dM11 * nBoundingBox[0] ) ); - ImplWriteDouble( &pTemp, mnHeight - nY - ( dM22 * nBoundingBox[3] ) ); - ImplWriteString( &pTemp, "] concat /showpage {} def\n" ); - - if ( DevEscape( mhDC, DEVESC_RAWDATA, pTemp - pBuf, - (PBYTE)pBuf, 0, NULL ) == DEV_OK ) -#endif // - { - UINT32 nToDo = nSize; - UINT32 nDoNow; - bRet = TRUE; - while( nToDo && bRet ) - { - nDoNow = 0x4000; - if ( nToDo < nDoNow ) - nDoNow = nToDo; - - if ( DevEscape( mhDC, DEVESC_RAWDATA, nDoNow, (PBYTE)pPtr + nSize - nToDo, - 0, NULL ) == -1 ) - bRet = FALSE; - nToDo -= nDoNow; - } - - if ( bRet ) - { - strcpy ( (char*)pBuf, "\nrestore\n" ); - if ( DevEscape( mhDC, DEVESC_RAWDATA, 9, (PBYTE)pBuf, - 0, NULL ) == DEV_OK ) bRet = TRUE; - } - - // #107797# Write out EPS encapsulation footer - // ---------------------------------------------------------------------------------- - // reserve a USHORT again - aBuf.setLength( 2 ); - aBuf.append( "%%EndDocument\n" - "count op_count_salWin sub {pop} repeat\n" - "countdictstack dict_count_salWin sub {end} repeat\n" - "b4_Inc_state_salWin restore\n\n" ); - *((USHORT*)aBuf.getStr()) = (USHORT)( aBuf.getLength() - 2 ); - DevEscape( mhDC, DEVESC_RAWDATA, aBuf.getLength(), - (PBYTE)aBuf.getStr(), 0, NULL ); - bRet = TRUE; - - } - } - delete [] pBuf; - return bRet; -} - -/* - * IsNativeControlSupported() - * - * Returns TRUE if the platform supports native - * drawing of the control defined by nPart - */ -BOOL Os2SalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) -{ - return( FALSE ); -} - -// ----------------------------------------------------------------------- - -SystemGraphicsData Os2SalGraphics::GetGraphicsData() const -{ - SystemGraphicsData aRes; - aRes.nSize = sizeof(aRes); -#if 0 - aRes.hDC = mhDC; -#endif - return aRes; -} - -// ----------------------------------------------------------------------- diff --git a/vcl/os2/source/gdi/salgdi2.cxx b/vcl/os2/source/gdi/salgdi2.cxx deleted file mode 100644 index 37621ee1f6a8..000000000000 --- a/vcl/os2/source/gdi/salgdi2.cxx +++ /dev/null @@ -1,786 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> -#include <svpm.h> - -#define _SV_SALGDI2_CXX -#include <salbmp.h> -#include <saldata.hxx> -#ifndef _SV_SALIDS_HRC -#include <salids.hrc> -#endif -#include <salgdi.h> -#include <salvd.h> -#include <vcl/salbtype.hxx> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -BOOL bFastTransparent = FALSE; - -// ----------- -// - Defines - -// ----------- - -#define RGBCOLOR( r, g, b ) ((ULONG)(((BYTE)(b)|((USHORT)(g)<<8))|(((ULONG)(BYTE)(r))<<16))) -#define TY( y ) (mnHeight-(y)-1) - -// --------------- -// - SalGraphics - -// --------------- - -bool Os2SalGraphics::supportsOperation( OutDevSupportType ) const -{ - return false; -} - - -void Os2SalGraphics::copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ) -{ - HPS hSrcPS; - POINTL thePoints[4]; - long nSrcHeight; - - if ( pSrcGraphics ) - { - //hSrcPS = pSrcGraphics->mhPS; - //nSrcHeight = pSrcGraphics->mnHeight; - hSrcPS = static_cast<Os2SalGraphics*>(pSrcGraphics)->mhPS; - nSrcHeight = static_cast<Os2SalGraphics*>(pSrcGraphics)->mnHeight; - } - else - { - hSrcPS = mhPS; - nSrcHeight = mnHeight; - } - - // lower-left corner of target - thePoints[0].x = pPosAry->mnDestX; - thePoints[0].y = TY( pPosAry->mnDestY + pPosAry->mnDestHeight - 1 ); - - // upper-right corner of target - thePoints[1].x = pPosAry->mnDestX + pPosAry->mnDestWidth; - thePoints[1].y = TY( pPosAry->mnDestY - 1 ); - - // lower-left corner of source - thePoints[2].x = pPosAry->mnSrcX; - thePoints[2].y = nSrcHeight - ( pPosAry->mnSrcY + pPosAry->mnSrcHeight ); - - if ( ( pPosAry->mnDestWidth != pPosAry->mnSrcWidth ) || ( pPosAry->mnDestHeight != pPosAry->mnSrcHeight ) ) - { - // upper-right corner of Source - thePoints[3].x = pPosAry->mnSrcX + pPosAry->mnSrcWidth; - thePoints[3].y = nSrcHeight - pPosAry->mnSrcY + pPosAry->mnSrcHeight; - - GpiBitBlt( mhPS, hSrcPS, 4, thePoints, - mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY, BBO_IGNORE ); - } - else - { - GpiBitBlt( mhPS, hSrcPS, 3, thePoints, - mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY, BBO_IGNORE ); - } -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::copyArea( long nDestX, long nDestY, - long nSrcX, long nSrcY, - long nSrcWidth, long nSrcHeight, - USHORT nFlags ) -{ - POINTL thePoints[3]; - - // lower-left corner of target - thePoints[0].x = nDestX; - thePoints[0].y = TY( nDestY + nSrcHeight - 1 ); - - // upper-right corner of target - thePoints[1].x = nDestX + nSrcWidth; - thePoints[1].y = TY( nDestY - 1 ); - - // lower-left corner of source - thePoints[2].x = nSrcX; - thePoints[2].y = TY( nSrcY + nSrcHeight - 1); - - if ( (nFlags & SAL_COPYAREA_WINDOWINVALIDATE) && mbWindow ) - { - // Overlap-Bereich berechnen und invalidieren - Point aVCLSrcPos( nSrcX, nSrcY ); - Size aVCLSrcSize( nSrcWidth, nSrcHeight ); - Rectangle aVCLSrcRect( aVCLSrcPos, aVCLSrcSize ); - Rectangle aVCLClipRect; - SWP aSWP; - - WinQueryWindowPos( mhWnd, &aSWP ); - aVCLClipRect.Right() = aSWP.cx-1; - aVCLClipRect.Bottom() = aSWP.cy-1; - if ( !aVCLSrcRect.Intersection( aVCLClipRect ).IsEmpty() ) - { - RECTL aSrcRect; - RECTL aTempRect; - HRGN hInvalidateRgn; - HRGN hTempRgn; - HWND hWnd; - long nRgnType; - - long nVCLScrHeight = aVCLSrcRect.GetHeight(); - aSrcRect.xLeft = aVCLSrcRect.Left(); - aSrcRect.yBottom = TY( aVCLSrcRect.Top()+nVCLScrHeight-1 ); - aSrcRect.xRight = aSrcRect.xLeft+aVCLSrcRect.GetWidth(); - aSrcRect.yTop = aSrcRect.yBottom+nVCLScrHeight; - - // Rechteck in Screen-Koordinaaten umrechnen - POINTL aPt; - long nScreenDX = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); - long nScreenDY = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ); - aPt.x = 0; - aPt.y = 0; - WinMapWindowPoints( mhWnd, HWND_DESKTOP, &aPt, 1 ); - aSrcRect.xLeft += aPt.x; - aSrcRect.yTop += aPt.y; - aSrcRect.xRight += aPt.x; - aSrcRect.yBottom += aPt.y; - hInvalidateRgn = 0; - // Bereiche ausserhalb des sichtbaren Bereiches berechnen - if ( aSrcRect.xLeft < 0 ) - { - if ( !hInvalidateRgn ) - hInvalidateRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - aTempRect.xLeft = -31999; - aTempRect.yBottom = 0; - aTempRect.xRight = 0; - aTempRect.yTop = 31999; - hTempRgn = GpiCreateRegion( mhPS, 1, &aTempRect ); - GpiCombineRegion( mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - } - if ( aSrcRect.yBottom < 0 ) - { - if ( !hInvalidateRgn ) - hInvalidateRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - aTempRect.xLeft = 0; - aTempRect.yBottom = -31999; - aTempRect.xRight = 31999; - aTempRect.yTop = 0; - hTempRgn = GpiCreateRegion( mhPS, 1, &aTempRect ); - GpiCombineRegion( mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - } - if ( aSrcRect.xRight > nScreenDX ) - { - if ( !hInvalidateRgn ) - hInvalidateRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - aTempRect.xLeft = nScreenDX; - aTempRect.yBottom = 0; - aTempRect.xRight = 31999; - aTempRect.yTop = 31999; - hTempRgn = GpiCreateRegion( mhPS, 1, &aTempRect ); - GpiCombineRegion( mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - } - if ( aSrcRect.yTop > nScreenDY ) - { - if ( !hInvalidateRgn ) - hInvalidateRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - aTempRect.xLeft = 0; - aTempRect.yBottom = nScreenDY; - aTempRect.xRight = 31999; - aTempRect.yTop = 31999; - hTempRgn = GpiCreateRegion( mhPS, 1, &aTempRect ); - GpiCombineRegion( mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - } - - // Bereiche die von anderen Fenstern ueberlagert werden berechnen - // Calculate areas that are overlapped by other windows - HWND hWndParent = WinQueryWindow( mhWnd, QW_PARENT ); - hWnd = WinQueryWindow( HWND_DESKTOP, QW_TOP ); - aVCLSrcRect = Rectangle( aSrcRect.xLeft, aSrcRect.yBottom, aSrcRect.xRight, aSrcRect.yTop ); - while ( hWnd ) - { - if ( hWnd == hWndParent ) - break; - if ( WinIsWindowVisible( hWnd ) ) - { - WinQueryWindowPos( hWnd, &aSWP ); - if ( !(aSWP.fl & SWP_MINIMIZE) ) - { - aVCLClipRect = Rectangle( Point( aSWP.x, aSWP.y ), Size( aSWP.cx, aSWP.cy ) ); - if ( aVCLSrcRect.IsOver( aVCLClipRect ) ) - { - if ( !hInvalidateRgn ) - hInvalidateRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - aTempRect.xLeft = aSWP.x; - aTempRect.yBottom = aSWP.y; - aTempRect.xRight = aTempRect.xLeft+aSWP.cx; - aTempRect.yTop = aTempRect.yBottom+aSWP.cy; - hTempRgn = GpiCreateRegion( mhPS, 1, &aTempRect ); - GpiCombineRegion( mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - } - } - } - hWnd = WinQueryWindow( hWnd, QW_NEXT ); - } - - if ( hInvalidateRgn ) - { - hTempRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - nRgnType = GpiCombineRegion( mhPS, hInvalidateRgn, hTempRgn, hInvalidateRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - if ( (nRgnType != RGN_ERROR) && (nRgnType != RGN_NULL) ) - { - long nOffX = (nDestX-nSrcX); - long nOffY = (nSrcY-nDestY); - aPt.x = nOffX-aPt.x; - aPt.y = nOffY-aPt.y; - GpiOffsetRegion( mhPS, hInvalidateRgn, &aPt ); - WinInvalidateRegion( mhWnd, hInvalidateRgn, TRUE ); - // Hier loesen wir nur ein Update aus, wenn es der - // MainThread ist, damit es beim Bearbeiten der - // Paint-Message keinen Deadlock gibt, da der - // SolarMutex durch diesen Thread schon gelockt ist - SalData* pSalData = GetSalData(); - ULONG nCurThreadId = GetCurrentThreadId(); - if ( pSalData->mnAppThreadId == nCurThreadId ) - WinUpdateWindow( mhWnd ); - } - GpiDestroyRegion( mhPS, hInvalidateRgn ); - } - } - } - - GpiBitBlt( mhPS, mhPS, 3, thePoints, - ROP_SRCCOPY, BBO_IGNORE ); - -} - -// ----------------------------------------------------------------------- - -void ImplDrawBitmap( HPS hPS, long nScreenHeight, - const SalTwoRect* pPosAry, const Os2SalBitmap& rSalBitmap, - BOOL bPrinter, int nDrawMode ) -{ - if( hPS ) - { - HANDLE hDrawDIB; - HBITMAP hDrawDDB = rSalBitmap.ImplGethDDB(); - Os2SalBitmap* pTmpSalBmp = NULL; - BOOL bPrintDDB = ( bPrinter && hDrawDDB ); - BOOL bDrawDDB1 = ( ( rSalBitmap.GetBitCount() == 1 ) && hDrawDDB ); - - if( bPrintDDB || bDrawDDB1 ) - { - pTmpSalBmp = new Os2SalBitmap; - pTmpSalBmp->Create( rSalBitmap, rSalBitmap.GetBitCount() ); - hDrawDIB = pTmpSalBmp->ImplGethDIB(); - } - else - hDrawDIB = rSalBitmap.ImplGethDIB(); - - if( hDrawDIB ) - { - HANDLE hSubst = rSalBitmap.ImplGethDIB1Subst(); - POINTL pts[ 4 ]; - BITMAPINFO2* pBI = (BITMAPINFO2*) hDrawDIB; - BITMAPINFOHEADER2* pBIH = (BITMAPINFOHEADER2*) pBI; - const long nHeight = pBIH->cy; - long nInfoSize = *(ULONG*) pBI + rSalBitmap.ImplGetDIBColorCount( hDrawDIB ) * sizeof( RGB2 ); - BYTE* pBits = (BYTE*) pBI + nInfoSize; - - pts[0].x = pPosAry->mnDestX; - pts[0].y = nScreenHeight - pPosAry->mnDestY - pPosAry->mnDestHeight; - pts[1].x = pPosAry->mnDestX + pPosAry->mnDestWidth - 1; - pts[1].y = nScreenHeight - pPosAry->mnDestY - 1; - - pts[2].x = pPosAry->mnSrcX; - pts[2].y = nHeight - ( pPosAry->mnSrcY + pPosAry->mnSrcHeight ); - pts[3].x = pPosAry->mnSrcX + pPosAry->mnSrcWidth; - pts[3].y = nHeight - pPosAry->mnSrcY; - - // if we've got a 1Bit DIB, we create a 4Bit substitute - if( ( pBIH->cBitCount == 1 ) && !hSubst ) - { - // create 4Bit substitute - hSubst = Os2SalBitmap::ImplCreateDIB4FromDIB1( hDrawDIB ); - - // replace substitute only, if it is no temporary SalBitmap - if( !( bPrintDDB || bDrawDDB1 ) ) - ( (Os2SalBitmap&) rSalBitmap ).ImplReplacehDIB1Subst( hSubst ); - } - - if( hSubst ) - { - pBI = (BITMAPINFO2*) hSubst; - pBIH = (BITMAPINFOHEADER2*) pBI; - nInfoSize = *(ULONG*) pBI + rSalBitmap.ImplGetDIBColorCount( hSubst ) * sizeof( RGB2 ); - pBits = (BYTE*) pBI + nInfoSize; - } - - if( bPrinter ) - { - BYTE* pDummy; - - // expand 8Bit-DIB's to 24Bit-DIB's, because some printer drivers - // have problems to print these DIB's (strange) - if( pBIH->cBitCount == 8 && pBIH->ulCompression == BCA_UNCOMP ) - { - const long nWidth = pBIH->cx; - const long nHeight = pBIH->cy; - const long nWidthAl8 = AlignedWidth4Bytes( nWidth * 8 ); - const long nWidthAl24 = AlignedWidth4Bytes( nWidth * 24 ); - const long nNewImageSize = nHeight * nWidthAl24; - BITMAPINFOHEADER2* pNewInfo; - - pDummy = new BYTE[ sizeof( BITMAPINFO2 ) + nNewImageSize ]; - memset( pDummy, 0, sizeof( BITMAPINFO2 ) ); - - pNewInfo = (BITMAPINFOHEADER2*) pDummy; - pNewInfo->cbFix = sizeof( BITMAPINFOHEADER2 ); - pNewInfo->cx = nWidth; - pNewInfo->cy = nHeight; - pNewInfo->cPlanes = 1; - pNewInfo->cBitCount = 24; - pNewInfo->ulCompression = BCA_UNCOMP; - pNewInfo->cbImage = nNewImageSize; - - BYTE* pBitsSrc = (BYTE*) pBIH + nInfoSize; - BYTE* pBitsDst = pDummy + sizeof( BITMAPINFO2 ); - - for( long nY = 0UL; nY < nHeight; nY++ ) - { - BYTE* pSrcLine = pBitsSrc + nY * nWidthAl8; - BYTE* pDstLine = pBitsDst + nY * nWidthAl24; - - for( long nX = 0UL; nX < nWidth; nX++ ) - { - const RGB2& rQuad = pBI->argbColor[ *pSrcLine++ ]; - - *pDstLine++ = rQuad.bBlue; - *pDstLine++ = rQuad.bGreen; - *pDstLine++ = rQuad.bRed; - } - } - - nInfoSize = sizeof( BITMAPINFO2 ); - } - else - { - const long nImageSize = ( pBIH->cbImage ? pBIH->cbImage : ( pBIH->cy * AlignedWidth4Bytes( pBIH->cx * pBIH->cBitCount ) ) ); - const long nTotalSize = nInfoSize + nImageSize; - - pDummy = new BYTE[ nTotalSize ]; - memcpy( pDummy, pBI, nTotalSize ); - } - - GpiDrawBits( hPS, pDummy + nInfoSize, (BITMAPINFO2*) pDummy, 4L, pts, nDrawMode, BBO_IGNORE ); - delete[] pDummy; - } - else - GpiDrawBits( hPS, pBits, pBI, 4L, pts, nDrawMode, BBO_IGNORE ); - } - else if( hDrawDDB && !bPrintDDB ) - { - POINTL pts[ 4 ]; - - pts[0].x = pPosAry->mnDestX; - pts[0].y = nScreenHeight - pPosAry->mnDestY - pPosAry->mnDestHeight; - pts[1].x = pPosAry->mnDestX + pPosAry->mnDestWidth - 1; - pts[1].y = nScreenHeight - pPosAry->mnDestY - 1; - - pts[2].x = pPosAry->mnSrcX; - pts[2].y = rSalBitmap.GetSize().Height() - ( pPosAry->mnSrcY + pPosAry->mnSrcHeight ); - pts[3].x = pPosAry->mnSrcX + pPosAry->mnSrcWidth; - pts[3].y = rSalBitmap.GetSize().Height() - pPosAry->mnSrcY; - - GpiWCBitBlt( hPS, hDrawDDB, 4L, pts, nDrawMode, BBO_IGNORE ); -/* - HPS hDrawPS = ImplGetCachedPS( CACHED_HPS_DRAW, hDrawDDB ); - Ft2BitBlt( hPS, hDrawPS, 4, pts, nDrawMode, BBO_IGNORE ); - ImplReleaseCachedPS( CACHED_HPS_DRAW ); -*/ - } - - if( bPrintDDB || bDrawDDB1 ) - delete pTmpSalBmp; - } -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap ) -{ - ImplDrawBitmap( mhPS, mnHeight, - pPosAry, static_cast<const Os2SalBitmap&>(rSalBitmap), - mbPrinter, - mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, - SalColor nTransparentColor ) -{ - DBG_ASSERT( !mbPrinter, "No transparency print possible!" ); - //const Os2SalBitmap& rSalBitmap = static_cast<const Os2SalBitmap&>(rSSalBitmap); - // an FM: kann erst einmal unberuecksichtigt bleiben - drawBitmap( pPosAry, rSalBitmap ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSSalBitmap, - const SalBitmap& rSTransparentBitmap ) -{ - DBG_ASSERT( !mbPrinter, "No transparency print possible!" ); - - const Os2SalBitmap& rSalBitmap = static_cast<const Os2SalBitmap&>(rSSalBitmap); - const Os2SalBitmap& rTransparentBitmap = static_cast<const Os2SalBitmap&>(rSTransparentBitmap); - - if( bFastTransparent ) - { - ImplDrawBitmap( mhPS, mnHeight, pPosAry, rTransparentBitmap, FALSE, ROP_SRCAND ); - ImplDrawBitmap( mhPS, mnHeight, pPosAry, rSalBitmap, FALSE, ROP_SRCPAINT ); - } - else - { - SalTwoRect aPosAry = *pPosAry; - int nDstX = (int) aPosAry.mnDestX; - int nDstY = (int) aPosAry.mnDestY; - int nDstWidth = (int) aPosAry.mnDestWidth; - int nDstHeight = (int) aPosAry.mnDestHeight; - HAB hAB = GetSalData()->mhAB; - HPS hPS = mhPS; - DEVOPENSTRUC aDevOpenStruc = { NULL, (PSZ)"DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - SIZEL aSizeL = { nDstWidth, nDstHeight }; - POINTL aPtL[ 3 ]; - - HDC hMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - HPS hMemPS = Ft2CreatePS( hAB, hMemDC, &aSizeL, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - HBITMAP hMemBitmap = ImplCreateVirDevBitmap( hMemDC, hMemPS, nDstWidth, nDstHeight, 0 ); - HBITMAP hMemOld = (HBITMAP) Ft2SetBitmap( hMemPS, hMemBitmap ); - HDC hMaskDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - HPS hMaskPS = Ft2CreatePS( hAB, hMaskDC, &aSizeL, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - HBITMAP hMaskBitmap = ImplCreateVirDevBitmap( hMaskDC, hMaskPS, nDstWidth, nDstHeight, 0 ); - HBITMAP hMaskOld = (HBITMAP) Ft2SetBitmap( hMaskPS, hMaskBitmap ); -/* - HPS hMemPS = ImplGetCachedPS( CACHED_HPS_1, 0 ); - HPS hMaskPS = ImplGetCachedPS( CACHED_HPS_2, 0 ); -*/ - aPosAry.mnDestX = aPosAry.mnDestY = 0L; - - aPtL[ 0 ].x = 0; - aPtL[ 0 ].y = 0; - aPtL[ 1 ].x = nDstWidth; - aPtL[ 1 ].y = nDstHeight; - aPtL[ 2 ].x = nDstX; - aPtL[ 2 ].y = TY( nDstY + nDstHeight - 1 ); - - GpiBitBlt( hMemPS, hPS, 3, aPtL, ROP_SRCCOPY, BBO_IGNORE ); - ImplDrawBitmap( hMaskPS, nDstHeight, &aPosAry, rTransparentBitmap, FALSE, ROP_SRCCOPY ); - - aPtL[ 2 ].x = 0; - aPtL[ 2 ].y = 0; - - GpiBitBlt( hMemPS, hMaskPS, 3, aPtL, ROP_SRCAND, BBO_IGNORE ); - ImplDrawBitmap( hMaskPS, nDstHeight, &aPosAry, rSalBitmap, FALSE, ROP_SRCERASE ); - GpiBitBlt( hMemPS, hMaskPS, 3, aPtL, ROP_SRCPAINT, BBO_IGNORE ); - - aPtL[ 0 ].x = nDstX; - aPtL[ 0 ].y = TY( nDstY + nDstHeight - 1 ); - aPtL[ 1 ].x = nDstX + nDstWidth; - aPtL[ 1 ].y = TY( nDstY - 1 ); - - GpiBitBlt( hPS, hMemPS, 3, aPtL, ROP_SRCCOPY, BBO_IGNORE ); - - Ft2SetBitmap( hMaskPS, hMaskOld ); - Ft2DestroyPS( hMaskPS ); - DevCloseDC( hMaskDC ); - GpiDeleteBitmap( hMaskBitmap ); - - Ft2SetBitmap( hMemPS, hMemOld ); - Ft2DestroyPS( hMemPS ); - DevCloseDC( hMemDC ); - GpiDeleteBitmap( hMemBitmap ); - -/* - ImplReleaseCachedPS( CACHED_HPS_1 ); - ImplReleaseCachedPS( CACHED_HPS_2 ); -*/ - } -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR, - const SalBitmap& rSrcBitmap, - const SalBitmap& rAlphaBmp ) -{ - // TODO(P3) implement alpha blending - return false; -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::drawAlphaRect( long nX, long nY, long nWidth, - long nHeight, sal_uInt8 nTransparency ) -{ - // TODO(P3) implement alpha blending - return false; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawMask( const SalTwoRect* pPosAry, - const SalBitmap& rSSalBitmap, - SalColor nMaskColor ) -{ - DBG_ASSERT( !mbPrinter, "No transparency print possible!" ); - - const Os2SalBitmap& rSalBitmap = static_cast<const Os2SalBitmap&>(rSSalBitmap); - - SalTwoRect aPosAry = *pPosAry; - HPS hPS = mhPS; - IMAGEBUNDLE aBundle, aOldBundle; - AREABUNDLE aAreaBundle, aOldAreaBundle; - const ULONG nColor = RGBCOLOR( SALCOLOR_RED( nMaskColor ), - SALCOLOR_GREEN( nMaskColor ), - SALCOLOR_BLUE( nMaskColor ) ); - - GpiQueryAttrs( hPS, PRIM_IMAGE, IBB_COLOR | IBB_BACK_COLOR, &aOldBundle ); - aBundle.lColor = RGBCOLOR( 0, 0, 0 ); - aBundle.lBackColor = RGBCOLOR( 0xFF, 0xFF, 0xFF ); - Ft2SetAttrs( hPS, PRIM_IMAGE, IBB_COLOR | IBB_BACK_COLOR, 0, &aBundle ); - - GpiQueryAttrs( hPS, PRIM_AREA, ABB_COLOR | ABB_BACK_COLOR | ABB_SYMBOL | - ABB_MIX_MODE | ABB_BACK_MIX_MODE, &aOldAreaBundle ); - aAreaBundle.lColor = nColor; - aAreaBundle.lBackColor = nColor; - aAreaBundle.usSymbol = PATSYM_SOLID; - aAreaBundle.usMixMode = FM_OVERPAINT; - aAreaBundle.usBackMixMode = BM_OVERPAINT; - Ft2SetAttrs( hPS, PRIM_AREA, ABB_COLOR | ABB_BACK_COLOR | ABB_SYMBOL | - ABB_MIX_MODE | ABB_BACK_MIX_MODE, 0, &aAreaBundle ); - - ImplDrawBitmap( hPS, mnHeight, &aPosAry, rSalBitmap, FALSE, 0x00B8L ); - - Ft2SetAttrs( hPS, PRIM_IMAGE, IBB_COLOR | IBB_BACK_COLOR, 0, &aOldBundle ); - Ft2SetAttrs( hPS, PRIM_AREA, ABB_COLOR | ABB_BACK_COLOR | ABB_SYMBOL | - ABB_MIX_MODE | ABB_BACK_MIX_MODE, 0, &aOldAreaBundle ); -} - -// ----------------------------------------------------------------------- - -SalBitmap* Os2SalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) -{ - HAB hAB = GetSalData()->mhAB; - SIZEL size = { nDX, nDY }; - Os2SalBitmap* pSalBitmap = NULL; - - // create device context (at this time allways display compatible) - DEVOPENSTRUC aDevOpenStruc = { NULL, (PSZ)"DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - HDC hMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - HPS hMemPS = Ft2CreatePS( hAB, hMemDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - HBITMAP hMemBmp = ImplCreateVirDevBitmap( hMemDC, hMemPS, nDX, nDY, 0 ); - HBITMAP hMemOld = Ft2SetBitmap( hMemPS, hMemBmp ); - - // creation successfull? - if( hMemDC && hMemPS && hMemBmp ) - { - POINTL thePoints[ 3 ]; - - // lower-left corner of target - thePoints[ 0 ].x = 0; - thePoints[ 0 ].y = 0; - - // upper-right corner of target - thePoints[ 1 ].x = nDX; - thePoints[ 1 ].y = nDY; - - // lower-left corner of source - thePoints[ 2 ].x = nX; - thePoints[ 2 ].y = TY( nY + nDY - 1 ); - - long lHits = GpiBitBlt( hMemPS, mhPS, 3, thePoints, - mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY, BBO_IGNORE ); - - if( hMemPS ) - { - Ft2SetBitmap( hMemPS, hMemOld ); - Ft2DestroyPS( hMemPS ); - } - - if( hMemDC ) - DevCloseDC( hMemDC ); - - if( lHits == GPI_OK ) - { - pSalBitmap = new Os2SalBitmap; - - if( !pSalBitmap->Create( hMemBmp, FALSE, FALSE ) ) - { - delete pSalBitmap; - pSalBitmap = NULL; - } - } - } - - if( !pSalBitmap ) - GpiDeleteBitmap( hMemBmp ); - - // return pointer to SAL-Bitmap - return pSalBitmap; -} - -// ----------------------------------------------------------------------- - -SalColor Os2SalGraphics::getPixel( long nX, long nY ) -{ - POINTL aPt = { nX, TY( nY ) }; - LONG nColor = Ft2QueryPel( mhPS, &aPt ); - - return MAKE_SALCOLOR( (BYTE) ( nColor >> 16 ), (BYTE) ( nColor >> 8 ), (BYTE) nColor ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ) -{ - if( nFlags & SAL_INVERT_TRACKFRAME ) - { - // save old vylues - LINEBUNDLE oldLb; - LINEBUNDLE lb; - GpiQueryAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, &oldLb ); - - // set linetype to short dash - lb.lColor = RGBCOLOR( 255, 255, 255 ); - lb.usMixMode = FM_XOR; - lb.usType = LINETYPE_ALTERNATE; - Ft2SetAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &lb ); - - // draw inverted box - POINTL aPt; - - aPt.x = nX; - aPt.y = TY( nY ); - - Ft2Move( mhPS, &aPt ); - - aPt.x = nX + nWidth - 1; - aPt.y = TY( nY + nHeight - 1 ); - - Ft2Box( mhPS, DRO_OUTLINE, &aPt, 0, 0 ); - - // restore old values - Ft2SetAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &oldLb ); - - } - else - { - // save old values - AREABUNDLE oldAb; - AREABUNDLE ab; - - GpiQueryAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, &oldAb ); - - // set fill color to black - ab.lColor = RGBCOLOR( 255, 255, 255 ); - ab.usMixMode = FM_XOR; - ab.usSymbol = (nFlags & SAL_INVERT_50) ? PATSYM_DENSE5 : PATSYM_SOLID; - Ft2SetAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &ab ); - - // draw inverted box - POINTL aPt; - - aPt.x = nX; - aPt.y = TY( nY ); - - Ft2Move( mhPS, &aPt ); - - aPt.x = nX + nWidth - 1; - aPt.y = TY( nY + nHeight - 1 ); - - Ft2Box( mhPS, DRO_FILL, &aPt, 0, 0 ); - - // restore old values - Ft2SetAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &oldAb ); - } -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ) -{ - if( nFlags & SAL_INVERT_TRACKFRAME ) - { - // save old vylues - LINEBUNDLE oldLb; - LINEBUNDLE lb; - GpiQueryAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, &oldLb ); - - // set linetype to short dash - lb.lColor = RGBCOLOR( 255, 255, 255 ); - lb.usMixMode = FM_XOR; - lb.usType = LINETYPE_ALTERNATE; - Ft2SetAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &lb ); - - // Draw Polyline - drawPolyLine( nPoints, pPtAry ); - - // restore old values - Ft2SetAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &oldLb ); - } - else - { - // save old values - AREABUNDLE oldAb; - AREABUNDLE ab; - - GpiQueryAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, &oldAb ); - - // set fill color to black - ab.lColor = RGBCOLOR( 255, 255, 255 ); - ab.usMixMode = FM_XOR; - ab.usSymbol = (nFlags & SAL_INVERT_50) ? PATSYM_DENSE5 : PATSYM_SOLID; - Ft2SetAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &ab ); - - // Draw Polyline - drawPolygon( nPoints, pPtAry ); - - // restore old values - Ft2SetAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &oldAb ); - } -} - diff --git a/vcl/os2/source/gdi/salgdi3.cxx b/vcl/os2/source/gdi/salgdi3.cxx deleted file mode 100644 index 0e4cb1d58b0f..000000000000 --- a/vcl/os2/source/gdi/salgdi3.cxx +++ /dev/null @@ -1,1769 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define INCL_GRE_STRINGS -#define INCL_GPI -#define INCL_DOS - -#include <string.h> -#include <stdlib.h> -#include <math.h> -#include <svpm.h> - -#define _SV_SALGDI3_CXX -#include <tools/svwin.h> -#include <rtl/tencinfo.h> -#ifndef _OSL_FILE_HXX -#include <osl/file.hxx> -#endif -#ifndef _OSL_THREAD_HXX -#include <osl/thread.hxx> -#endif -#ifndef _OSL_PROCESS_HXX -#include <osl/process.h> -#endif -#include <vcl/svapp.hxx> -#include <saldata.hxx> -#include <salgdi.h> -#include <vcl/font.hxx> -#include <vcl/sallayout.hxx> -#include <tools/poly.hxx> -#include <tools/debug.hxx> -#include <rtl/textcvt.h> -#include <tools/debug.hxx> -#include <saldata.hxx> -#include <salgdi.h> -#ifndef _SV_OUTFONT_HXX -#include <vcl/outfont.hxx> -#endif -#include <sallayout.h> -#include <tools/poly.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/polygon/b2dpolypolygon.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -#include "sft.hxx" - -#ifdef GCP_KERN_HACK -#include <algorithm> -#endif - -using namespace vcl; - -// ----------- -// - Inlines - -// ----------- - - -inline W32FIXED FixedFromDouble( double d ) -{ - const long l = (long) ( d * 65536. ); - return *(W32FIXED*) &l; -} - -// ----------------------------------------------------------------------- - -inline int IntTimes256FromFixed(W32FIXED f) -{ - int nFixedTimes256 = (f.value << 8) + ((f.fract+0x80) >> 8); - return nFixedTimes256; -} - -// ----------- -// - Defines - -// ----------- - -// this is a special codepage code, used to identify OS/2 symbol font. -#define SYMBOL_CHARSET 65400 - -// ======================================================================= - -UniString ImplSalGetUniString( const sal_Char* pStr, xub_StrLen nLen = STRING_LEN) -{ - return UniString( pStr, nLen, gsl_getSystemTextEncoding(), - RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT | - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT | - RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT ); -} - -// ======================================================================= - -static USHORT ImplSalToCharSet( CharSet eCharSet ) -{ - // !!! Fuer DBCS-Systeme muss dieser Code auskommentiert werden und 0 - // !!! zurueckgegeben werden, solange die DBCS-Charsets nicht - // !!! durchgereicht werden - - switch ( eCharSet ) - { - case RTL_TEXTENCODING_IBM_437: - return 437; - - case RTL_TEXTENCODING_IBM_850: - return 850; - - case RTL_TEXTENCODING_IBM_860: - return 860; - - case RTL_TEXTENCODING_IBM_861: - return 861; - - case RTL_TEXTENCODING_IBM_863: - return 863; - - case RTL_TEXTENCODING_IBM_865: - return 865; - case RTL_TEXTENCODING_MS_1252: - return 1004; - case RTL_TEXTENCODING_SYMBOL: - return 65400; - } - - return 0; -} - -// ----------------------------------------------------------------------- - -static CharSet ImplCharSetToSal( USHORT usCodePage ) -{ - switch ( usCodePage ) - { - case 437: - return RTL_TEXTENCODING_IBM_437; - - case 850: - return RTL_TEXTENCODING_IBM_850; - - case 860: - return RTL_TEXTENCODING_IBM_860; - - case 861: - return RTL_TEXTENCODING_IBM_861; - - case 863: - return RTL_TEXTENCODING_IBM_863; - - case 865: - return RTL_TEXTENCODING_IBM_865; - case 1004: - return RTL_TEXTENCODING_MS_1252; - case 65400: - return RTL_TEXTENCODING_SYMBOL; - } - - return RTL_TEXTENCODING_DONTKNOW; -} - -// ----------------------------------------------------------------------- - -static FontFamily ImplFamilyToSal( BYTE bFamilyType ) -{ - switch ( bFamilyType ) - { - case 4: - return FAMILY_DECORATIVE; - case 3: - return FAMILY_SCRIPT; - } - - return FAMILY_DONTKNOW; -} - -// ----------------------------------------------------------------------- - -static FontWeight ImplWeightToSal( USHORT nWeight ) -{ - // Falls sich jemand an die alte Doku gehalten hat - if ( nWeight > 999 ) - nWeight /= 1000; - - switch ( nWeight ) - { - case 1: - return WEIGHT_THIN; - - case 2: - return WEIGHT_ULTRALIGHT; - - case 3: - return WEIGHT_LIGHT; - - case 4: - return WEIGHT_SEMILIGHT; - - case 5: - return WEIGHT_NORMAL; - - case 6: - return WEIGHT_SEMIBOLD; - - case 7: - return WEIGHT_BOLD; - - case 8: - return WEIGHT_ULTRABOLD; - - case 9: - return WEIGHT_BLACK; - } - - return WEIGHT_DONTKNOW; -} - -// ----------------------------------------------------------------------- - -static UniString ImpStyleNameToSal( const char* pFamilyName, - const char* pFaceName, - USHORT nLen ) -{ - if ( !nLen ) - nLen = strlen(pFamilyName); - - // strip FamilyName from FaceName - if ( strncmp( pFamilyName, pFaceName, nLen ) == 0 ) - { - USHORT nFaceLen = (USHORT)strlen( pFaceName+nLen ); - // Ist Facename laenger, schneiden wir den FamilyName ab - if ( nFaceLen > 1 ) - return UniString( pFaceName+(nLen+1), gsl_getSystemTextEncoding()); - else - return UniString(); - } - else - return UniString( pFaceName, gsl_getSystemTextEncoding()); -} - -// ----------------------------------------------------------------------- - -inline FontPitch ImplLogPitchToSal( BYTE fsType ) -{ - if ( fsType & FM_TYPE_FIXED ) - return PITCH_FIXED; - else - return PITCH_VARIABLE; -} - -// ----------------------------------------------------------------------- - -inline BYTE ImplPitchToWin( FontPitch ePitch ) -{ - if ( ePitch == PITCH_FIXED ) - return FM_TYPE_FIXED; - //else if ( ePitch == PITCH_VARIABLE ) - - return 0; -} - -// ----------------------------------------------------------------------- - -static ImplDevFontAttributes Os2Font2DevFontAttributes( const PFONTMETRICS pFontMetric) -{ - ImplDevFontAttributes aDFA; - - // get font face attributes - aDFA.meFamily = ImplFamilyToSal( pFontMetric->panose.bFamilyType); - aDFA.meWidthType = WIDTH_DONTKNOW; - aDFA.meWeight = ImplWeightToSal( pFontMetric->usWeightClass); - aDFA.meItalic = (pFontMetric->fsSelection & FM_SEL_ITALIC) ? ITALIC_NORMAL : ITALIC_NONE; - aDFA.mePitch = ImplLogPitchToSal( pFontMetric->fsType ); - aDFA.mbSymbolFlag = (pFontMetric->usCodePage == SYMBOL_CHARSET); - - // get the font face name - // the maName field stores the font name without the style, so under OS/2 - // we must use the family name - aDFA.maName = UniString( pFontMetric->szFamilyname, gsl_getSystemTextEncoding()); - - aDFA.maStyleName = ImpStyleNameToSal( pFontMetric->szFamilyname, - pFontMetric->szFacename, - strlen( pFontMetric->szFamilyname) ); - - // get device specific font attributes - aDFA.mbOrientation = (pFontMetric->fsDefn & FM_DEFN_OUTLINE) != 0; - aDFA.mbDevice = (pFontMetric->fsDefn & FM_DEFN_GENERIC) ? FALSE : TRUE; - - aDFA.mbEmbeddable = false; - aDFA.mbSubsettable = false; - DWORD fontType = Ft2QueryFontType( 0, pFontMetric->szFamilyname); - if( fontType == FT2_FONTTYPE_TRUETYPE && !aDFA.mbDevice) - aDFA.mbSubsettable = true; - // for now we can only embed Type1 fonts - if( fontType == FT2_FONTTYPE_TYPE1 ) - aDFA.mbEmbeddable = true; - - // heuristics for font quality - // - standard-type1 > opentypeTT > truetype > non-standard-type1 > raster - // - subsetting > embedding > none - aDFA.mnQuality = 0; - if( fontType == FT2_FONTTYPE_TRUETYPE ) - aDFA.mnQuality += 50; - if( aDFA.mbSubsettable ) - aDFA.mnQuality += 200; - else if( aDFA.mbEmbeddable ) - aDFA.mnQuality += 100; - - // #i38665# prefer Type1 versions of the standard postscript fonts - if( aDFA.mbEmbeddable ) - { - if( aDFA.maName.EqualsAscii( "AvantGarde" ) - || aDFA.maName.EqualsAscii( "Bookman" ) - || aDFA.maName.EqualsAscii( "Courier" ) - || aDFA.maName.EqualsAscii( "Helvetica" ) - || aDFA.maName.EqualsAscii( "NewCenturySchlbk" ) - || aDFA.maName.EqualsAscii( "Palatino" ) - || aDFA.maName.EqualsAscii( "Symbol" ) - || aDFA.maName.EqualsAscii( "Times" ) - || aDFA.maName.EqualsAscii( "ZapfChancery" ) - || aDFA.maName.EqualsAscii( "ZapfDingbats" ) ) - aDFA.mnQuality += 500; - } - - aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW; - aDFA.meAntiAlias = ANTIALIAS_DONTKNOW; - - // TODO: add alias names - - return aDFA; -} - -// ======================================================================= - -// ----------------------------------------------------------------------- - -// ======================================================================= - -ImplOs2FontData::ImplOs2FontData( PFONTMETRICS _pFontMetric, - int nHeight, BYTE nPitchAndFamily ) -: ImplFontData( Os2Font2DevFontAttributes(_pFontMetric), 0 ), - pFontMetric( _pFontMetric ), - meOs2CharSet( _pFontMetric->usCodePage), - mnPitchAndFamily( nPitchAndFamily ), - mpFontCharSets( NULL ), - mpUnicodeMap( NULL ), - mbDisableGlyphApi( false ), - mbHasKoreanRange( false ), - mbHasCJKSupport( false ), - mbAliasSymbolsLow( false ), - mbAliasSymbolsHigh( false ), - mnId( 0 ) -{ - SetBitmapSize( 0, nHeight ); -} - -// ----------------------------------------------------------------------- - -ImplOs2FontData::~ImplOs2FontData() -{ - delete[] mpFontCharSets; - - if( mpUnicodeMap ) - mpUnicodeMap->DeReference(); -} - -// ----------------------------------------------------------------------- - -sal_IntPtr ImplOs2FontData::GetFontId() const -{ - return mnId; -} - -// ----------------------------------------------------------------------- - -void ImplOs2FontData::UpdateFromHPS( HPS hPS ) const -{ - // short circuit if already initialized - if( mpUnicodeMap != NULL ) - return; - - ReadCmapTable( hPS ); - ReadOs2Table( hPS ); - - // even if the font works some fonts have problems with the glyph API - // => the heuristic below tries to figure out which fonts have the problem - DWORD fontType = Ft2QueryFontType( 0, pFontMetric->szFacename); - if( fontType != FT2_FONTTYPE_TRUETYPE - && (pFontMetric->fsDefn & FM_DEFN_GENERIC) == 0) - mbDisableGlyphApi = true; -} - -// ----------------------------------------------------------------------- - -#ifdef GNG_VERT_HACK -bool ImplOs2FontData::HasGSUBstitutions( HPS hPS ) const -{ - if( !mbGsubRead ) - ReadGsubTable( hPS ); - return !maGsubTable.empty(); -} - -// ----------------------------------------------------------------------- - -bool ImplOs2FontData::IsGSUBstituted( sal_Ucs cChar ) const -{ - return( maGsubTable.find( cChar ) != maGsubTable.end() ); -} -#endif // GNG_VERT_HACK - -// ----------------------------------------------------------------------- - -const ImplFontCharMap* ImplOs2FontData::GetImplFontCharMap() const -{ - return mpUnicodeMap; -} - -// ----------------------------------------------------------------------- - -static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);} -static unsigned GetUShort( const unsigned char* p ){ return((p[0]<<8)+p[1]);} -static signed GetSShort( const unsigned char* p ){ return((short)((p[0]<<8)+p[1]));} -static inline DWORD CalcTag( const char p[4]) { return (p[0]+(p[1]<<8)+(p[2]<<16)+(p[3]<<24)); } - -void ImplOs2FontData::ReadOs2Table( HPS hPS ) const -{ - const DWORD Os2Tag = CalcTag( "OS/2" ); - DWORD nLength = Ft2GetFontData( hPS, Os2Tag, 0, NULL, 0 ); - if( (nLength == FT2_ERROR) || !nLength ) - return; - std::vector<unsigned char> aOS2map( nLength ); - unsigned char* pOS2map = &aOS2map[0]; - DWORD nRC = Ft2GetFontData( hPS, Os2Tag, 0, pOS2map, nLength ); - sal_uInt32 nVersion = GetUShort( pOS2map ); - if ( nVersion >= 0x0001 && nLength >= 58 ) - { - // We need at least version 0x0001 (TrueType rev 1.66) - // to have access to the needed struct members. - sal_uInt32 ulUnicodeRange1 = GetUInt( pOS2map + 42 ); - sal_uInt32 ulUnicodeRange2 = GetUInt( pOS2map + 46 ); - sal_uInt32 ulUnicodeRange3 = GetUInt( pOS2map + 50 ); - sal_uInt32 ulUnicodeRange4 = GetUInt( pOS2map + 54 ); - - // Check for CJK capabilities of the current font - mbHasCJKSupport = (ulUnicodeRange2 & 0x2fff0000) - | (ulUnicodeRange3 & 0x00000001); - mbHasKoreanRange= (ulUnicodeRange1 & 0x10000000) - | (ulUnicodeRange2 & 0x01100000); - } -} - - -// ----------------------------------------------------------------------- - -#ifdef GNG_VERT_HACK -void ImplOs2FontData::ReadGsubTable( HPS hPS ) const -{ - mbGsubRead = true; - - // check the existence of a GSUB table - const DWORD GsubTag = CalcTag( "GSUB" ); - DWORD nRC = Ft2GetFontData( hPS, GsubTag, 0, NULL, 0 ); - if( (nRC == FT2_ERROR) || !nRC ) - return; - - // TODO: directly read the GSUB table instead of going through sft - - // get raw font file data - DWORD nFontSize = Ft2GetFontData( hPS, 0, 0, NULL, 0 ); - if( nFontSize == FT2_ERROR ) - return; - std::vector<char> aRawFont( nFontSize+1 ); - aRawFont[ nFontSize ] = 0; - DWORD nFontSize2 = Ft2GetFontData( hPS, 0, 0, (void*)&aRawFont[0], nFontSize ); - if( nFontSize != nFontSize2 ) - return; - - // open font file - sal_uInt32 nFaceNum = 0; - if( !aRawFont[0] ) // TTC candidate - nFaceNum = ~0U; // indicate "TTC font extracts only" - - TrueTypeFont* pTTFont = NULL; - ::OpenTTFontBuffer( &aRawFont[0], nFontSize, nFaceNum, &pTTFont ); - if( !pTTFont ) - return; - - // add vertically substituted characters to list - static const sal_Unicode aGSUBCandidates[] = { - 0x0020, 0x0080, // ASCII - 0x2000, 0x2600, // misc - 0x3000, 0x3100, // CJK punctutation - 0x3300, 0x3400, // squared words - 0xFF00, 0xFFF0, // halfwidth|fullwidth forms - 0 }; - - for( const sal_Unicode* pPair = aGSUBCandidates; *pPair; pPair += 2 ) - for( sal_Unicode cChar = pPair[0]; cChar < pPair[1]; ++cChar ) - if( ::MapChar( pTTFont, cChar, 0 ) != ::MapChar( pTTFont, cChar, 1 ) ) - maGsubTable.insert( cChar ); // insert GSUBbed unicodes - - CloseTTFont( pTTFont ); - -#if 0 - TrueTypeFont* pTTFont = NULL; - ::OpenTTFont( &aRawFont[0], nFontSize, nFaceNum, &pTTFont ); - if( !pTTFont ) - return; - - // add vertically substituted characters to list - static const sal_Unicode aGSUBCandidates[] = { - 0x0020, 0x0080, // ASCII - 0x2000, 0x2600, // misc - 0x3000, 0x3100, // CJK punctutation - 0x3300, 0x3400, // squared words - 0xFF00, 0xFFF0, // halfwidth|fullwidth forms - 0 }; - - for( const sal_Unicode* pPair = aGSUBCandidates; *pPair; pPair += 2 ) - for( sal_Unicode cChar = pPair[0]; cChar < pPair[1]; ++cChar ) - if( ::MapChar( pTTFont, cChar, 0 ) != ::MapChar( pTTFont, cChar, 1 ) ) - maGsubTable.insert( cChar ); // insert GSUBbed unicodes - - CloseTTFont( pTTFont ); -#endif -} -#endif // GNG_VERT_HACK - -// ----------------------------------------------------------------------- - -void ImplOs2FontData::ReadCmapTable( HPS hPS ) const -{ - CmapResult aResult; - aResult.mnPairCount = 0; - aResult.mbSymbolic = (meOs2CharSet == SYMBOL_CHARSET); - aResult.mbRecoded = true; - - // get the CMAP table from the font which is selected into the DC - const DWORD CmapTag = CalcTag( "cmap" ); - DWORD nRC = Ft2GetFontData( hPS, CmapTag, 0, NULL, 0 ); - // read the CMAP table if available - if( nRC != FT2_ERROR ) - { - const int nLength = nRC; - std::vector<unsigned char> aCmap( nLength ); - unsigned char* pCmap = &aCmap[0]; - nRC = Ft2GetFontData( hPS, CmapTag, 0, pCmap, nLength ); - // parse the CMAP table - if( nRC == nLength ) - ParseCMAP( pCmap, nLength, aResult ); - } else { - // we need to define at least a simple charmap, otherwise this font - // will be mapped to default charmap, and OOo doesn't accept the - // system font to match the default charmap - aResult.mnPairCount = 1; - // ImplFontCharMap destructor will free this memory - aResult.mpPairCodes = new sal_uInt32[ 2 * aResult.mnPairCount ]; - aResult.mpPairCodes[0] = 0x0020; - aResult.mpPairCodes[1] = 0x00FF; - aResult.mpStartGlyphs = NULL; - } - - mbDisableGlyphApi |= aResult.mbRecoded; - - if( aResult.mnPairCount > 0 ) - mpUnicodeMap = new ImplFontCharMap( aResult.mnPairCount, - aResult.mpPairCodes, aResult.mpStartGlyphs ); - else - mpUnicodeMap = ImplFontCharMap::GetDefaultMap(); - mpUnicodeMap->AddReference(); -} - -// ======================================================================= - -void Os2SalGraphics::SetTextColor( SalColor nSalColor ) -{ - CHARBUNDLE cb; - - cb.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); - - // set default color attributes - Ft2SetAttrs( mhPS, - PRIM_CHAR, - CBB_COLOR, - 0, - &cb ); -} - -// ----------------------------------------------------------------------- - -USHORT Os2SalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, int nFallbackLevel) -{ - -#if OSL_DEBUG_LEVEL>10 - debug_printf( "Os2SalGraphics::ImplDoSetFont\n"); -#endif - - ImplOs2FontData* pFontData = (ImplOs2FontData*)i_pFont->mpFontData; - PFONTMETRICS pFontMetric = NULL; - FATTRS aFAttrs; - BOOL bOutline = FALSE; - APIRET rc; - - memset( &aFAttrs, 0, sizeof( FATTRS ) ); - aFAttrs.usRecordLength = sizeof( FATTRS ); - - aFAttrs.lMaxBaselineExt = i_pFont->mnHeight; - aFAttrs.lAveCharWidth = i_pFont->mnWidth; - - // do we have a pointer to the FONTMETRICS of the selected font? -> use it! - if ( pFontData ) - { - pFontMetric = pFontData->GetFontMetrics(); - - bOutline = (pFontMetric->fsDefn & FM_DEFN_OUTLINE) != 0; - - // use match®istry fields to get correct match - aFAttrs.lMatch = pFontMetric->lMatch; - aFAttrs.idRegistry = pFontMetric->idRegistry; - aFAttrs.usCodePage = pFontMetric->usCodePage; - - if ( bOutline ) - { - aFAttrs.fsFontUse |= FATTR_FONTUSE_OUTLINE; - if ( i_pFont->mnOrientation ) - aFAttrs.fsFontUse |= FATTR_FONTUSE_TRANSFORMABLE; - } - else - { - aFAttrs.lMaxBaselineExt = pFontMetric->lMaxBaselineExt; - aFAttrs.lAveCharWidth = pFontMetric->lAveCharWidth; - } - - } - - // use family name for outline fonts - if ( mbPrinter ) { - // use font face name for printers because otherwise ft2lib will fail - // to select the correct font for GPI (ticket#117) - strncpy( (char*)(aFAttrs.szFacename), pFontMetric->szFacename, sizeof( aFAttrs.szFacename ) ); - } else if ( !pFontMetric) { - // use OOo name if fontmetrics not available! - ByteString aName( i_pFont->maName.GetToken( 0 ), gsl_getSystemTextEncoding()); - strncpy( (char*)(aFAttrs.szFacename), aName.GetBuffer(), sizeof( aFAttrs.szFacename ) ); - } else if ( bOutline) { - // use fontmetric family name for outline fonts - strncpy( (char*)(aFAttrs.szFacename), pFontMetric->szFamilyname, sizeof( aFAttrs.szFacename ) ); - } else { - // use real font face name for bitmaps (WarpSans only) - strncpy( (char*)(aFAttrs.szFacename), pFontMetric->szFacename, sizeof( aFAttrs.szFacename ) ); - } - - if ( i_pFont->meItalic != ITALIC_NONE ) - aFAttrs.fsSelection |= FATTR_SEL_ITALIC; - if ( i_pFont->meWeight > WEIGHT_MEDIUM ) - aFAttrs.fsSelection |= FATTR_SEL_BOLD; - -#if OSL_DEBUG_LEVEL>1 - if (pFontMetric->szFacename[0] == 'A') { - debug_printf( "Os2SalGraphics::SetFont hps %x lMatch '%d'\n", mhPS, pFontMetric->lMatch); - debug_printf( "Os2SalGraphics::SetFont hps %x fontmetrics facename '%s'\n", mhPS, pFontMetric->szFacename); - debug_printf( "Os2SalGraphics::SetFont hps %x fattrs facename '%s'\n", mhPS, aFAttrs.szFacename); - } -#endif - - Ft2DeleteSetId( mhPS, nFallbackLevel + LCID_BASE); - if ( (rc=Ft2CreateLogFont( mhPS, NULL, nFallbackLevel + LCID_BASE, &aFAttrs)) == GPI_ERROR ) { -#if OSL_DEBUG_LEVEL>1 - ERRORID nLastError = WinGetLastError( GetSalData()->mhAB ); - debug_printf( "Os2SalGraphics::SetFont hps %x Ft2CreateLogFont failed err %x\n", mhPS, nLastError ); -#endif - return SAL_SETFONT_REMOVEANDMATCHNEW; - } - - CHARBUNDLE aBundle; - - ULONG nAttrsDefault = 0; - ULONG nAttrs = CBB_SET; - aBundle.usSet = nFallbackLevel + LCID_BASE; - - if ( bOutline ) - { - nAttrs |= CBB_BOX; - aBundle.sizfxCell.cy = MAKEFIXED( i_pFont->mnHeight, 0 ); - - if ( !i_pFont->mnWidth ) - { - LONG nXFontRes; - LONG nYFontRes; - LONG nHeight; - - // Auf die Aufloesung achten, damit das Ergebnis auch auf - // Drucken mit 180*360 DPI stimmt. Ausserdem muss gerundet - // werden, da auf meinem OS2 beispielsweise als - // Bildschirmaufloesung 3618*3622 PixelPerMeter zurueck- - // gegeben wird - GetResolution( nXFontRes, nYFontRes ); - nHeight = i_pFont->mnHeight; - nHeight *= nXFontRes; - nHeight += nYFontRes/2; - nHeight /= nYFontRes; - aBundle.sizfxCell.cx = MAKEFIXED( nHeight, 0 ); - } - else - aBundle.sizfxCell.cx = MAKEFIXED( i_pFont->mnWidth, 0 ); - } - - // set orientation for outlinefonts - if ( i_pFont->mnOrientation ) - { - if ( bOutline ) - { - nAttrs |= CBB_ANGLE; - double alpha = (double)(i_pFont->mnOrientation); - alpha *= 0.0017453292; // *PI / 1800 - mnOrientationY = (long) (1000.0 * sin( alpha )); - mnOrientationX = (long) (1000.0 * cos( alpha )); - aBundle.ptlAngle.x = mnOrientationX; - aBundle.ptlAngle.y = mnOrientationY; - } - else - { - mnOrientationX = 1; - mnOrientationY = 0; - nAttrs |= CBB_ANGLE; - aBundle.ptlAngle.x = 1; - aBundle.ptlAngle.y = 0; - } - } - else - { - mnOrientationX = 1; - mnOrientationY = 0; - nAttrs |= CBB_ANGLE; - aBundle.ptlAngle.x = 1; - aBundle.ptlAngle.y = 0; - } - - rc = Ft2SetAttrs( mhPS, PRIM_CHAR, nAttrs, nAttrsDefault, &aBundle ); - -#if OSL_DEBUG_LEVEL>1 - FONTMETRICS aOS2Metric = {0}; - Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric ); -#endif - - return 0; -} - - -USHORT Os2SalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLevel ) -{ - - // return early if there is no new font - if( !pFont ) - { -#if 0 - // deselect still active font - if( mhDefFont ) - Ft2SetCharSet( mhPS, mhDefFont ); - // release no longer referenced font handles - for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) - { - if( mhFonts[i] ) - Ft2DeleteSetId( mhPS, mhFonts[i] ); - mhFonts[ i ] = 0; - } -#endif - mhDefFont = 0; - return 0; - } - -#if OSL_DEBUG_LEVEL>10 - debug_printf( "Os2SalGraphics::SetFont\n"); -#endif - - DBG_ASSERT( pFont->mpFontData, "WinSalGraphics mpFontData==NULL"); - mpOs2FontEntry[ nFallbackLevel ] = reinterpret_cast<ImplOs2FontEntry*>( pFont->mpFontEntry ); - mpOs2FontData[ nFallbackLevel ] = static_cast<const ImplOs2FontData*>( pFont->mpFontData ); - - ImplDoSetFont( pFont, mfFontScale, nFallbackLevel); - - if( !mhDefFont ) - { - // keep default font - mhDefFont = nFallbackLevel + LCID_BASE; - } - else - { - // release no longer referenced font handles - for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) - { - if( mhFonts[i] ) - { -#if 0 - Ft2DeleteSetId( mhPS, mhFonts[i] ); -#endif - mhFonts[i] = 0; - } - } - } - - // store new font in correct layer - mhFonts[ nFallbackLevel ] = nFallbackLevel + LCID_BASE; - - // now the font is live => update font face - if( mpOs2FontData[ nFallbackLevel ] ) - mpOs2FontData[ nFallbackLevel ]->UpdateFromHPS( mhPS ); - - if( !nFallbackLevel ) - { - mbFontKernInit = TRUE; - if ( mpFontKernPairs ) - { - delete[] mpFontKernPairs; - mpFontKernPairs = NULL; - } - mnFontKernPairCount = 0; - } - - // some printers have higher internal resolution, so their - // text output would be different from what we calculated - // => suggest DrawTextArray to workaround this problem - if ( mbPrinter ) - return SAL_SETFONT_USEDRAWTEXTARRAY; - else - return 0; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) -{ - FONTMETRICS aOS2Metric; - Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric ); - -#if OSL_DEBUG_LEVEL>1 - debug_printf( "Os2SalGraphics::GetFontMetric hps %x\n", mhPS); - if (aOS2Metric.szFacename[0] == 'A') { - debug_printf( "Os2SalGraphics::GetFontMetric hps %x fontmetrics facename '%s'\n", mhPS, aOS2Metric.szFacename); - debug_printf( "Os2SalGraphics::GetFontMetric hps %x fontmetrics lMatch '%d'\n", mhPS, aOS2Metric.lMatch); - } -#endif - - pMetric->maName = UniString( aOS2Metric.szFamilyname, gsl_getSystemTextEncoding()); - pMetric->maStyleName = ImpStyleNameToSal( aOS2Metric.szFamilyname, - aOS2Metric.szFacename, - strlen( aOS2Metric.szFamilyname ) ); - - // device independent font attributes - pMetric->meFamily = ImplFamilyToSal( aOS2Metric.panose.bFamilyType); - pMetric->mbSymbolFlag = (aOS2Metric.usCodePage == SYMBOL_CHARSET); - pMetric->meWeight = ImplWeightToSal( aOS2Metric.usWeightClass ); - pMetric->mePitch = ImplLogPitchToSal( aOS2Metric.fsType ); - pMetric->meItalic = (aOS2Metric.fsSelection & FM_SEL_ITALIC) ? ITALIC_NORMAL : ITALIC_NONE; - pMetric->mnSlant = 0; - - // device dependend font attributes - pMetric->mbDevice = (aOS2Metric.fsDefn & FM_DEFN_GENERIC) ? FALSE : TRUE; - pMetric->mbScalableFont = (aOS2Metric.fsDefn & FM_DEFN_OUTLINE) ? true : false; - if( pMetric->mbScalableFont ) - { - // check if there are kern pairs - // TODO: does this work with GPOS kerning? - pMetric->mbKernableFont = (aOS2Metric.sKerningPairs > 0); - } - else - { - // bitmap fonts cannot be rotated directly - pMetric->mnOrientation = 0; - // bitmap fonts have no kerning - pMetric->mbKernableFont = false; - } - - // transformation dependend font metrics - if ( aOS2Metric.fsDefn & FM_DEFN_OUTLINE ) - { - pMetric->mnWidth = aOS2Metric.lEmInc; - } - else - { - pMetric->mnWidth = aOS2Metric.lAveCharWidth; - pMetric->mnOrientation = 0; - } - pMetric->mnIntLeading = aOS2Metric.lInternalLeading; - pMetric->mnExtLeading = aOS2Metric.lExternalLeading; - pMetric->mnAscent = aOS2Metric.lMaxAscender; - pMetric->mnDescent = aOS2Metric.lMaxDescender; - - // #107888# improved metric compatibility for Asian fonts... - // TODO: assess workaround below for CWS >= extleading - // TODO: evaluate use of aWinMetric.sTypo* members for CJK - if( mpOs2FontData[0] && mpOs2FontData[0]->SupportsCJK() ) - { - pMetric->mnIntLeading += pMetric->mnExtLeading; - - // #109280# The line height for Asian fonts is too small. - // Therefore we add half of the external leading to the - // ascent, the other half is added to the descent. - const long nHalfTmpExtLeading = pMetric->mnExtLeading / 2; - const long nOtherHalfTmpExtLeading = pMetric->mnExtLeading - nHalfTmpExtLeading; - - // #110641# external leading for Asian fonts. - // The factor 0.3 has been confirmed with experiments. - long nCJKExtLeading = static_cast<long>(0.30 * (pMetric->mnAscent + pMetric->mnDescent)); - nCJKExtLeading -= pMetric->mnExtLeading; - pMetric->mnExtLeading = (nCJKExtLeading > 0) ? nCJKExtLeading : 0; - - pMetric->mnAscent += nHalfTmpExtLeading; - pMetric->mnDescent += nOtherHalfTmpExtLeading; - - // #109280# HACK korean only: increase descent for wavelines and impr - // YD win9x only - } - -} - -// ----------------------------------------------------------------------- - -ULONG Os2SalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) -{ - DBG_ASSERT( sizeof( KERNINGPAIRS ) == sizeof( ImplKernPairData ), - "Os2SalGraphics::GetKernPairs(): KERNINGPAIRS != ImplKernPairData" ); - - if ( mbFontKernInit ) - { - if( mpFontKernPairs ) - { - delete[] mpFontKernPairs; - mpFontKernPairs = NULL; - } - mnFontKernPairCount = 0; - - { - KERNINGPAIRS* pPairs = NULL; - FONTMETRICS aOS2Metric; - Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric ); - int nCount = aOS2Metric.sKerningPairs; - if( nCount ) - { -#ifdef GCP_KERN_HACK - pPairs = new KERNINGPAIRS[ nCount+1 ]; - mpFontKernPairs = pPairs; - mnFontKernPairCount = nCount; - Ft2QueryKerningPairs( mhPS, nCount, (KERNINGPAIRS*)pPairs ); -#else // GCP_KERN_HACK - pPairs = (KERNINGPAIRS*)pKernPairs; - nCount = (nCount < nPairs) ? nCount : nPairs; - Ft2QueryKerningPairs( mhPS, nCount, (KERNINGPAIRS*)pPairs ); - return nCount; -#endif // GCP_KERN_HACK - } - } - - mbFontKernInit = FALSE; - - std::sort( mpFontKernPairs, mpFontKernPairs + mnFontKernPairCount, ImplCmpKernData ); - } - - if( !pKernPairs ) - return mnFontKernPairCount; - else if( mpFontKernPairs ) - { - if ( nPairs < mnFontKernPairCount ) - nPairs = mnFontKernPairCount; - memcpy( pKernPairs, mpFontKernPairs, - nPairs*sizeof( ImplKernPairData ) ); - return nPairs; - } - - return 0; -} - - -// ----------------------------------------------------------------------- - -static const ImplFontCharMap* pOs2DefaultImplFontCharMap = NULL; -static const sal_uInt32 pOs2DefaultRangeCodes[] = {0x0020,0x00FF}; - -const ImplFontCharMap* Os2SalGraphics::GetImplFontCharMap() const -{ - if( !mpOs2FontData[0] ) - return ImplFontCharMap::GetDefaultMap(); - return mpOs2FontData[0]->GetImplFontCharMap(); -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::AddTempDevFont( ImplDevFontList* pFontList, - const String& rFontFileURL, const String& rFontName ) -{ -#if OSL_DEBUG_LEVEL>0 - debug_printf("Os2SalGraphics::AddTempDevFont\n"); -#endif - return false; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::GetDevFontList( ImplDevFontList* pList ) -{ - PFONTMETRICS pFontMetrics; - ULONG nFontMetricCount; - SalData* pSalData; - -#if OSL_DEBUG_LEVEL>0 - debug_printf("Os2SalGraphics::GetDevFontList\n"); -#endif - - // install OpenSymbol - HMODULE hMod; - ULONG ObjNum, Offset, rc; - CHAR Buff[2*_MAX_PATH]; - char drive[_MAX_DRIVE], dir[_MAX_DIR]; - char fname[_MAX_FNAME], ext[_MAX_EXT]; - // get module handle (and name) - rc = DosQueryModFromEIP( &hMod, &ObjNum, sizeof( Buff), Buff, - &Offset, (ULONG)ImplSalGetUniString); - DosQueryModuleName(hMod, sizeof(Buff), Buff); - // replace module path with font path - char* slash = strrchr( Buff, '\\'); - *slash = '\0'; - slash = strrchr( Buff, '\\'); - *slash = '\0'; - strcat( Buff, "\\SHARE\\FONTS\\TRUETYPE\\OPENS___.TTF"); - rc = GpiLoadPublicFonts( GetSalData()->mhAB, Buff); - - if ( !mbPrinter ) - { - // Bei Bildschirm-Devices cachen wir die Liste global, da - // dies im unabhaengigen Teil auch so gemacht wird und wir - // ansonsten auf geloeschten Systemdaten arbeiten koennten - pSalData = GetSalData(); - nFontMetricCount = pSalData->mnFontMetricCount; - pFontMetrics = pSalData->mpFontMetrics; - // Bei Bildschirm-Devices holen wir uns die Fontliste jedesmal neu - if ( pFontMetrics ) - { - delete pFontMetrics; - pFontMetrics = NULL; - nFontMetricCount = 0; - } - } - else - { - nFontMetricCount = mnFontMetricCount; - pFontMetrics = mpFontMetrics; - } - - // do we have to create the cached font list first? - if ( !pFontMetrics ) - { - // query the number of fonts available - LONG nTemp = 0; - nFontMetricCount = Ft2QueryFonts( mhPS, - QF_PUBLIC | QF_PRIVATE, - NULL, &nTemp, - sizeof( FONTMETRICS ), NULL ); - - // procede only if at least one is available! - if ( nFontMetricCount ) - { - // allocate memory for font list - pFontMetrics = new FONTMETRICS[nFontMetricCount]; - - // query font list - Ft2QueryFonts( mhPS, - QF_PUBLIC | QF_PRIVATE, - NULL, - (PLONG)&nFontMetricCount, - (LONG) sizeof( FONTMETRICS ), - pFontMetrics ); - } - - if ( !mbPrinter ) - { - pSalData->mnFontMetricCount = nFontMetricCount; - pSalData->mpFontMetrics = pFontMetrics; - } - else - { - mnFontMetricCount = nFontMetricCount; - mpFontMetrics = pFontMetrics; - } - } - - // copy data from the font list - for( ULONG i = 0; i < nFontMetricCount; i++ ) - { - PFONTMETRICS pFontMetric = &pFontMetrics[i]; - - // skip font starting with '@', this is an alias internally - // used by truetype engine. - if (pFontMetric->szFacename[0] == '@') - continue; - - // skip bitmap fonts (but keep WarpSans) - if ( (pFontMetric->fsDefn & FM_DEFN_OUTLINE) == 0 - && strncmp( pFontMetric->szFacename, "WarpSans", 8) ) - // Font nicht aufnehmen - continue; - - // replace '-' in facename with ' ' (for ft2lib) - char* dash = pFontMetric->szFacename; - while( (dash=strchr( dash, '-'))) - *dash++ = ' '; - - // create new font list element - ImplOs2FontData* pData = new ImplOs2FontData( pFontMetric, 0, 0 ); - - // add font list element to font list - pList->Add( pData ); - - } -} - -// ---------------------------------------------------------------------------- - -void Os2SalGraphics::GetDevFontSubstList( OutputDevice* pOutDev ) -{ -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect ) -{ - // use unity matrix - MAT2 aMat; - aMat.eM11 = aMat.eM22 = FixedFromDouble( 1.0 ); - aMat.eM12 = aMat.eM21 = FixedFromDouble( 0.0 ); - - UINT nGGOFlags = GGO_METRICS; - if( !(nIndex & GF_ISCHAR) ) - nGGOFlags |= GGO_GLYPH_INDEX; - nIndex &= GF_IDXMASK; - - GLYPHMETRICS aGM; - DWORD nSize = FT2_ERROR; - nSize = Ft2GetGlyphOutline( mhPS, nIndex, nGGOFlags, &aGM, 0, NULL, &aMat ); - if( nSize == FT2_ERROR ) - return false; - - rRect = Rectangle( Point( +aGM.gmptGlyphOrigin.x, -aGM.gmptGlyphOrigin.y ), - Size( aGM.gmBlackBoxX, aGM.gmBlackBoxY ) ); - rRect.Left() = static_cast<int>( mfFontScale * rRect.Left() ); - rRect.Right() = static_cast<int>( mfFontScale * rRect.Right() ); - rRect.Top() = static_cast<int>( mfFontScale * rRect.Top() ); - rRect.Bottom() = static_cast<int>( mfFontScale * rRect.Bottom() ); - return true; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalGraphics::GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& rB2DPolyPoly ) -{ -#if OSL_DEBUG_LEVEL>0 - debug_printf("Os2SalGraphics::GetGlyphOutline\n"); -#endif - rB2DPolyPoly.clear(); - - BOOL bRet = FALSE; - - // use unity matrix - MAT2 aMat; - aMat.eM11 = aMat.eM22 = FixedFromDouble( 1.0 ); - aMat.eM12 = aMat.eM21 = FixedFromDouble( 0.0 ); - - UINT nGGOFlags = GGO_NATIVE; - if( !(nIndex & GF_ISCHAR) ) - nGGOFlags |= GGO_GLYPH_INDEX; - nIndex &= GF_IDXMASK; - - GLYPHMETRICS aGlyphMetrics; - DWORD nSize1 = FT2_ERROR; - nSize1 = Ft2GetGlyphOutline( mhPS, nIndex, nGGOFlags, &aGlyphMetrics, 0, NULL, &aMat ); - - if( !nSize1 ) // blank glyphs are ok - bRet = TRUE; - else if( nSize1 != FT2_ERROR ) - { - BYTE* pData = new BYTE[ nSize1 ]; - ULONG nTotalCount = 0; - DWORD nSize2; - nSize2 = Ft2GetGlyphOutline( mhPS, nIndex, nGGOFlags, - &aGlyphMetrics, nSize1, pData, &aMat ); - - if( nSize1 == nSize2 ) - { - bRet = TRUE; - - int nPtSize = 512; - Point* pPoints = new Point[ nPtSize ]; - BYTE* pFlags = new BYTE[ nPtSize ]; - - TTPOLYGONHEADER* pHeader = (TTPOLYGONHEADER*)pData; - while( (BYTE*)pHeader < pData+nSize2 ) - { - // only outline data is interesting - if( pHeader->dwType != TT_POLYGON_TYPE ) - break; - - // get start point; next start points are end points - // of previous segment - int nPnt = 0; - - long nX = IntTimes256FromFixed( pHeader->pfxStart.x ); - long nY = IntTimes256FromFixed( pHeader->pfxStart.y ); - pPoints[ nPnt ] = Point( nX, nY ); - pFlags[ nPnt++ ] = POLY_NORMAL; - - bool bHasOfflinePoints = false; - TTPOLYCURVE* pCurve = (TTPOLYCURVE*)( pHeader + 1 ); - pHeader = (TTPOLYGONHEADER*)( (BYTE*)pHeader + pHeader->cb ); - while( (BYTE*)pCurve < (BYTE*)pHeader ) - { - int nNeededSize = nPnt + 16 + 3 * pCurve->cpfx; - if( nPtSize < nNeededSize ) - { - Point* pOldPoints = pPoints; - BYTE* pOldFlags = pFlags; - nPtSize = 2 * nNeededSize; - pPoints = new Point[ nPtSize ]; - pFlags = new BYTE[ nPtSize ]; - for( int i = 0; i < nPnt; ++i ) - { - pPoints[ i ] = pOldPoints[ i ]; - pFlags[ i ] = pOldFlags[ i ]; - } - delete[] pOldPoints; - delete[] pOldFlags; - } - - int i = 0; - if( TT_PRIM_LINE == pCurve->wType ) - { - while( i < pCurve->cpfx ) - { - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - ++i; - pPoints[ nPnt ] = Point( nX, nY ); - pFlags[ nPnt ] = POLY_NORMAL; - ++nPnt; - } - } - else if( TT_PRIM_QSPLINE == pCurve->wType ) - { - bHasOfflinePoints = true; - while( i < pCurve->cpfx ) - { - // get control point of quadratic bezier spline - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - ++i; - Point aControlP( nX, nY ); - - // calculate first cubic control point - // P0 = 1/3 * (PBeg + 2 * PQControl) - nX = pPoints[ nPnt-1 ].X() + 2 * aControlP.X(); - nY = pPoints[ nPnt-1 ].Y() + 2 * aControlP.Y(); - pPoints[ nPnt+0 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); - pFlags[ nPnt+0 ] = POLY_CONTROL; - - // calculate endpoint of segment - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - - if ( i+1 >= pCurve->cpfx ) - { - // endpoint is either last point in segment => advance - ++i; - } - else - { - // or endpoint is the middle of two control points - nX += IntTimes256FromFixed( pCurve->apfx[ i-1 ].x ); - nY += IntTimes256FromFixed( pCurve->apfx[ i-1 ].y ); - nX = (nX + 1) / 2; - nY = (nY + 1) / 2; - // no need to advance, because the current point - // is the control point in next bezier spline - } - - pPoints[ nPnt+2 ] = Point( nX, nY ); - pFlags[ nPnt+2 ] = POLY_NORMAL; - - // calculate second cubic control point - // P1 = 1/3 * (PEnd + 2 * PQControl) - nX = pPoints[ nPnt+2 ].X() + 2 * aControlP.X(); - nY = pPoints[ nPnt+2 ].Y() + 2 * aControlP.Y(); - pPoints[ nPnt+1 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); - pFlags[ nPnt+1 ] = POLY_CONTROL; - - nPnt += 3; - } - } - - // next curve segment - pCurve = (TTPOLYCURVE*)&pCurve->apfx[ i ]; - } - - // end point is start point for closed contour - // disabled, because Polygon class closes the contour itself - // pPoints[nPnt++] = pPoints[0]; - // #i35928# - // Added again, but add only when not yet closed - if(pPoints[nPnt - 1] != pPoints[0]) - { - if( bHasOfflinePoints ) - pFlags[nPnt] = pFlags[0]; - - pPoints[nPnt++] = pPoints[0]; - } - - // convert y-coordinates W32 -> VCL - for( int i = 0; i < nPnt; ++i ) - pPoints[i].Y() = -pPoints[i].Y(); - - // insert into polypolygon - Polygon aPoly( nPnt, pPoints, (bHasOfflinePoints ? pFlags : NULL) ); - // convert to B2DPolyPolygon - // TODO: get rid of the intermediate PolyPolygon - rB2DPolyPoly.append( aPoly.getB2DPolygon() ); - } - - delete[] pPoints; - delete[] pFlags; - } - - delete[] pData; - } - - // rescaling needed for the PolyPolygon conversion - if( rB2DPolyPoly.count() ) - { - const double fFactor((1.0/256) * mfFontScale); - rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor)); - } - - return bRet; -} - -// ----------------------------------------------------------------------- - -// TODO: Replace this class with boost::scoped_array -class ScopedCharArray -{ -public: - inline explicit ScopedCharArray(char * pArray): m_pArray(pArray) {} - - inline ~ScopedCharArray() { delete[] m_pArray; } - - inline char * get() const { return m_pArray; } - -private: - char * m_pArray; -}; - -class ScopedFont -{ -public: - explicit ScopedFont(Os2SalGraphics & rData); - - ~ScopedFont(); - -private: - Os2SalGraphics & m_rData; - ULONG m_hOrigFont; -}; - -ScopedFont::ScopedFont(Os2SalGraphics & rData): m_rData(rData) -{ -#if 0 - m_hOrigFont = m_rData.mhFonts[0]; - m_rData.mhFonts[0] = 0; // avoid deletion of current font -#endif -} - -ScopedFont::~ScopedFont() -{ -#if 0 - if( m_hOrigFont ) - { - // restore original font, destroy temporary font - HFONT hTempFont = m_rData.mhFonts[0]; - m_rData.mhFonts[0] = m_hOrigFont; - SelectObject( m_rData.mhDC, m_hOrigFont ); - DeleteObject( hTempFont ); - } -#endif -} - -class ScopedTrueTypeFont -{ -public: - inline ScopedTrueTypeFont(): m_pFont(0) {} - - ~ScopedTrueTypeFont(); - - int open(void * pBuffer, sal_uInt32 nLen, sal_uInt32 nFaceNum); - - inline TrueTypeFont * get() const { return m_pFont; } - -private: - TrueTypeFont * m_pFont; -}; - -ScopedTrueTypeFont::~ScopedTrueTypeFont() -{ - if (m_pFont != 0) - CloseTTFont(m_pFont); -} - -int ScopedTrueTypeFont::open(void * pBuffer, sal_uInt32 nLen, - sal_uInt32 nFaceNum) -{ - OSL_ENSURE(m_pFont == 0, "already open"); - return OpenTTFontBuffer(pBuffer, nLen, nFaceNum, &m_pFont); -} - -BOOL Os2SalGraphics::CreateFontSubset( const rtl::OUString& rToFile, - const ImplFontData* pFont, long* pGlyphIDs, sal_uInt8* pEncoding, - sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& rInfo ) -{ - // create matching ImplFontSelectData - // we need just enough to get to the font file data - // use height=1000 for easier debugging (to match psprint's font units) - ImplFontSelectData aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); - - // TODO: much better solution: move SetFont and restoration of old font to caller - ScopedFont aOldFont(*this); - SetFont( &aIFSD, 0 ); - -#if OSL_DEBUG_LEVEL > 100 - // get font metrics - TEXTMETRICA aWinMetric; - if( !::GetTextMetricsA( mhDC, &aWinMetric ) ) - return FALSE; - - DBG_ASSERT( !(aWinMetric.tmPitchAndFamily & TMPF_DEVICE), "cannot subset device font" ); - DBG_ASSERT( aWinMetric.tmPitchAndFamily & TMPF_TRUETYPE, "can only subset TT font" ); -#endif - - // get raw font file data - DWORD nFontSize1 = Ft2GetFontData( mhPS, 0, 0, NULL, 0 ); - if( nFontSize1 == FT2_ERROR ) - return FALSE; - ScopedCharArray xRawFontData(new char[ nFontSize1 ]); - DWORD nFontSize2 = Ft2GetFontData( mhPS, 0, 0, (void*)xRawFontData.get(), nFontSize1 ); - if( nFontSize1 != nFontSize2 ) - return FALSE; - - // open font file - sal_uInt32 nFaceNum = 0; - if( !*xRawFontData.get() ) // TTC candidate - nFaceNum = ~0U; // indicate "TTC font extracts only" - - ScopedTrueTypeFont aSftTTF; - int nRC = aSftTTF.open( xRawFontData.get(), nFontSize1, nFaceNum ); - if( nRC != SF_OK ) - return FALSE; - - TTGlobalFontInfo aTTInfo; - ::GetTTGlobalFontInfo( aSftTTF.get(), &aTTInfo ); - rInfo.m_nFontType = SAL_FONTSUBSETINFO_TYPE_TRUETYPE; - rInfo.m_aPSName = ImplSalGetUniString( aTTInfo.psname ); - rInfo.m_nAscent = +aTTInfo.winAscent; - rInfo.m_nDescent = -aTTInfo.winDescent; - rInfo.m_aFontBBox = Rectangle( Point( aTTInfo.xMin, aTTInfo.yMin ), - Point( aTTInfo.xMax, aTTInfo.yMax ) ); - rInfo.m_nCapHeight = aTTInfo.yMax; // Well ... - - // subset glyphs and get their properties - // take care that subset fonts require the NotDef glyph in pos 0 - int nOrigCount = nGlyphCount; - USHORT aShortIDs[ 256 ]; - sal_uInt8 aTempEncs[ 256 ]; - - int nNotDef=-1, i; - for( i = 0; i < nGlyphCount; ++i ) - { - aTempEncs[i] = pEncoding[i]; - sal_uInt32 nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK; - if( pGlyphIDs[i] & GF_ISCHAR ) - { - bool bVertical = (pGlyphIDs[i] & GF_ROTMASK) != 0; - nGlyphIdx = ::MapChar( aSftTTF.get(), sal::static_int_cast<sal_uInt16>(nGlyphIdx), bVertical ); - if( nGlyphIdx == 0 && pFont->IsSymbolFont() ) - { - // #i12824# emulate symbol aliasing U+FXXX <-> U+0XXX - nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK; - nGlyphIdx = (nGlyphIdx & 0xF000) ? (nGlyphIdx & 0x00FF) : (nGlyphIdx | 0xF000 ); - nGlyphIdx = ::MapChar( aSftTTF.get(), sal::static_int_cast<sal_uInt16>(nGlyphIdx), bVertical ); - } - } - aShortIDs[i] = static_cast<USHORT>( nGlyphIdx ); - if( !nGlyphIdx ) - if( nNotDef < 0 ) - nNotDef = i; // first NotDef glyph found - } - - if( nNotDef != 0 ) - { - // add fake NotDef glyph if needed - if( nNotDef < 0 ) - nNotDef = nGlyphCount++; - - // NotDef glyph must be in pos 0 => swap glyphids - aShortIDs[ nNotDef ] = aShortIDs[0]; - aTempEncs[ nNotDef ] = aTempEncs[0]; - aShortIDs[0] = 0; - aTempEncs[0] = 0; - } - DBG_ASSERT( nGlyphCount < 257, "too many glyphs for subsetting" ); - - // fill pWidth array - TTSimpleGlyphMetrics* pMetrics = - ::GetTTSimpleGlyphMetrics( aSftTTF.get(), aShortIDs, nGlyphCount, aIFSD.mbVertical ); - if( !pMetrics ) - return FALSE; - sal_uInt16 nNotDefAdv = pMetrics[0].adv; - pMetrics[0].adv = pMetrics[nNotDef].adv; - pMetrics[nNotDef].adv = nNotDefAdv; - for( i = 0; i < nOrigCount; ++i ) - pGlyphWidths[i] = pMetrics[i].adv; - free( pMetrics ); - - // write subset into destination file - rtl::OUString aSysPath; - if( osl_File_E_None != osl_getSystemPathFromFileURL( rToFile.pData, &aSysPath.pData ) ) - return FALSE; - rtl_TextEncoding aThreadEncoding = osl_getThreadTextEncoding(); - ByteString aToFile( rtl::OUStringToOString( aSysPath, aThreadEncoding ) ); - nRC = ::CreateTTFromTTGlyphs( aSftTTF.get(), aToFile.GetBuffer(), aShortIDs, - aTempEncs, nGlyphCount, 0, NULL, 0 ); - return nRC == SF_OK; -} - -//-------------------------------------------------------------------------- - -const void* Os2SalGraphics::GetEmbedFontData( const ImplFontData* pFont, - const sal_Ucs* pUnicodes, sal_Int32* pCharWidths, - FontSubsetInfo& rInfo, long* pDataLen ) -{ - // create matching ImplFontSelectData - // we need just enough to get to the font file data - ImplFontSelectData aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); - - // TODO: much better solution: move SetFont and restoration of old font to caller - ScopedFont aOldFont(*this); - SetFont( &aIFSD, 0 ); - - // get the raw font file data - DWORD nFontSize1 = Ft2GetFontData( mhPS, 0, 0, NULL, 0 ); - if( nFontSize1 == FT2_ERROR || nFontSize1 <= 0 ) - return NULL; - *pDataLen = nFontSize1; - void* pData = reinterpret_cast<void*>(new char[ nFontSize1 ]); - DWORD nFontSize2 = Ft2GetFontData( mhPS, 0, 0, pData, nFontSize1 ); - if( nFontSize1 != nFontSize2 ) - *pDataLen = 0; - - // get important font properties - FONTMETRICS aOS2Metric; - if (Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric ) == GPI_ERROR) - *pDataLen = 0; - rInfo.m_nFontType = SAL_FONTSUBSETINFO_TYPE_TYPE1; - rInfo.m_aPSName = ImplSalGetUniString( aOS2Metric.szFacename ); - rInfo.m_nAscent = +aOS2Metric.lMaxAscender; - rInfo.m_nDescent = -aOS2Metric.lMaxDescender; - rInfo.m_aFontBBox = Rectangle( Point( 0, -aOS2Metric.lMaxDescender ), - Point( aOS2Metric.lMaxCharInc, aOS2Metric.lMaxAscender+aOS2Metric.lExternalLeading ) ); - rInfo.m_nCapHeight = aOS2Metric.lMaxAscender; // Well ... - - // get individual character widths - for( int i = 0; i < 256; ++i ) - { - LONG nCharWidth = 0; - const sal_Ucs cChar = pUnicodes[i]; - if( !Ft2QueryStringWidthW( mhPS, (LPWSTR)&cChar, 1, &nCharWidth ) ) - *pDataLen = 0; - pCharWidths[i] = nCharWidth; - } - - if( !*pDataLen ) - { - FreeEmbedFontData( pData, nFontSize1 ); - pData = NULL; - } - - return pData; -} - -//-------------------------------------------------------------------------- - -void Os2SalGraphics::FreeEmbedFontData( const void* pData, long /*nLen*/ ) -{ - delete[] reinterpret_cast<char*>(const_cast<void*>(pData)); -} - -const Ucs2SIntMap* Os2SalGraphics::GetFontEncodingVector( const ImplFontData* pFont, const Ucs2OStrMap** pNonEncoded ) -{ - // TODO: even for builtin fonts we get here... why? - if( !pFont->IsEmbeddable() ) - return NULL; - - // fill the encoding vector - Ucs2SIntMap& rMap = *new Ucs2SIntMap; -#if 0 - // TODO: get correct encoding vector - ImplWinFontData* pWinFontData = reinterpret_cast<ImplWinFontData*>(pFont); - - GLYPHSET aGlyphSet; - aGlyphSet.cbThis = sizeof(aGlyphSet); - DWORD aW = ::GetFontUnicodeRanges( mhDC, &aGlyphSet); -#else - for( sal_Unicode i = 32; i < 256; ++i ) - rMap[i] = i; - if( pNonEncoded ) - *pNonEncoded = NULL; -#endif - - return &rMap; -} - -//-------------------------------------------------------------------------- - -void Os2SalGraphics::GetGlyphWidths( const ImplFontData* pFont, - bool bVertical, - Int32Vector& rWidths, - Ucs2UIntMap& rUnicodeEnc ) -{ - // create matching ImplFontSelectData - // we need just enough to get to the font file data - ImplFontSelectData aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); - - // TODO: much better solution: move SetFont and restoration of old font to caller - ScopedFont aOldFont(*this); - - float fScale = 0.0; - ImplDoSetFont( &aIFSD, fScale, 0); - - if( pFont->IsSubsettable() ) - { - // get raw font file data - DWORD nFontSize1 = ::Ft2GetFontData( mhPS, 0, 0, NULL, 0 ); - if( nFontSize1 == FT2_ERROR ) - return; - ScopedCharArray xRawFontData(new char[ nFontSize1 ]); - DWORD nFontSize2 = ::Ft2GetFontData( mhPS, 0, 0, (void*)xRawFontData.get(), nFontSize1 ); - if( nFontSize1 != nFontSize2 ) - return; - - // open font file - sal_uInt32 nFaceNum = 0; - if( !*xRawFontData.get() ) // TTC candidate - nFaceNum = ~0U; // indicate "TTC font extracts only" - - ScopedTrueTypeFont aSftTTF; - int nRC = aSftTTF.open( xRawFontData.get(), nFontSize1, nFaceNum ); - if( nRC != SF_OK ) - return; - - int nGlyphs = GetTTGlyphCount( aSftTTF.get() ); - if( nGlyphs > 0 ) - { - rWidths.resize(nGlyphs); - std::vector<sal_uInt16> aGlyphIds(nGlyphs); - for( int i = 0; i < nGlyphs; i++ ) - aGlyphIds[i] = sal_uInt16(i); - TTSimpleGlyphMetrics* pMetrics = ::GetTTSimpleGlyphMetrics( aSftTTF.get(), - &aGlyphIds[0], - nGlyphs, - bVertical ? 1 : 0 ); - if( pMetrics ) - { - for( int i = 0; i< nGlyphs; i++ ) - rWidths[i] = pMetrics[i].adv; - free( pMetrics ); - rUnicodeEnc.clear(); - } - const ImplOs2FontData* pWinFont = static_cast<const ImplOs2FontData*>(pFont); - const ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap(); - DBG_ASSERT( pMap && pMap->GetCharCount(), "no map" ); - - int nCharCount = pMap->GetCharCount(); - sal_uInt32 nChar = pMap->GetFirstChar(); - for( int i = 0; i < nCharCount; i++ ) - { - if( nChar < 0x00010000 ) - { - sal_uInt16 nGlyph = ::MapChar( aSftTTF.get(), - static_cast<sal_uInt16>(nChar), - bVertical ? 1 : 0 ); - if( nGlyph ) - rUnicodeEnc[ static_cast<sal_Unicode>(nChar) ] = nGlyph; - } - nChar = pMap->GetNextChar( nChar ); - } - } - } - else if( pFont->IsEmbeddable() ) - { - // get individual character widths - rWidths.clear(); - rUnicodeEnc.clear(); - rWidths.reserve( 224 ); - for( sal_Unicode i = 32; i < 256; ++i ) - { - int nCharWidth = 0; - if( Ft2QueryStringWidthW( mhPS, (LPWSTR)&i, 1, (LONG*)&nCharWidth ) ) - { - rUnicodeEnc[ i ] = rWidths.size(); - rWidths.push_back( nCharWidth ); - } - } - } -} - -//-------------------------------------------------------------------------- - -void Os2SalGraphics::DrawServerFontLayout( const ServerFontLayout& ) -{} - -//-------------------------------------------------------------------------- - -SystemFontData Os2SalGraphics::GetSysFontData( int nFallbacklevel ) const -{ - SystemFontData aSysFontData; - - if (nFallbacklevel >= MAX_FALLBACK) nFallbacklevel = MAX_FALLBACK - 1; - if (nFallbacklevel < 0 ) nFallbacklevel = 0; - - aSysFontData.nSize = sizeof( SystemFontData ); - aSysFontData.hFont = mhFonts[nFallbacklevel]; - aSysFontData.bFakeBold = false; - aSysFontData.bFakeItalic = false; - aSysFontData.bAntialias = true; - aSysFontData.bVerticalCharacterType = false; - - return aSysFontData; -} - -//-------------------------------------------------------------------------- diff --git a/vcl/os2/source/gdi/salprn.cxx b/vcl/os2/source/gdi/salprn.cxx deleted file mode 100644 index 1aef34631f2e..000000000000 --- a/vcl/os2/source/gdi/salprn.cxx +++ /dev/null @@ -1,1833 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// use this define to disable the DJP support -// #define NO_DJP - -#define INCL_DOSMODULEMGR -#define INCL_DEV -#define INCL_SPL -#define INCL_SPLERRORS -#define INCL_SPLDOSPRINT -#define INCL_DEVDJP - -#define INCL_GPI -#define INCL_DOSSEMAPHORES -#define INCL_PM -#include <svpm.h> -#include <pmdjp.h> - -#include <string.h> - -#define _SV_SALPRN_CXX -#include <tools/debug.hxx> -#include <saldata.hxx> -#include <salinst.h> -#include <salgdi.h> -#include <salframe.h> -#include <vcl/salptype.hxx> -#include <salprn.h> -#include <vcl/print.h> -#include <vcl/jobset.h> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -// ======================================================================= - -// ----------------------- -// - struct ImplFormInfo - -// ----------------------- - -struct ImplFormInfo -{ - long mnPaperWidth; - long mnPaperHeight; -#ifndef NO_DJP - DJPT_PAPERSIZE mnId; -#endif -}; - -// ======================================================================= - -// ----------------------- -// - struct ImplTrayInfo - -// ----------------------- - -struct ImplTrayInfo -{ - CHAR maName[32]; - CHAR maDisplayName[64]; - DJPT_TRAYTYPE mnId; - - ImplTrayInfo( const char* pTrayName, - const char* pTrayDisplayName ) - { - strcpy( maName, pTrayName); - strcpy( maDisplayName, pTrayDisplayName); - } -}; - -// ======================================================================= - -struct ImplQueueSalSysData -{ - ByteString maPrinterName; // pszPrinters - ByteString maName; // pszName bzw. LogAddress - ByteString maOrgDriverName; // pszDriverName (maDriverName.maDeviceName) - ByteString maDriverName; // pszDriverName bis . - ByteString maDeviceName; // pszDriverName nach . - PDRIVDATA mpDrivData; - - ImplQueueSalSysData( const ByteString& rPrinterName, - const ByteString& rName, - const ByteString& rDriverName, - const ByteString& rDeviceName, - const ByteString& rOrgDriverName, - PDRIVDATA pDrivData ); - ~ImplQueueSalSysData(); -}; - -// ----------------------------------------------------------------------- - -ImplQueueSalSysData::ImplQueueSalSysData( const ByteString& rPrinterName, - const ByteString& rName, - const ByteString& rOrgDriverName, - const ByteString& rDriverName, - const ByteString& rDeviceName, - PDRIVDATA pDrivData ) : - maPrinterName( rPrinterName ), - maName( rName ), - maOrgDriverName( rName ), - maDriverName( rDriverName ), - maDeviceName( rDeviceName ) -{ - if ( pDrivData ) - { - mpDrivData = (PDRIVDATA)new BYTE[pDrivData->cb]; - memcpy( mpDrivData, pDrivData, pDrivData->cb ); - } - else - mpDrivData = NULL; -} - -// ----------------------------------------------------------------------- - -ImplQueueSalSysData::~ImplQueueSalSysData() -{ - delete mpDrivData; -} - -// ======================================================================= - -static ULONG ImplPMQueueStatusToSal( USHORT nPMStatus ) -{ - ULONG nStatus = 0; - if ( nPMStatus & PRQ3_PAUSED ) - nStatus |= QUEUE_STATUS_PAUSED; - if ( nPMStatus & PRQ3_PENDING ) - nStatus |= QUEUE_STATUS_PENDING_DELETION; - if ( !nStatus ) - nStatus |= QUEUE_STATUS_READY; - return nStatus; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) -{ - APIRET rc; - ULONG nNeeded; - ULONG nReturned; - ULONG nTotal; - - // query needed size of the buffer for the QueueInfo - rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL ); - if( nNeeded == 0 ) - return; - - // create the buffer for the QueueInfo - PCHAR pQueueData = new CHAR[nNeeded]; - - // query QueueInfos - rc = SplEnumQueue( (PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL ); - - PPRQINFO3 pPrqInfo = (PPRQINFO3)pQueueData; - for ( int i = 0; i < nReturned; i++ ) - { - // create entry for the QueueInfo array - SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo; - - ByteString aOrgDriverName( pPrqInfo->pszDriverName); - ByteString aName( pPrqInfo->pszName); - pInfo->maDriver = ::rtl::OStringToOUString (aOrgDriverName, gsl_getSystemTextEncoding()); - pInfo->maPrinterName = ::rtl::OStringToOUString (pPrqInfo->pszComment, gsl_getSystemTextEncoding()); - pInfo->maLocation = ::rtl::OStringToOUString (aName, gsl_getSystemTextEncoding()); - pInfo->mnStatus = ImplPMQueueStatusToSal( pPrqInfo->fsStatus ); - pInfo->mnJobs = pPrqInfo->cJobs; - // pInfo->maComment = !!! - - // Feststellen, ob Name doppelt - PPRQINFO3 pTempPrqInfo = (PPRQINFO3)pQueueData; - for ( int j = 0; j < nReturned; j++ ) - { - // Wenn Name doppelt, erweitern wir diesen um die Location - if ( (j != i) && - (strcmp( pPrqInfo->pszComment, pTempPrqInfo->pszComment ) == 0) ) - { - pInfo->maPrinterName += ';'; - pInfo->maPrinterName += pInfo->maLocation; - } - pTempPrqInfo++; - } - - // pszDriver in DriverName (bis .) und DeviceName (nach .) aufsplitten - PSZ pDriverName; - PSZ pDeviceName; - if ( (pDriverName = strchr( pPrqInfo->pszDriverName, '.' )) != 0 ) - { - *pDriverName = 0; - pDeviceName = pDriverName + 1; - } - else - pDeviceName = NULL; - - // Alle Bytes hinter dem DeviceNamen auf 0 initialisieren, damit - // ein memcmp vom JobSetup auch funktioniert - if ( pPrqInfo->pDriverData && - (pPrqInfo->pDriverData->cb >= sizeof( pPrqInfo->pDriverData )) ) - { - int nDeviceNameLen = strlen( pPrqInfo->pDriverData->szDeviceName ); - memset( pPrqInfo->pDriverData->szDeviceName+nDeviceNameLen, - 0, - sizeof( pPrqInfo->pDriverData->szDeviceName )-nDeviceNameLen ); - } - - // save driver data and driver names - ByteString aPrinterName( pPrqInfo->pszPrinters); - ByteString aDriverName( pPrqInfo->pszDriverName); - ByteString aDeviceName; - if ( pDeviceName ) - aDeviceName = pDeviceName; - pInfo->mpSysData = new ImplQueueSalSysData( aPrinterName, aName, - aOrgDriverName, - aDriverName, aDeviceName, - pPrqInfo->pDriverData ); - - // add queue to the list - pList->Add( pInfo ); - - // increment to next element of the QueueInfo array - pPrqInfo++; - } - - delete [] pQueueData; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) -{ - APIRET rc; - ULONG nNeeded; - ULONG nReturned; - ULONG nTotal; - - // query needed size of the buffer for the QueueInfo - rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL ); - if( nNeeded == 0 ) - return; - - // create the buffer for the QueueInfo - PCHAR pQueueData = new CHAR[nNeeded]; - - // query QueueInfos - rc = SplEnumQueue( (PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL ); - - PPRQINFO3 pPrqInfo = (PPRQINFO3)pQueueData; - for ( int i = 0; i < nReturned; i++ ) - { - ImplQueueSalSysData* pSysData = (ImplQueueSalSysData*)(pInfo->mpSysData); - if ( pSysData->maPrinterName.Equals( pPrqInfo->pszPrinters ) && - pSysData->maName.Equals( pPrqInfo->pszName ) && - pSysData->maOrgDriverName.Equals( pPrqInfo->pszDriverName ) ) - { - pInfo->mnStatus = ImplPMQueueStatusToSal( pPrqInfo->fsStatus ); - pInfo->mnJobs = pPrqInfo->cJobs; - break; - } - - // increment to next element of the QueueInfo array - pPrqInfo++; - } - - delete [] pQueueData; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) -{ - delete ((ImplQueueSalSysData*)(pInfo->mpSysData)); - delete pInfo; -} - -// ----------------------------------------------------------------------- - -XubString Os2SalInstance::GetDefaultPrinter() -{ - APIRET rc; - ULONG nNeeded; - ULONG nReturned; - ULONG nTotal; - char szQueueName[255]; - XubString aDefaultName; - - // query default queue - if ( !PrfQueryProfileString( HINI_PROFILE, SPL_INI_SPOOLER, "QUEUE", 0, szQueueName, sizeof( szQueueName ) ) ) - return aDefaultName; - - // extract first queue name - PSZ pStr; - if ( (pStr = strchr( szQueueName, ';' )) != 0 ) - *pStr = 0; - - // query needed size of the buffer for the QueueInfo - rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL ); - if ( nNeeded == 0 ) - return aDefaultName; - - // create the buffer for the QueueInfo - PCHAR pQueueData = new CHAR[ nNeeded ]; - - // query QueueInfos - rc = SplEnumQueue ((PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL ); - - // find printer name for default queue - PPRQINFO3 pPrqInfo = (PPRQINFO3) pQueueData; - for ( int i = 0; i < nReturned; i++ ) - { - if ( strcmp( pPrqInfo->pszName, szQueueName ) == 0 ) - { - aDefaultName = ::rtl::OStringToOUString (pPrqInfo->pszComment, gsl_getSystemTextEncoding()); - - // Feststellen, ob Name doppelt - PPRQINFO3 pTempPrqInfo = (PPRQINFO3)pQueueData; - for ( int j = 0; j < nReturned; j++ ) - { - // Wenn Name doppelt, erweitern wir diesen um die Location - if ( (j != i) && - (strcmp( pPrqInfo->pszComment, pTempPrqInfo->pszComment ) == 0) ) - { - String pszName( ::rtl::OStringToOUString (pPrqInfo->pszName, gsl_getSystemTextEncoding())); - aDefaultName += ';'; - aDefaultName += pszName; - } - pTempPrqInfo++; - } - break; - } - - // increment to next element of the QueueInfo array - pPrqInfo++; - } - - delete [] pQueueData; - - return aDefaultName; -} - -// ======================================================================= - -static void* ImplAllocPrnMemory( size_t n ) -{ - return calloc( n, 1); -} - -// ----------------------------------------------------------------------- - -inline void ImplFreePrnMemory( void* p ) -{ - free( p ); -} - -// ----------------------------------------------------------------------- - -static PDRIVDATA ImplPrnDrivData( const ImplJobSetup* pSetupData ) -{ - // Diese Funktion wird eingesetzt, damit Druckertreiber nicht auf - // unseren Daten arbeiten, da es durch Konfigurationsprobleme - // sein kann, das der Druckertreiber bei uns Daten ueberschreibt. - // Durch diese vorgehensweise werden einige Abstuerze vermieden, bzw. - // sind dadurch leichter zu finden - - if ( !pSetupData->mpDriverData ) - return NULL; - - DBG_ASSERT( ((PDRIVDATA)(pSetupData->mpDriverData))->cb == pSetupData->mnDriverDataLen, - "ImplPrnDrivData() - SetupDataLen != DriverDataLen" ); - - PDRIVDATA pDrivData = (PDRIVDATA)ImplAllocPrnMemory( pSetupData->mnDriverDataLen ); - memcpy( pDrivData, pSetupData->mpDriverData, pSetupData->mnDriverDataLen ); - return pDrivData; -} - -// ----------------------------------------------------------------------- - -static void ImplUpdateSetupData( const PDRIVDATA pDrivData, ImplJobSetup* pSetupData ) -{ - // Diese Funktion wird eingesetzt, damit Druckertreiber nicht auf - // unseren Daten arbeiten, da es durch Konfigurationsprobleme - // sein kann, das der Druckertreiber bei uns Daten ueberschreibt. - // Durch diese vorgehensweise werden einige Abstuerze vermieden, bzw. - // sind dadurch leichter zu finden - - if ( !pDrivData || !pDrivData->cb ) - { - if ( pSetupData->mpDriverData ) - rtl_freeMemory( pSetupData->mpDriverData ); - pSetupData->mpDriverData = NULL; - pSetupData->mnDriverDataLen = 0; - } - else - { - // Alle Bytes hinter dem DeviceNamen auf 0 initialisieren, damit - // ein memcmp vom JobSetup auch funktioniert - if ( pDrivData->cb >= sizeof( pDrivData ) ) - { - int nDeviceNameLen = strlen( pDrivData->szDeviceName ); - memset( pDrivData->szDeviceName+nDeviceNameLen, - 0, - sizeof( pDrivData->szDeviceName )-nDeviceNameLen ); - } - - if ( pSetupData->mpDriverData ) - { - if ( pSetupData->mnDriverDataLen != pDrivData->cb ) - rtl_freeMemory( pSetupData->mpDriverData ); - pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDrivData->cb); - } - else - pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDrivData->cb); - pSetupData->mnDriverDataLen = pDrivData->cb; - memcpy( pSetupData->mpDriverData, pDrivData, pDrivData->cb ); - } - - if ( pDrivData ) - ImplFreePrnMemory( pDrivData ); -} - -// ----------------------------------------------------------------------- - -static BOOL ImplPaperSizeEqual( long nPaperWidth1, long nPaperHeight1, - long nPaperWidth2, long nPaperHeight2 ) -{ - return (((nPaperWidth1 >= nPaperWidth2-1) && (nPaperWidth1 <= nPaperWidth2+1)) && - ((nPaperHeight1 >= nPaperHeight2-1) && (nPaperHeight1 <= nPaperHeight2+1))); -} - -// ----------------------------------------------------------------------- - -static BOOL ImplIsDriverDJPEnabled( HDC hDC ) -{ -#ifdef NO_DJP - return FALSE; -#else - // Ueber OS2-Ini kann DJP disablte werden - if ( !PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_USEDJP, 1 ) ) - return FALSE; - - // Testen, ob DJP-Interface am Drucker vorhanden - LONG lQuery; - APIRET rc; - - lQuery = DEVESC_QUERYSIZE; - rc = DevEscape( hDC, - DEVESC_QUERYESCSUPPORT, - sizeof( lQuery ), - (PBYTE)&lQuery, - 0, - (PBYTE)NULL ); - if ( DEV_OK != rc ) - return FALSE; - - lQuery = DEVESC_QUERYJOBPROPERTIES; - rc = DevEscape( hDC, - DEVESC_QUERYESCSUPPORT, - sizeof( lQuery ), - (PBYTE)&lQuery, - 0, - (PBYTE)NULL ); - if ( DEV_OK != rc ) - return FALSE; - - lQuery = DEVESC_SETJOBPROPERTIES; - rc = DevEscape( hDC, - DEVESC_QUERYESCSUPPORT, - sizeof( lQuery ), - (PBYTE)&lQuery, - 0, - (PBYTE)NULL ); - if ( DEV_OK != rc ) - return FALSE; - - return TRUE; -#endif -} - -// ----------------------------------------------------------------------- - -static void ImplFormatInputList( PDJP_ITEM pDJP, PQUERYTUPLE pTuple ) -{ - // Loop through the query elements - BOOL fContinue = TRUE; - do - { - pDJP->cb = sizeof (DJP_ITEM); - pDJP->ulProperty = pTuple->ulProperty; - pDJP->lType = pTuple->lType; - pDJP->ulNumReturned = 0; - pDJP->ulValue = DJP_NONE; - - // at EOL? - fContinue = DJP_NONE != pTuple->ulProperty; - - // Move to next item structure and tuplet - pDJP++; - pTuple++; - } - while ( fContinue ); -} - -// ----------------------------------------------------------------------- - -static void ImplFreeFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter ) -{ - if ( pOs2SalInfoPrinter->mnFormCount ) - { - for ( USHORT i = 0; i < pOs2SalInfoPrinter->mnFormCount; i++ ) - delete pOs2SalInfoPrinter->mpFormArray[i]; - delete [] pOs2SalInfoPrinter->mpFormArray; - pOs2SalInfoPrinter->mnFormCount = 0; - } - - if ( pOs2SalInfoPrinter->mnTrayCount ) - { - for ( USHORT i = 0; i < pOs2SalInfoPrinter->mnTrayCount; i++ ) - delete pOs2SalInfoPrinter->mpTrayArray[i]; - delete [] pOs2SalInfoPrinter->mpTrayArray; - pOs2SalInfoPrinter->mnTrayCount = 0; - } -} - -// ----------------------------------------------------------------------- - -static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const ImplJobSetup* pSetupData ) -{ - ImplFreeFormAndTrayList( pOs2SalInfoPrinter ); - - LONG alQuery[] = - { - 0, 0, // First two members of QUERYSIZE - DJP_CJ_FORM, DJP_ALL, - DJP_CJ_TRAYNAME, DJP_ALL, - DJP_NONE, DJP_NONE // EOL marker - }; - - APIRET rc; - PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; - PBYTE pBuffer = NULL; - LONG nAlloc = 0; - PDRIVDATA pCopyDrivData = ImplPrnDrivData( pSetupData ); - LONG nDrivDataSize = pCopyDrivData->cb; - PBYTE pDrivData = (PBYTE)pCopyDrivData; - - // find out how many bytes to allocate - pQuerySize->cb = sizeof( alQuery ); - rc = DevEscape( pOs2SalInfoPrinter->mhDC, - DEVESC_QUERYSIZE, - sizeof( alQuery ), - (PBYTE)pQuerySize, - &nDrivDataSize, - pDrivData ); - if ( DEV_OK != rc ) - { - ImplFreePrnMemory( pCopyDrivData ); - return; - } - - // allocate the memory - nAlloc = pQuerySize->ulSizeNeeded; - pBuffer = (PBYTE)new BYTE[nAlloc]; - - // set up the input - PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; - ImplFormatInputList( pDJP, pQuerySize->aTuples ); - - // do it! - rc = DevEscape( pOs2SalInfoPrinter->mhDC, - DEVESC_QUERYJOBPROPERTIES, - nAlloc, - pBuffer, - &nDrivDataSize, - pDrivData ); - ImplFreePrnMemory( pCopyDrivData ); - - if ( (DEV_OK == rc) || (DEV_WARNING == rc) ) - { - // Loop through the query elements - PQUERYTUPLE pTuple = pQuerySize->aTuples; - while ( DJP_NONE != pTuple->ulProperty ) - { - if ( pDJP->ulProperty == DJP_CJ_FORM ) - { - if ( pDJP->ulNumReturned ) - { - PDJPT_FORM pElm = DJP_ELEMENTP( *pDJP, DJPT_FORM ); - - pOs2SalInfoPrinter->mnFormCount = pDJP->ulNumReturned; - pOs2SalInfoPrinter->mpFormArray = new PIMPLFORMINFO[pOs2SalInfoPrinter->mnFormCount]; - for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ ) - { - ImplFormInfo* pInfo = new ImplFormInfo; - pInfo->mnPaperWidth = pElm->hcInfo.cx; - pInfo->mnPaperHeight = pElm->hcInfo.cy; - pInfo->mnId = pElm->djppsFormID; - pOs2SalInfoPrinter->mpFormArray[i] = pInfo; - } - } - } - else if ( pDJP->ulProperty == DJP_CJ_TRAYNAME ) - { - if ( pDJP->ulNumReturned ) - { - PDJPT_TRAYNAME pElm = DJP_ELEMENTP( *pDJP, DJPT_TRAYNAME ); - - pOs2SalInfoPrinter->mnTrayCount = pDJP->ulNumReturned; - pOs2SalInfoPrinter->mpTrayArray = new PIMPLTRAYINFO[pOs2SalInfoPrinter->mnTrayCount]; - for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ ) - { - ImplTrayInfo* pInfo = new ImplTrayInfo( pElm->szTrayname, pElm->szDisplayTrayname ); - pInfo->mnId = pElm->djpttTrayID; - pOs2SalInfoPrinter->mpTrayArray[i] = pInfo; - } - } - } - - pDJP = DJP_NEXT_STRUCTP( pDJP ); - pTuple++; - } - } - - delete [] pBuffer; -} - -// ----------------------------------------------------------------------- - -static BOOL ImplGetCurrentSettings( Os2SalInfoPrinter* pOs2SalInfoPrinter, ImplJobSetup* pSetupData ) -{ - // Um den aktuellen Tray zu ermitteln, brauchen wir auch die Listen dazu - if ( !pOs2SalInfoPrinter->mnFormCount ) - ImplGetFormAndTrayList( pOs2SalInfoPrinter, pSetupData ); - - LONG alQuery[] = - { - 0, 0, // First two members of QUERYSIZE - DJP_SJ_ORIENTATION, DJP_CURRENT, - DJP_CJ_FORM, DJP_CURRENT, - DJP_NONE, DJP_NONE // EOL marker - }; - - APIRET rc; - PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; - PBYTE pBuffer = NULL; - LONG nAlloc = 0; - PDRIVDATA pCopyDrivData = ImplPrnDrivData( pSetupData ); - LONG nDrivDataSize = pCopyDrivData->cb; - PBYTE pDrivData = (PBYTE)pCopyDrivData; - BOOL bResult; - - // find out how many bytes to allocate - pQuerySize->cb = sizeof( alQuery ); - rc = DevEscape( pOs2SalInfoPrinter->mhDC, - DEVESC_QUERYSIZE, - sizeof( alQuery ), - (PBYTE)pQuerySize, - &nDrivDataSize, - pDrivData ); - if ( DEV_OK != rc ) - { - ImplFreePrnMemory( pCopyDrivData ); - return FALSE; - } - - // allocate the memory - nAlloc = pQuerySize->ulSizeNeeded; - pBuffer = (PBYTE)new BYTE[nAlloc]; - - // set up the input - PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; - ImplFormatInputList( pDJP, pQuerySize->aTuples ); - - rc = DevEscape( pOs2SalInfoPrinter->mhDC, - DEVESC_QUERYJOBPROPERTIES, - nAlloc, - pBuffer, - &nDrivDataSize, - pDrivData ); - if ( (DEV_OK == rc) || (DEV_WARNING == rc) ) - { - // aktuelle Setup-Daten uebernehmen - ImplUpdateSetupData( pCopyDrivData, pSetupData ); - - // Loop through the query elements - PQUERYTUPLE pTuple = pQuerySize->aTuples; - while ( DJP_NONE != pTuple->ulProperty ) - { - if ( pDJP->ulProperty == DJP_SJ_ORIENTATION ) - { - if ( pDJP->ulNumReturned ) - { - PDJPT_ORIENTATION pElm = DJP_ELEMENTP( *pDJP, DJPT_ORIENTATION ); - if ( (DJP_ORI_PORTRAIT == *pElm) || (DJP_ORI_REV_PORTRAIT == *pElm) ) - pSetupData->meOrientation = ORIENTATION_PORTRAIT; - else - pSetupData->meOrientation = ORIENTATION_LANDSCAPE; - } - } - else if ( pDJP->ulProperty == DJP_CJ_FORM ) - { - if ( pDJP->ulNumReturned ) - { - PDJPT_FORM pElm = DJP_ELEMENTP( *pDJP, DJPT_FORM ); - - pSetupData->mnPaperWidth = pElm->hcInfo.cx*100; - pSetupData->mnPaperHeight = pElm->hcInfo.cy*100; - switch( pElm->djppsFormID ) - { - case DJP_PSI_A3: - pSetupData->mePaperFormat = PAPER_A3; - break; - - case DJP_PSI_A4: - pSetupData->mePaperFormat = PAPER_A4; - break; - - case DJP_PSI_A5: - pSetupData->mePaperFormat = PAPER_A5; - break; - - case DJP_PSI_B4: - pSetupData->mePaperFormat = PAPER_B4; - break; - - case DJP_PSI_B5: - pSetupData->mePaperFormat = PAPER_B5; - break; - - case DJP_PSI_LETTER: - pSetupData->mePaperFormat = PAPER_LETTER; - break; - - case DJP_PSI_LEGAL: - pSetupData->mePaperFormat = PAPER_LEGAL; - break; - - case DJP_PSI_TABLOID: - pSetupData->mePaperFormat = PAPER_TABLOID; - break; - - default: - pSetupData->mePaperFormat = PAPER_USER; - break; - } - - // Wir suchen zuerst ueber den Namen/Id und dann ueber die Id - BOOL bTrayFound = FALSE; - USHORT j; - for ( j = 0; j < pOs2SalInfoPrinter->mnTrayCount; j++ ) - { - if ( (pOs2SalInfoPrinter->mpTrayArray[j]->mnId == pElm->djpttTrayID) && - (pOs2SalInfoPrinter->mpTrayArray[j]->maName == pElm->szTrayname) ) - { - pSetupData->mnPaperBin = j; - bTrayFound = TRUE; - break; - } - } - if ( !bTrayFound ) - { - for ( j = 0; j < pOs2SalInfoPrinter->mnTrayCount; j++ ) - { - if ( pOs2SalInfoPrinter->mpTrayArray[j]->mnId == pElm->djpttTrayID ) - { - pSetupData->mnPaperBin = j; - bTrayFound = TRUE; - break; - } - } - } - // Wenn wir Ihn immer noch nicht gefunden haben, setzen - // wir ihn auf DontKnow - if ( !bTrayFound ) - pSetupData->mnPaperBin = 0xFFFF; - } - } - - pDJP = DJP_NEXT_STRUCTP( pDJP ); - pTuple++; - } - - bResult = TRUE; - } - else - { - ImplFreePrnMemory( pCopyDrivData ); - bResult = FALSE; - } - - delete [] pBuffer; - - return bResult; -} - -// ----------------------------------------------------------------------- - -static BOOL ImplSetOrientation( HDC hPrinterDC, PDRIVDATA pDriverData, - Orientation eOrientation ) -{ - LONG alQuery[] = - { - 0, 0, // First two members of QUERYSIZE - DJP_SJ_ORIENTATION, DJP_CURRENT, - DJP_NONE, DJP_NONE // EOL marker - }; - - APIRET rc; - PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; - PBYTE pBuffer = NULL; - LONG nAlloc = 0; - LONG nDrivDataSize = pDriverData->cb; - - // find out how many bytes to allocate - pQuerySize->cb = sizeof( alQuery ); - rc = DevEscape( hPrinterDC, - DEVESC_QUERYSIZE, - sizeof( alQuery ), - (PBYTE)pQuerySize, - &nDrivDataSize, - (PBYTE)pDriverData ); - if ( DEV_OK != rc ) - return FALSE; - - // allocate the memory - nAlloc = pQuerySize->ulSizeNeeded; - pBuffer = (PBYTE)new BYTE[nAlloc]; - - // set up the input - PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; - ImplFormatInputList( pDJP, pQuerySize->aTuples ); - - pDJP->cb = sizeof( DJP_ITEM ); - pDJP->ulProperty = DJP_SJ_ORIENTATION; - pDJP->lType = DJP_CURRENT; - pDJP->ulValue = (eOrientation == ORIENTATION_PORTRAIT) - ? DJP_ORI_PORTRAIT - : DJP_ORI_LANDSCAPE; - - // do it! - rc = DevEscape( hPrinterDC, - DEVESC_SETJOBPROPERTIES, - nAlloc, - pBuffer, - &nDrivDataSize, - (PBYTE)pDriverData ); - - delete [] pBuffer; - - return ((DEV_OK == rc) || (DEV_WARNING == rc)); -} - -// ----------------------------------------------------------------------- - -static BOOL ImplSetPaperSize( HDC hPrinterDC, PDRIVDATA pDriverData, - DJPT_PAPERSIZE nOS2PaperFormat ) -{ - LONG alQuery[] = - { - 0, 0, // First two members of QUERYSIZE - DJP_SJ_PAPERSIZE, DJP_CURRENT, - DJP_NONE, DJP_NONE // EOL marker - }; - - APIRET rc; - PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; - PBYTE pBuffer = NULL; - LONG nAlloc = 0; - LONG nDrivDataSize = pDriverData->cb; - - // find out how many bytes to allocate - pQuerySize->cb = sizeof( alQuery ); - rc = DevEscape( hPrinterDC, - DEVESC_QUERYSIZE, - sizeof( alQuery ), - (PBYTE)pQuerySize, - &nDrivDataSize, - (PBYTE)pDriverData ); - if ( DEV_OK != rc ) - return FALSE; - - // allocate the memory - nAlloc = pQuerySize->ulSizeNeeded; - pBuffer = (PBYTE)new BYTE[nAlloc]; - - // set up the input - PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; - PDJP_ITEM pStartDJP = pDJP; - ImplFormatInputList( pDJP, pQuerySize->aTuples ); - - // Neue Daten zuweisen - pDJP->cb = sizeof( DJP_ITEM ); - pDJP->ulProperty = DJP_SJ_PAPERSIZE; - pDJP->lType = DJP_CURRENT; - pDJP->ulValue = nOS2PaperFormat; - - // und setzen - rc = DevEscape( hPrinterDC, - DEVESC_SETJOBPROPERTIES, - nAlloc, - pBuffer, - &nDrivDataSize, - (PBYTE)pDriverData ); - - delete [] pBuffer; - - return ((DEV_OK == rc) || (DEV_WARNING == rc)); -} - -// ----------------------------------------------------------------------- - -static BOOL ImplSetPaperBin( HDC hPrinterDC, PDRIVDATA pDriverData, - ImplTrayInfo* pTrayInfo ) -{ - LONG alQuery[] = - { - 0, 0, // First two members of QUERYSIZE - DJP_SJ_TRAYTYPE, DJP_CURRENT, - DJP_NONE, DJP_NONE // EOL marker - }; - - APIRET rc; - PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; - PBYTE pBuffer = NULL; - LONG nAlloc = 0; - LONG nDrivDataSize = pDriverData->cb; - - // find out how many bytes to allocate - pQuerySize->cb = sizeof( alQuery ); - rc = DevEscape( hPrinterDC, - DEVESC_QUERYSIZE, - sizeof( alQuery ), - (PBYTE)pQuerySize, - &nDrivDataSize, - (PBYTE)pDriverData ); - if ( DEV_OK != rc ) - return FALSE; - - // allocate the memory - nAlloc = pQuerySize->ulSizeNeeded; - pBuffer = (PBYTE)new BYTE[nAlloc]; - - // set up the input - PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; - ImplFormatInputList( pDJP, pQuerySize->aTuples ); - - // Neue Daten zuweisen - pDJP->cb = sizeof( DJP_ITEM ); - pDJP->ulProperty = DJP_SJ_TRAYTYPE; - pDJP->lType = DJP_CURRENT; - pDJP->ulValue = pTrayInfo->mnId; - - // und setzen - rc = DevEscape( hPrinterDC, - DEVESC_SETJOBPROPERTIES, - nAlloc, - pBuffer, - &nDrivDataSize, - (PBYTE)pDriverData ); - - delete [] pBuffer; - - return ((DEV_OK == rc) || (DEV_WARNING == rc)); -} - -// ======================================================================= - -static BOOL ImplSalCreateInfoPrn( Os2SalInfoPrinter* pPrinter, PDRIVDATA pDriverData, - HDC& rDC, HPS& rPS ) -{ - SalData* pSalData = GetSalData(); - - // create info context - DEVOPENSTRUC devOpenStruc; - memset( &devOpenStruc, 0, sizeof( devOpenStruc ) ); - devOpenStruc.pszLogAddress = (char*)pPrinter->maName.GetBuffer(); - devOpenStruc.pszDriverName = (char*)pPrinter->maDriverName.GetBuffer(); - devOpenStruc.pdriv = pDriverData; - devOpenStruc.pszDataType = "PM_Q_STD"; - - HDC hDC = DevOpenDC( pSalData->mhAB, OD_INFO, "*", - 4, (PDEVOPENDATA)&devOpenStruc, (HDC)NULL); - if ( !hDC ) - return FALSE; - - // create presentation space - SIZEL sizel; - sizel.cx = 0; - sizel.cy = 0; - HPS hPS = Ft2CreatePS( pSalData->mhAB, hDC, &sizel, GPIA_ASSOC | GPIT_MICRO | PU_PELS ); - if ( !hPS ) - { - DevCloseDC( hDC ); - return FALSE; - } - - rDC = hDC; - rPS = hPS; - return TRUE; -} - -// ----------------------------------------------------------------------- - -static void ImplSalDestroyInfoPrn( Os2SalInfoPrinter* pPrinter ) -{ - ImplSalDeInitGraphics( pPrinter->mpGraphics); - Ft2Associate( pPrinter->mhPS, 0 ); - Ft2DestroyPS( pPrinter->mhPS ); - DevCloseDC( pPrinter->mhDC ); -} - -// ======================================================================= - -SalInfoPrinter* Os2SalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, - ImplJobSetup* pSetupData ) -{ - ImplQueueSalSysData* pSysQueueData = (ImplQueueSalSysData*)(pQueueInfo->mpSysData); - Os2SalInfoPrinter* pPrinter = new Os2SalInfoPrinter; - pPrinter->maPrinterName = pSysQueueData->maPrinterName; - pPrinter->maName = pSysQueueData->maName; - pPrinter->maDriverName = pSysQueueData->maDriverName; - pPrinter->maDeviceName = pSysQueueData->maDeviceName; - - // Nur Setup-Daten uebernehmen, wenn Treiber und Laenge der Treiberdaten - // uebereinstimmt - PDRIVDATA pDriverData; - BOOL bUpdateDriverData; - if ( pSetupData->mpDriverData && pSysQueueData->mpDrivData && - (pSetupData->mnSystem == JOBSETUP_SYSTEM_OS2) && - (pSetupData->mnDriverDataLen == pSysQueueData->mpDrivData->cb) && - (strcmp( ((PDRIVDATA)pSetupData->mpDriverData)->szDeviceName, - pSysQueueData->mpDrivData->szDeviceName ) == 0) ) - { - pDriverData = PDRIVDATA( pSetupData->mpDriverData ); - bUpdateDriverData = FALSE; - } - else - { - pDriverData = pSysQueueData->mpDrivData; - bUpdateDriverData = TRUE; - } - if ( pDriverData ) - pPrinter->maJobSetupDeviceName = pDriverData->szDeviceName; - - if ( !ImplSalCreateInfoPrn( pPrinter, pDriverData, - pPrinter->mhDC, - pPrinter->mhPS ) ) - { - delete pPrinter; - return NULL; - } - - // create graphics object for output - Os2SalGraphics* pGraphics = new Os2SalGraphics; - pGraphics->mhDC = pPrinter->mhDC; - pGraphics->mhPS = pPrinter->mhPS; - pGraphics->mhWnd = 0; - pGraphics->mbPrinter = TRUE; - pGraphics->mbVirDev = FALSE; - pGraphics->mbWindow = FALSE; - pGraphics->mbScreen = FALSE; - - ImplSalInitGraphics( pGraphics ); - pPrinter->mpGraphics = pGraphics; - - // check printer driver for DJP support - pPrinter->mbDJPSupported = ImplIsDriverDJPEnabled( pPrinter->mhDC ); - - if ( bUpdateDriverData ) - { - if ( pSetupData->mpDriverData ) - rtl_freeMemory( pSetupData->mpDriverData); - pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDriverData->cb); - memcpy( pSetupData->mpDriverData, pDriverData, pDriverData->cb ); - pSetupData->mnDriverDataLen = pDriverData->cb; - } - - // retrieve current settings from printer driver and store them to system independend data! - if ( pPrinter->mbDJPSupported ) - ImplGetCurrentSettings( pPrinter, pSetupData ); - pSetupData->mnSystem = JOBSETUP_SYSTEM_OS2; - - return pPrinter; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter ) -{ - delete pPrinter; -} - -// ======================================================================= - -Os2SalInfoPrinter::Os2SalInfoPrinter() -{ - mhDC = 0; - mhPS = 0; - mpGraphics = NULL; - mbGraphics = FALSE; - mbDJPSupported = FALSE; - mnFormCount = 0; - mpFormArray = NULL; - mnTrayCount = 0; - mpTrayArray = NULL; -} - -// ----------------------------------------------------------------------- - -Os2SalInfoPrinter::~Os2SalInfoPrinter() -{ - if ( mpGraphics ) - { - ImplSalDestroyInfoPrn( this ); - delete mpGraphics; - } - - ImplFreeFormAndTrayList( this ); -} - -// ----------------------------------------------------------------------- - -SalGraphics* Os2SalInfoPrinter::GetGraphics() -{ - if ( mbGraphics ) - return NULL; - - if ( mpGraphics ) - mbGraphics = TRUE; - - return mpGraphics; -} - -// ----------------------------------------------------------------------- - -void Os2SalInfoPrinter::ReleaseGraphics( SalGraphics* ) -{ - mbGraphics = FALSE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) -{ - PDRIVDATA pDrivData = ImplPrnDrivData( pSetupData ); - if ( !pDrivData ) - return FALSE; - - APIRET rc = DevPostDeviceModes( GetSalData()->mhAB, pDrivData, - maDriverName.GetBuffer(), - maDeviceName.GetBuffer(), - maPrinterName.GetBuffer(), - DPDM_POSTJOBPROP ); - if ( rc == DEV_OK ) - { - ImplUpdateSetupData( pDrivData, pSetupData ); - - // update DC and PS - HDC hDC; - HPS hPS; - if ( !ImplSalCreateInfoPrn( this, (PDRIVDATA)(pSetupData->mpDriverData), hDC, hPS ) ) - return FALSE; - - // Alten Printer DC/PS zerstoeren - ImplSalDestroyInfoPrn( this ); - - // Neue Daten setzen und initialisieren - mhDC = hDC; - mhPS = hPS; - mpGraphics->mhDC = mhDC; - mpGraphics->mhPS = mhPS; - ImplSalInitGraphics( mpGraphics ); - - // retrieve current settings from printer driver and store them to system independend data! - ImplFreeFormAndTrayList( this ); - if ( mbDJPSupported ) - ImplGetCurrentSettings( this, pSetupData ); - - return TRUE; - } - else - { - ImplFreePrnMemory( pDrivData ); - return FALSE; - } -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) -{ - // Wir koennen nur Treiberdaten von OS2 setzen - if ( pSetupData->mnSystem != JOBSETUP_SYSTEM_OS2 ) - return FALSE; - - PDRIVDATA pNewDrivData = (PDRIVDATA)(pSetupData->mpDriverData); - if ( !pNewDrivData ) - return FALSE; - - // Testen, ob Printerdaten fuer den gleichen Printer uebergeben werden, - // da einige Treiber zu Abstuerzen neigen, wenn Daten von einem anderen - // Printer gesetzt werden - if ( !maJobSetupDeviceName.Equals( pNewDrivData->szDeviceName )) - return FALSE; - - // update DC and PS - HDC hDC; - HPS hPS; - if ( !ImplSalCreateInfoPrn( this, pNewDrivData, hDC, hPS ) ) - return FALSE; - - // Alten Printer DC/PS zerstoeren - ImplSalDestroyInfoPrn( this ); - - // Neue Daten setzen und initialisieren - mhDC = hDC; - mhPS = hPS; - mpGraphics->mhDC = mhDC; - mpGraphics->mhPS = mhPS; - ImplSalInitGraphics( mpGraphics ); - - // retrieve current settings from printer driver and store them to system independend data! - ImplFreeFormAndTrayList( this ); - if ( mbDJPSupported ) - ImplGetCurrentSettings( this, pSetupData ); - - return TRUE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) -{ - // needs DJP support - if ( !mbDJPSupported ) - return FALSE; - - PDRIVDATA pDrivData = ImplPrnDrivData( pSetupData ); - - if ( !pDrivData ) - return FALSE; - - BOOL bOK = FALSE; - - // set orientation - if ( nFlags & SAL_JOBSET_ORIENTATION ) - { - if ( ImplSetOrientation( mhDC, pDrivData, pSetupData->meOrientation ) ) - bOK = TRUE; - } - - // set paper size - if ( nFlags & SAL_JOBSET_PAPERSIZE ) - { - // Papierformat ermitteln - DJPT_PAPERSIZE nOS2PaperFormat; - switch ( pSetupData->mePaperFormat ) - { - case PAPER_A3: - nOS2PaperFormat = DJP_PSI_A3; - break; - - case PAPER_A4: - nOS2PaperFormat = DJP_PSI_A4; - break; - - case PAPER_A5: - nOS2PaperFormat = DJP_PSI_A5; - break; - - case PAPER_B4: - nOS2PaperFormat = DJP_PSI_B4; - break; - - case PAPER_B5: - nOS2PaperFormat = DJP_PSI_B5; - break; - - case PAPER_LETTER: - nOS2PaperFormat = DJP_PSI_LETTER; - break; - - case PAPER_LEGAL: - nOS2PaperFormat = DJP_PSI_LEGAL; - break; - - case PAPER_TABLOID: - nOS2PaperFormat = DJP_PSI_TABLOID; - break; - - default: - { - nOS2PaperFormat = DJP_PSI_NONE; - // OS2 rechnet in Millimetern - long nPaperWidth = pSetupData->mnPaperWidth / 100; - long nPaperHeight = pSetupData->mnPaperHeight / 100; - // Ansonsten ueber die Papiergroesse suchen - for( int i = 0; i < mnFormCount; i++ ) - { - ImplFormInfo* pFormInfo = mpFormArray[i]; - if ( ImplPaperSizeEqual( nPaperWidth, nPaperHeight, - pFormInfo->mnPaperWidth, pFormInfo->mnPaperHeight ) ) - { - nOS2PaperFormat = pFormInfo->mnId; - break; - } - } - } - break; - } - - if ( nOS2PaperFormat != DJP_PSI_NONE ) - { - if ( ImplSetPaperSize( mhDC, pDrivData, nOS2PaperFormat ) ) - bOK = TRUE; - } - } - - // set paper tray - if ( (nFlags & SAL_JOBSET_PAPERBIN) && (pSetupData->mnPaperBin < mnTrayCount) ) - { - if ( ImplSetPaperBin( mhDC, pDrivData, - mpTrayArray[pSetupData->mnPaperBin] ) ) - bOK = TRUE; - } - - if ( bOK ) - { - ImplUpdateSetupData( pDrivData, pSetupData ); - - // query current driver settings - ImplFreeFormAndTrayList( this ); - if ( ImplGetCurrentSettings( this, pSetupData ) ) - { - // update DC and PS - HDC hDC; - HPS hPS; - if ( ImplSalCreateInfoPrn( this, (PDRIVDATA)(pSetupData->mpDriverData), hDC, hPS ) ) - { - // Alten Printer DC/PS zerstoeren - ImplSalDestroyInfoPrn( this ); - - // Neue Daten setzen und initialisieren - mhDC = hDC; - mhPS = hPS; - mpGraphics->mhDC = mhDC; - mpGraphics->mhPS = mhPS; - ImplSalInitGraphics( mpGraphics ); - } - else - bOK = FALSE; - } - else - bOK = FALSE; - } - - return bOK; -} - -// ----------------------------------------------------------------------- - -ULONG Os2SalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup ) -{ - if ( !mbDJPSupported ) - return 1; - - // init paperbinlist if empty - if ( !mnTrayCount ) - ImplGetFormAndTrayList( this, pJobSetup ); - - // Wir haben immer einen PaperTray und wenn, das eben einen ohne - // Namen - if ( !mnTrayCount ) - return 1; - else - return mnTrayCount; -} - -// ----------------------------------------------------------------------- - -XubString Os2SalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, - ULONG nPaperBin ) -{ - XubString aPaperBinName; - - if ( mbDJPSupported ) - { - // init paperbinlist if empty - if ( !mnTrayCount ) - ImplGetFormAndTrayList( this, pJobSetup ); - - if ( nPaperBin < mnTrayCount ) - aPaperBinName = ::rtl::OStringToOUString (mpTrayArray[nPaperBin]->maDisplayName, gsl_getSystemTextEncoding()); - } - - return aPaperBinName; -} - -// ----------------------------------------------------------------------- - -ULONG Os2SalInfoPrinter::GetCapabilities( const ImplJobSetup*, USHORT nType ) -{ - switch ( nType ) - { - case PRINTER_CAPABILITIES_SUPPORTDIALOG: - return TRUE; - case PRINTER_CAPABILITIES_COPIES: - return 0xFFFF; - case PRINTER_CAPABILITIES_COLLATECOPIES: - return 0; - case PRINTER_CAPABILITIES_SETORIENTATION: - case PRINTER_CAPABILITIES_SETPAPERBIN: - case PRINTER_CAPABILITIES_SETPAPERSIZE: - case PRINTER_CAPABILITIES_SETPAPER: - return mbDJPSupported; - } - - return 0; -} - -// ----------------------------------------------------------------------- - -void Os2SalInfoPrinter::GetPageInfo( const ImplJobSetup*, - long& rOutWidth, long& rOutHeight, - long& rPageOffX, long& rPageOffY, - long& rPageWidth, long& rPageHeight ) -{ - HDC hDC = mhDC; - - // search current form - HCINFO aInfo; - int nForms = DevQueryHardcopyCaps( hDC, 0, 0, &aInfo ); - for( int i = 0; i < nForms; i++ ) - { - if ( DevQueryHardcopyCaps( hDC, i, 1, &aInfo ) >= 0 ) - { - if ( aInfo.flAttributes & HCAPS_CURRENT ) - { - // query resolution - long nXResolution; - long nYResolution; - DevQueryCaps( hDC, CAPS_HORIZONTAL_RESOLUTION, 1, &nXResolution ); - DevQueryCaps( hDC, CAPS_VERTICAL_RESOLUTION, 1, &nYResolution ); - rPageOffX = aInfo.xLeftClip * nXResolution / 1000; - rPageOffY = (aInfo.cy-aInfo.yTopClip) * nYResolution / 1000; - rPageWidth = aInfo.cx * nXResolution / 1000; - rPageHeight = aInfo.cy * nYResolution / 1000; - rOutWidth = aInfo.xPels; - rOutHeight = aInfo.yPels; - return; - } - } - } - - // use device caps if no form selected/found - long lCapsWidth = 0; - long lCapsHeight = 0; - DevQueryCaps( hDC, CAPS_WIDTH, 1L, &lCapsWidth ); - DevQueryCaps( hDC, CAPS_HEIGHT, 1L, &lCapsHeight ); - rPageOffX = 0; - rPageOffY = 0; - rOutWidth = lCapsWidth; - rOutHeight = lCapsHeight; - rPageWidth = rOutWidth; - rPageHeight = rOutHeight; -} - -// ======================================================================= - -static BOOL ImplIsDriverPrintDJPEnabled( HDC hDC ) -{ -#ifdef NO_DJP - return FALSE; -#else - // Ueber OS2-Ini kann DJP disablte werden - if ( !PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_PRINTDJP, 1 ) ) - return FALSE; - - // Testen, ob DJP-Interface am Drucker vorhanden - LONG lQuery; - APIRET rc; - - lQuery = DEVESC_QUERYSIZE; - rc = DevEscape( hDC, - DEVESC_QUERYESCSUPPORT, - sizeof( lQuery ), - (PBYTE)&lQuery, - 0, - (PBYTE)NULL ); - if ( DEV_OK != rc ) - return FALSE; - - return TRUE; -#endif -} - -// ======================================================================= - -SalPrinter* Os2SalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter ) -{ - Os2SalPrinter* pPrinter = new Os2SalPrinter; - pPrinter->mpInfoPrinter = static_cast<Os2SalInfoPrinter*>(pInfoPrinter); - return pPrinter; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DestroyPrinter( SalPrinter* pPrinter ) -{ - delete pPrinter; -} - -// ======================================================================= - -Os2SalPrinter::Os2SalPrinter() -{ - mhDC = 0; - mhPS = 0; - mpGraphics = NULL; - mbAbort = FALSE; - mbPrintDJPSupported = FALSE; -} - -// ----------------------------------------------------------------------- - -Os2SalPrinter::~Os2SalPrinter() -{ -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalPrinter::StartJob( const XubString* pFileName, - const XubString& rJobName, - const XubString& rAppName, - ULONG nCopies, - bool bCollate, - bool bDirect, - ImplJobSetup* pSetupData ) -{ - DEVOPENSTRUC aDevOpenStruc; - LONG lType; - APIRET rc; - - // prepare queue information - memset( &aDevOpenStruc, 0, sizeof( aDevOpenStruc ) ); - aDevOpenStruc.pszDriverName = (PSZ)(mpInfoPrinter->maDriverName.GetBuffer()); - - // print into file? - if ( pFileName ) - { - aDevOpenStruc.pszLogAddress = (PSZ)pFileName->GetBuffer(); - aDevOpenStruc.pszDataType = "PM_Q_RAW"; - lType = OD_DIRECT; - } - else - { - aDevOpenStruc.pszLogAddress = (PSZ)(mpInfoPrinter->maName.GetBuffer()); - if ( PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_PRINTRAW, 0 ) ) - aDevOpenStruc.pszDataType = "PM_Q_RAW"; - else - aDevOpenStruc.pszDataType = "PM_Q_STD"; - lType = OD_QUEUED; - } - -#if 0 // YD FIXME - // Set comment (AppName nur bis zum 1. Space-Zeichen nehmen) - const xub_Unicode* pComment = rAppName; - USHORT nCommentLen = 0; - memset( maCommentBuf, 0, sizeof( maCommentBuf ) ); - while ( (nCommentLen < 32) && - (((*pComment >= 'a') && (*pComment <= 'z')) || - ((*pComment >= 'A') && (*pComment <= 'Z')) || - ((*pComment >= '0') && (*pComment <= '9')) || - (*pComment == '-'))) - { - maCommentBuf[nCommentLen] = (char)(*pComment); - nCommentLen++; - pComment++; - } - aDevOpenStruc.pszComment = (PSZ)maCommentBuf; -#endif - ByteString jobName( rJobName, gsl_getSystemTextEncoding()); - aDevOpenStruc.pszComment = (PSZ)jobName.GetBuffer(); - - // Kopien - if ( nCopies > 1 ) - { - // OS2 kann maximal 999 Kopien - if ( nCopies > 999 ) - nCopies = 999; - sprintf( maCopyBuf, "COP=%d", nCopies); - aDevOpenStruc.pszQueueProcParams = (PSZ)maCopyBuf; - } - - // open device context - SalData* pSalData = GetSalData(); - HAB hAB = pSalData->mhAB; - aDevOpenStruc.pdriv = (PDRIVDATA)pSetupData->mpDriverData; - mhDC = DevOpenDC( hAB, - lType, - "*", - 7, - (PDEVOPENDATA)&aDevOpenStruc, - 0 ); - if ( mhDC == 0 ) - { - ERRORID nLastError = WinGetLastError( hAB ); - if ( (nLastError & 0xFFFF) == PMERR_SPL_PRINT_ABORT ) - mnError = SAL_PRINTER_ERROR_ABORT; - else - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return FALSE; - } - - // open presentation space - SIZEL sizel; - sizel.cx = 0; - sizel.cy = 0; - mhPS = Ft2CreatePS( hAB, mhDC, &sizel, GPIA_ASSOC | GPIT_MICRO | PU_PELS ); - if ( !mhPS ) - { - DevCloseDC( mhDC ); - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return NULL; - } - - // Can we print with DJP - mbPrintDJPSupported = ImplIsDriverPrintDJPEnabled( mhDC ); - - // JobName ermitteln und Job starten - PSZ pszJobName = NULL; - int nJobNameLen = 0; - if ( jobName.Len() > 0 ) - { - pszJobName = (PSZ)jobName.GetBuffer(); - nJobNameLen = jobName.Len(); - } - rc = DevEscape( mhDC, - DEVESC_STARTDOC, - nJobNameLen, (PBYTE)pszJobName, - 0, (PBYTE)NULL ); - - if ( rc != DEV_OK ) - { - ERRORID nLastError = WinGetLastError( hAB ); - if ( (nLastError & 0xFFFF) == PMERR_SPL_PRINT_ABORT ) - mnError = SAL_PRINTER_ERROR_ABORT; - else - mnError = SAL_PRINTER_ERROR_GENERALERROR; - Ft2Associate( mhPS, NULL ); - Ft2DestroyPS( mhPS ); - DevCloseDC( mhDC ); - return FALSE; - } - - // init for first page - mbFirstPage = TRUE; - mnError = 0; - - return TRUE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalPrinter::EndJob() -{ - APIRET rc; - rc = DevEscape( mhDC, - DEVESC_ENDDOC, - 0, NULL, - 0, NULL); - - // destroy presentation space and device context - Ft2Associate( mhPS, NULL ); - Ft2DestroyPS( mhPS ); - DevCloseDC( mhDC ); - return TRUE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalPrinter::AbortJob() -{ - APIRET rc; - - rc = DevEscape( mhDC, - DEVESC_ABORTDOC, - 0, NULL, - 0, NULL ); - - // destroy SalGraphics - if ( mpGraphics ) - { - ImplSalDeInitGraphics( mpGraphics ); - delete mpGraphics; - mpGraphics = NULL; - } - - // destroy presentation space and device context - Ft2Associate( mhPS, NULL ); - Ft2DestroyPS( mhPS ); - DevCloseDC( mhDC ); - return TRUE; -} - -// ----------------------------------------------------------------------- - -SalGraphics* Os2SalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobSetup ) -{ - APIRET rc; - - if ( mbFirstPage ) - mbFirstPage = FALSE; - else - { - PBYTE pJobData; - LONG nJobDataSize; - LONG nEscape; - if ( mbPrintDJPSupported && bNewJobSetup ) - { - nEscape = DEVESC_NEWFRAME_WPROP; - nJobDataSize = ((PDRIVDATA)(pSetupData->mpDriverData))->cb; - pJobData = (PBYTE)(pSetupData->mpDriverData); - } - else - { - nEscape = DEVESC_NEWFRAME; - nJobDataSize = 0; - pJobData = NULL; - } - rc = DevEscape( mhDC, - nEscape, - 0, NULL, - &nJobDataSize, pJobData ); - - if ( rc != DEV_OK ) - { - DevEscape( mhDC, DEVESC_ENDDOC, 0, NULL, 0, NULL); - Ft2Associate( mhPS, NULL ); - Ft2DestroyPS( mhPS ); - DevCloseDC( mhDC ); - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return NULL; - } - } - - // create SalGraphics with copy of hPS - Os2SalGraphics* pGraphics = new Os2SalGraphics; - pGraphics->mhDC = mhDC; - pGraphics->mhPS = mhPS; - pGraphics->mhWnd = 0; - pGraphics->mbPrinter = TRUE; - pGraphics->mbVirDev = FALSE; - pGraphics->mbWindow = FALSE; - pGraphics->mbScreen = FALSE; - pGraphics->mnHeight = 0; - // search current form for actual page height - HCINFO aInfo; - int nForms = DevQueryHardcopyCaps( mhDC, 0, 0, &aInfo ); - for( int i = 0; i < nForms; i++ ) - { - if ( DevQueryHardcopyCaps( mhDC, i, 1, &aInfo ) >= 0 ) - { - if ( aInfo.flAttributes & HCAPS_CURRENT ) - pGraphics->mnHeight = aInfo.yPels; - } - } - // use device caps if no form selected/found - if ( !pGraphics->mnHeight ) - DevQueryCaps( mhDC, CAPS_HEIGHT, 1L, &pGraphics->mnHeight ); - - ImplSalInitGraphics( pGraphics ); - mpGraphics = pGraphics; - - return pGraphics; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalPrinter::EndPage() -{ - if ( mpGraphics ) - { - // destroy SalGraphics - ImplSalDeInitGraphics( mpGraphics ); - delete mpGraphics; - mpGraphics = NULL; - } - - return TRUE; -} - -// ----------------------------------------------------------------------- - -ULONG Os2SalPrinter::GetErrorCode() -{ - return mnError; -} - -void Os2SalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) -{ - printf("Os2SalInfoPrinter::InitPaperFormats\n"); -} -int Os2SalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData ) -{ - printf("Os2SalInfoPrinter::GetLandscapeAngle\n"); - return 0; -} - diff --git a/vcl/os2/source/gdi/salvd.cxx b/vcl/os2/source/gdi/salvd.cxx deleted file mode 100644 index 4e53782be8ea..000000000000 --- a/vcl/os2/source/gdi/salvd.cxx +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> - -#include <svpm.h> - -#define _SV_SALVD_CXX -#include <saldata.hxx> -#include <salinst.h> -#include <salgdi.h> -#include <salvd.h> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -// ======================================================================= - -HBITMAP ImplCreateVirDevBitmap( HDC hDC, HPS hPS, long nDX, long nDY, - USHORT nBitCount ) -{ - if( !nBitCount ) - { - LONG nDevBitCount; - DevQueryCaps( hDC, CAPS_COLOR_BITCOUNT, 1, &nDevBitCount ); - nBitCount = nDevBitCount; - } - - LONG nPlanes; - DevQueryCaps( hDC, CAPS_COLOR_PLANES, 1, &nPlanes ); - - // entsprechende Bitmap zum OutputDevice erzeugen - HBITMAP hBitmap; - BITMAPINFOHEADER2 aBitmapInfo; - memset( &aBitmapInfo, 0, sizeof( BITMAPINFOHEADER2 ) ); - aBitmapInfo.cbFix = sizeof( BITMAPINFOHEADER2 ); - aBitmapInfo.cx = nDX; - aBitmapInfo.cy = nDY; - aBitmapInfo.cPlanes = nPlanes; - aBitmapInfo.cBitCount = (nBitCount < 4) ? 4 : nBitCount; - hBitmap = GpiCreateBitmap( hPS, &aBitmapInfo, 0, NULL, NULL ); - return hBitmap; -} - -// ----------------------------------------------------------------------- - -SalVirtualDevice* Os2SalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, - long nDX, long nDY, - USHORT nBitCount, - const SystemGraphicsData* pData ) -{ - Os2SalGraphics* pGraphics = static_cast<Os2SalGraphics*>(pSGraphics); - HAB hAB = GetSalData()->mhAB; - SIZEL size; - - // create device context (at this time allways display compatible) - DEVOPENSTRUC aDevOpenStruc = { NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - HDC hDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - if ( !hDC ) - return NULL; - - // create presentation space - size.cx = nDX; - size.cy = nDY; - HPS hPS = Ft2CreatePS( hAB, hDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - if ( !hPS ) - { - DevCloseDC( hDC ); - return NULL; - } - - // create bitmap for the virtual device - HBITMAP hBmp = ImplCreateVirDevBitmap( hDC, hPS, nDX, nDY, nBitCount ); - if ( !hBmp ) - { - Ft2DestroyPS( hPS ); - DevCloseDC( hDC ); - return NULL; - } - - // init data - Os2SalVirtualDevice* pVDev = new Os2SalVirtualDevice; - Os2SalGraphics* pVirGraphics = new Os2SalGraphics; - - pVirGraphics->mhDC = hDC; - pVirGraphics->mhPS = hPS; - pVirGraphics->mhWnd = 0; - pVirGraphics->mnHeight = nDY; - pVirGraphics->mbPrinter = FALSE; - pVirGraphics->mbVirDev = TRUE; - pVirGraphics->mbWindow = FALSE; - pVirGraphics->mbScreen = pGraphics->mbScreen; - ImplSalInitGraphics( pVirGraphics ); - - pVDev->mhDC = hDC; - pVDev->mhPS = hPS; - pVDev->mhBmp = hBmp; - pVDev->mhDefBmp = Ft2SetBitmap( hPS, hBmp ); - pVDev->mpGraphics = pVirGraphics; - pVDev->mnBitCount = nBitCount; - pVDev->mbGraphics = FALSE; - return pVDev; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice ) -{ - delete pDevice; -} - -// ======================================================================= - -Os2SalVirtualDevice::Os2SalVirtualDevice() -{ -} - -// ----------------------------------------------------------------------- - -Os2SalVirtualDevice::~Os2SalVirtualDevice() -{ - ImplSalDeInitGraphics( mpGraphics ); - - Ft2SetBitmap( mpGraphics->mhPS, mhDefBmp ); - GpiDeleteBitmap( mhBmp ); - Ft2DestroyPS( mpGraphics->mhPS ); - DevCloseDC( mpGraphics->mhDC ); - delete mpGraphics; -} - -// ----------------------------------------------------------------------- - -SalGraphics* Os2SalVirtualDevice::GetGraphics() -{ - if ( mbGraphics ) - return NULL; - - if ( mpGraphics ) - mbGraphics = TRUE; - - return mpGraphics; -} - -// ----------------------------------------------------------------------- - -void Os2SalVirtualDevice::ReleaseGraphics( SalGraphics* ) -{ - mbGraphics = FALSE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalVirtualDevice::SetSize( long nDX, long nDY ) -{ - HBITMAP hNewBmp = ImplCreateVirDevBitmap( mhDC, - mhPS, nDX, nDY, - mnBitCount ); - if ( hNewBmp ) - { - Ft2SetBitmap( mhPS, hNewBmp ); - GpiDeleteBitmap( mhBmp ); - mhBmp = hNewBmp; - mpGraphics->mnHeight = nDY; - return TRUE; - } - else - return FALSE; -} - -void Os2SalVirtualDevice::GetSize( long& rWidth, long& rHeight ) -{ - DevQueryCaps( mpGraphics->mhDC, CAPS_WIDTH, CAPS_WIDTH, (LONG*)rWidth ); - DevQueryCaps( mpGraphics->mhDC, CAPS_HEIGHT, CAPS_HEIGHT, (LONG*)rHeight ); -} diff --git a/vcl/os2/source/src/airbrush.ptr b/vcl/os2/source/src/airbrush.ptr Binary files differdeleted file mode 100644 index 89a99d763d94..000000000000 --- a/vcl/os2/source/src/airbrush.ptr +++ /dev/null diff --git a/vcl/os2/source/src/ase.ptr b/vcl/os2/source/src/ase.ptr Binary files differdeleted file mode 100755 index 1f6c4e764901..000000000000 --- a/vcl/os2/source/src/ase.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asn.ptr b/vcl/os2/source/src/asn.ptr Binary files differdeleted file mode 100755 index b526c17a83e0..000000000000 --- a/vcl/os2/source/src/asn.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asne.ptr b/vcl/os2/source/src/asne.ptr Binary files differdeleted file mode 100755 index 4ed44679918f..000000000000 --- a/vcl/os2/source/src/asne.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asns.ptr b/vcl/os2/source/src/asns.ptr Binary files differdeleted file mode 100755 index 12395e641b4f..000000000000 --- a/vcl/os2/source/src/asns.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asnswe.ptr b/vcl/os2/source/src/asnswe.ptr Binary files differdeleted file mode 100755 index 46f1f790b474..000000000000 --- a/vcl/os2/source/src/asnswe.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asnw.ptr b/vcl/os2/source/src/asnw.ptr Binary files differdeleted file mode 100755 index d934c3b69a79..000000000000 --- a/vcl/os2/source/src/asnw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/ass.ptr b/vcl/os2/source/src/ass.ptr Binary files differdeleted file mode 100755 index 059ce40126cd..000000000000 --- a/vcl/os2/source/src/ass.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asse.ptr b/vcl/os2/source/src/asse.ptr Binary files differdeleted file mode 100755 index 78a1f7ff5c64..000000000000 --- a/vcl/os2/source/src/asse.ptr +++ /dev/null diff --git a/vcl/os2/source/src/assw.ptr b/vcl/os2/source/src/assw.ptr Binary files differdeleted file mode 100755 index 5adf85360e30..000000000000 --- a/vcl/os2/source/src/assw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asw.ptr b/vcl/os2/source/src/asw.ptr Binary files differdeleted file mode 100755 index 160a775abe22..000000000000 --- a/vcl/os2/source/src/asw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/aswe.ptr b/vcl/os2/source/src/aswe.ptr Binary files differdeleted file mode 100755 index b4e6580c560d..000000000000 --- a/vcl/os2/source/src/aswe.ptr +++ /dev/null diff --git a/vcl/os2/source/src/chain.ptr b/vcl/os2/source/src/chain.ptr Binary files differdeleted file mode 100644 index 0e248b324daa..000000000000 --- a/vcl/os2/source/src/chain.ptr +++ /dev/null diff --git a/vcl/os2/source/src/chainnot.ptr b/vcl/os2/source/src/chainnot.ptr Binary files differdeleted file mode 100644 index 0e248b324daa..000000000000 --- a/vcl/os2/source/src/chainnot.ptr +++ /dev/null diff --git a/vcl/os2/source/src/chart.ptr b/vcl/os2/source/src/chart.ptr Binary files differdeleted file mode 100644 index 66c685d111c7..000000000000 --- a/vcl/os2/source/src/chart.ptr +++ /dev/null diff --git a/vcl/os2/source/src/copydata.ptr b/vcl/os2/source/src/copydata.ptr Binary files differdeleted file mode 100644 index e7e7ccd17e41..000000000000 --- a/vcl/os2/source/src/copydata.ptr +++ /dev/null diff --git a/vcl/os2/source/src/copydlnk.ptr b/vcl/os2/source/src/copydlnk.ptr Binary files differdeleted file mode 100644 index acbf27b3462e..000000000000 --- a/vcl/os2/source/src/copydlnk.ptr +++ /dev/null diff --git a/vcl/os2/source/src/copyf.ptr b/vcl/os2/source/src/copyf.ptr Binary files differdeleted file mode 100644 index 8ebcbded233b..000000000000 --- a/vcl/os2/source/src/copyf.ptr +++ /dev/null diff --git a/vcl/os2/source/src/copyf2.ptr b/vcl/os2/source/src/copyf2.ptr Binary files differdeleted file mode 100644 index dcfa6c089c10..000000000000 --- a/vcl/os2/source/src/copyf2.ptr +++ /dev/null diff --git a/vcl/os2/source/src/copyflnk.ptr b/vcl/os2/source/src/copyflnk.ptr Binary files differdeleted file mode 100644 index 3bd6e9d4706e..000000000000 --- a/vcl/os2/source/src/copyflnk.ptr +++ /dev/null diff --git a/vcl/os2/source/src/crook.ptr b/vcl/os2/source/src/crook.ptr Binary files differdeleted file mode 100644 index 0b639614ddb3..000000000000 --- a/vcl/os2/source/src/crook.ptr +++ /dev/null diff --git a/vcl/os2/source/src/crop.ptr b/vcl/os2/source/src/crop.ptr Binary files differdeleted file mode 100644 index 076e522e1b7f..000000000000 --- a/vcl/os2/source/src/crop.ptr +++ /dev/null diff --git a/vcl/os2/source/src/cross.ptr b/vcl/os2/source/src/cross.ptr Binary files differdeleted file mode 100644 index 1a2cd8dae5f6..000000000000 --- a/vcl/os2/source/src/cross.ptr +++ /dev/null diff --git a/vcl/os2/source/src/darc.ptr b/vcl/os2/source/src/darc.ptr Binary files differdeleted file mode 100644 index eba024e6a09a..000000000000 --- a/vcl/os2/source/src/darc.ptr +++ /dev/null diff --git a/vcl/os2/source/src/data.ptr b/vcl/os2/source/src/data.ptr Binary files differdeleted file mode 100644 index 4c3c9eeb5e7a..000000000000 --- a/vcl/os2/source/src/data.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dbezier.ptr b/vcl/os2/source/src/dbezier.ptr Binary files differdeleted file mode 100644 index 8972b0007c13..000000000000 --- a/vcl/os2/source/src/dbezier.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dcapt.ptr b/vcl/os2/source/src/dcapt.ptr Binary files differdeleted file mode 100644 index b04b21bad1a7..000000000000 --- a/vcl/os2/source/src/dcapt.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dcirccut.ptr b/vcl/os2/source/src/dcirccut.ptr Binary files differdeleted file mode 100644 index 936b337ebcc7..000000000000 --- a/vcl/os2/source/src/dcirccut.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dconnect.ptr b/vcl/os2/source/src/dconnect.ptr Binary files differdeleted file mode 100644 index f8bc2cf454aa..000000000000 --- a/vcl/os2/source/src/dconnect.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dellipse.ptr b/vcl/os2/source/src/dellipse.ptr Binary files differdeleted file mode 100644 index 388bc2f2b00c..000000000000 --- a/vcl/os2/source/src/dellipse.ptr +++ /dev/null diff --git a/vcl/os2/source/src/detectiv.ptr b/vcl/os2/source/src/detectiv.ptr Binary files differdeleted file mode 100644 index 44ca1546a93b..000000000000 --- a/vcl/os2/source/src/detectiv.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dfree.ptr b/vcl/os2/source/src/dfree.ptr Binary files differdeleted file mode 100644 index 52d95d814d98..000000000000 --- a/vcl/os2/source/src/dfree.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dline.ptr b/vcl/os2/source/src/dline.ptr Binary files differdeleted file mode 100644 index e7b80ae56735..000000000000 --- a/vcl/os2/source/src/dline.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dpie.ptr b/vcl/os2/source/src/dpie.ptr Binary files differdeleted file mode 100644 index abd68b899f3a..000000000000 --- a/vcl/os2/source/src/dpie.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dpolygon.ptr b/vcl/os2/source/src/dpolygon.ptr Binary files differdeleted file mode 100644 index 94fa158b4186..000000000000 --- a/vcl/os2/source/src/dpolygon.ptr +++ /dev/null diff --git a/vcl/os2/source/src/drect.ptr b/vcl/os2/source/src/drect.ptr Binary files differdeleted file mode 100644 index 3ec044f267d6..000000000000 --- a/vcl/os2/source/src/drect.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dtext.ptr b/vcl/os2/source/src/dtext.ptr Binary files differdeleted file mode 100644 index 8c221303b0b6..000000000000 --- a/vcl/os2/source/src/dtext.ptr +++ /dev/null diff --git a/vcl/os2/source/src/fill.ptr b/vcl/os2/source/src/fill.ptr Binary files differdeleted file mode 100644 index e7247a6d107b..000000000000 --- a/vcl/os2/source/src/fill.ptr +++ /dev/null diff --git a/vcl/os2/source/src/hand.ptr b/vcl/os2/source/src/hand.ptr Binary files differdeleted file mode 100644 index b1d65c7f19d0..000000000000 --- a/vcl/os2/source/src/hand.ptr +++ /dev/null diff --git a/vcl/os2/source/src/help.ptr b/vcl/os2/source/src/help.ptr Binary files differdeleted file mode 100644 index 3df4d88bddc4..000000000000 --- a/vcl/os2/source/src/help.ptr +++ /dev/null diff --git a/vcl/os2/source/src/hshear.ptr b/vcl/os2/source/src/hshear.ptr Binary files differdeleted file mode 100644 index 76bbebba5865..000000000000 --- a/vcl/os2/source/src/hshear.ptr +++ /dev/null diff --git a/vcl/os2/source/src/hsizebar.ptr b/vcl/os2/source/src/hsizebar.ptr Binary files differdeleted file mode 100644 index 9b78ff9ee9a9..000000000000 --- a/vcl/os2/source/src/hsizebar.ptr +++ /dev/null diff --git a/vcl/os2/source/src/hsplit.ptr b/vcl/os2/source/src/hsplit.ptr Binary files differdeleted file mode 100644 index 62f3b590a414..000000000000 --- a/vcl/os2/source/src/hsplit.ptr +++ /dev/null diff --git a/vcl/os2/source/src/linkdata.ptr b/vcl/os2/source/src/linkdata.ptr Binary files differdeleted file mode 100644 index e5e6ace59be3..000000000000 --- a/vcl/os2/source/src/linkdata.ptr +++ /dev/null diff --git a/vcl/os2/source/src/linkf.ptr b/vcl/os2/source/src/linkf.ptr Binary files differdeleted file mode 100644 index 62bf7e739e32..000000000000 --- a/vcl/os2/source/src/linkf.ptr +++ /dev/null diff --git a/vcl/os2/source/src/magnify.ptr b/vcl/os2/source/src/magnify.ptr Binary files differdeleted file mode 100644 index 1d9a0c149ebd..000000000000 --- a/vcl/os2/source/src/magnify.ptr +++ /dev/null diff --git a/vcl/os2/source/src/makefile.mk b/vcl/os2/source/src/makefile.mk deleted file mode 100644 index 1dba7496be65..000000000000 --- a/vcl/os2/source/src/makefile.mk +++ /dev/null @@ -1,111 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=vcl -TARGET=salsrc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile2.pmk - -# --- Files -------------------------------------------------------- - -RCDEPN= nullptr.ptr \ - help.ptr \ - cross.ptr \ - move.ptr \ - hsplit.ptr \ - vsplit.ptr \ - hsizebar.ptr \ - vsizebar.ptr \ - hand.ptr \ - refhand.ptr \ - pen.ptr \ - magnify.ptr \ - fill.ptr \ - rotate.ptr \ - hshear.ptr \ - vshear.ptr \ - mirror.ptr \ - crook.ptr \ - crop.ptr \ - movept.ptr \ - movebw.ptr \ - movedata.ptr \ - copydata.ptr \ - linkdata.ptr \ - movedlnk.ptr \ - copydlnk.ptr \ - movef.ptr \ - copyf.ptr \ - linkf.ptr \ - moveflnk.ptr \ - copyflnk.ptr \ - movef2.ptr \ - copyf2.ptr \ - dline.ptr \ - drect.ptr \ - dpolygon.ptr \ - dbezier.ptr \ - darc.ptr \ - dpie.ptr \ - dcirccut.ptr \ - dellipse.ptr \ - dfree.ptr \ - dconnect.ptr \ - dtext.ptr \ - dcapt.ptr \ - chart.ptr \ - detectiv.ptr \ - pivotcol.ptr \ - pivotrow.ptr \ - pivotfld.ptr \ - chain.ptr \ - chainnot.ptr \ - timemove.ptr \ - timesize.ptr \ - asn.ptr \ - ass.ptr \ - asw.ptr \ - ase.ptr \ - asnw.ptr \ - asne.ptr \ - assw.ptr \ - asse.ptr \ - asns.ptr \ - aswe.ptr \ - asnswe.ptr \ - sd.ico - -RCFILES= salsrc.rc - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/vcl/os2/source/src/mirror.ptr b/vcl/os2/source/src/mirror.ptr Binary files differdeleted file mode 100644 index 9135331048c9..000000000000 --- a/vcl/os2/source/src/mirror.ptr +++ /dev/null diff --git a/vcl/os2/source/src/move.ptr b/vcl/os2/source/src/move.ptr Binary files differdeleted file mode 100644 index 6b5a11d31219..000000000000 --- a/vcl/os2/source/src/move.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movebw.ptr b/vcl/os2/source/src/movebw.ptr Binary files differdeleted file mode 100644 index e766b885db0a..000000000000 --- a/vcl/os2/source/src/movebw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movedata.ptr b/vcl/os2/source/src/movedata.ptr Binary files differdeleted file mode 100644 index 689f38da772f..000000000000 --- a/vcl/os2/source/src/movedata.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movedlnk.ptr b/vcl/os2/source/src/movedlnk.ptr Binary files differdeleted file mode 100644 index d533e7135ad0..000000000000 --- a/vcl/os2/source/src/movedlnk.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movef.ptr b/vcl/os2/source/src/movef.ptr Binary files differdeleted file mode 100644 index e9fabda359c8..000000000000 --- a/vcl/os2/source/src/movef.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movef2.ptr b/vcl/os2/source/src/movef2.ptr Binary files differdeleted file mode 100644 index 9940890840cb..000000000000 --- a/vcl/os2/source/src/movef2.ptr +++ /dev/null diff --git a/vcl/os2/source/src/moveflnk.ptr b/vcl/os2/source/src/moveflnk.ptr Binary files differdeleted file mode 100644 index d651491ad001..000000000000 --- a/vcl/os2/source/src/moveflnk.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movept.ptr b/vcl/os2/source/src/movept.ptr Binary files differdeleted file mode 100644 index d34332dd89e5..000000000000 --- a/vcl/os2/source/src/movept.ptr +++ /dev/null diff --git a/vcl/os2/source/src/nullptr.ptr b/vcl/os2/source/src/nullptr.ptr Binary files differdeleted file mode 100644 index f8b0f784ba7a..000000000000 --- a/vcl/os2/source/src/nullptr.ptr +++ /dev/null diff --git a/vcl/os2/source/src/pen.ptr b/vcl/os2/source/src/pen.ptr Binary files differdeleted file mode 100644 index 3b4495697597..000000000000 --- a/vcl/os2/source/src/pen.ptr +++ /dev/null diff --git a/vcl/os2/source/src/pivotcol.ptr b/vcl/os2/source/src/pivotcol.ptr Binary files differdeleted file mode 100644 index 369fdeebf2d0..000000000000 --- a/vcl/os2/source/src/pivotcol.ptr +++ /dev/null diff --git a/vcl/os2/source/src/pivotfld.ptr b/vcl/os2/source/src/pivotfld.ptr Binary files differdeleted file mode 100644 index 047c45a711df..000000000000 --- a/vcl/os2/source/src/pivotfld.ptr +++ /dev/null diff --git a/vcl/os2/source/src/pivotrow.ptr b/vcl/os2/source/src/pivotrow.ptr Binary files differdeleted file mode 100644 index e66e752e51d0..000000000000 --- a/vcl/os2/source/src/pivotrow.ptr +++ /dev/null diff --git a/vcl/os2/source/src/pntbrsh.ptr b/vcl/os2/source/src/pntbrsh.ptr Binary files differdeleted file mode 100644 index 506965e6b52d..000000000000 --- a/vcl/os2/source/src/pntbrsh.ptr +++ /dev/null diff --git a/vcl/os2/source/src/refhand.ptr b/vcl/os2/source/src/refhand.ptr Binary files differdeleted file mode 100644 index 33d613134cb5..000000000000 --- a/vcl/os2/source/src/refhand.ptr +++ /dev/null diff --git a/vcl/os2/source/src/rotate.ptr b/vcl/os2/source/src/rotate.ptr Binary files differdeleted file mode 100644 index 622b05346cfc..000000000000 --- a/vcl/os2/source/src/rotate.ptr +++ /dev/null diff --git a/vcl/os2/source/src/salsrc.rc b/vcl/os2/source/src/salsrc.rc deleted file mode 100644 index 6e3b40c76da0..000000000000 --- a/vcl/os2/source/src/salsrc.rc +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALIDS_HRC -#include <salids.hrc> -#endif - -POINTER SAL_RESID_POINTER_NULL NULLPTR.PTR -POINTER SAL_RESID_POINTER_HELP HELP.PTR -POINTER SAL_RESID_POINTER_CROSS CROSS.PTR -POINTER SAL_RESID_POINTER_MOVE MOVE.PTR -POINTER SAL_RESID_POINTER_HSPLIT HSPLIT.PTR -POINTER SAL_RESID_POINTER_VSPLIT VSPLIT.PTR -POINTER SAL_RESID_POINTER_HSIZEBAR HSIZEBAR.PTR -POINTER SAL_RESID_POINTER_VSIZEBAR VSIZEBAR.PTR -POINTER SAL_RESID_POINTER_HAND HAND.PTR -POINTER SAL_RESID_POINTER_REFHAND REFHAND.PTR -POINTER SAL_RESID_POINTER_PEN PEN.PTR -POINTER SAL_RESID_POINTER_MAGNIFY MAGNIFY.PTR -POINTER SAL_RESID_POINTER_FILL FILL.PTR -POINTER SAL_RESID_POINTER_ROTATE ROTATE.PTR -POINTER SAL_RESID_POINTER_HSHEAR HSHEAR.PTR -POINTER SAL_RESID_POINTER_VSHEAR VSHEAR.PTR -POINTER SAL_RESID_POINTER_MIRROR MIRROR.PTR -POINTER SAL_RESID_POINTER_CROOK CROOK.PTR -POINTER SAL_RESID_POINTER_CROP CROP.PTR -POINTER SAL_RESID_POINTER_MOVEPOINT MOVEPT.PTR -POINTER SAL_RESID_POINTER_MOVEBEZIERWEIGHT MOVEBW.PTR -POINTER SAL_RESID_POINTER_MOVEDATA MOVEDATA.PTR -POINTER SAL_RESID_POINTER_COPYDATA COPYDATA.PTR -POINTER SAL_RESID_POINTER_LINKDATA LINKDATA.PTR -POINTER SAL_RESID_POINTER_MOVEDATALINK MOVEDLNK.PTR -POINTER SAL_RESID_POINTER_COPYDATALINK COPYDLNK.PTR -POINTER SAL_RESID_POINTER_MOVEFILE MOVEF.PTR -POINTER SAL_RESID_POINTER_COPYFILE COPYF.PTR -POINTER SAL_RESID_POINTER_LINKFILE LINKF.PTR -POINTER SAL_RESID_POINTER_MOVEFILELINK MOVEFLNK.PTR -POINTER SAL_RESID_POINTER_COPYFILELINK COPYFLNK.PTR -POINTER SAL_RESID_POINTER_MOVEFILES MOVEF2.PTR -POINTER SAL_RESID_POINTER_COPYFILES COPYF2.PTR -POINTER SAL_RESID_POINTER_DRAW_LINE DLINE.PTR -POINTER SAL_RESID_POINTER_DRAW_RECT DRECT.PTR -POINTER SAL_RESID_POINTER_DRAW_POLYGON DPOLYGON.PTR -POINTER SAL_RESID_POINTER_DRAW_BEZIER DBEZIER.PTR -POINTER SAL_RESID_POINTER_DRAW_ARC DARC.PTR -POINTER SAL_RESID_POINTER_DRAW_PIE DPIE.PTR -POINTER SAL_RESID_POINTER_DRAW_CIRCLECUT DCIRCCUT.PTR -POINTER SAL_RESID_POINTER_DRAW_ELLIPSE DELLIPSE.PTR -POINTER SAL_RESID_POINTER_DRAW_FREEHAND DFREE.PTR -POINTER SAL_RESID_POINTER_DRAW_CONNECT DCONNECT.PTR -POINTER SAL_RESID_POINTER_DRAW_TEXT DTEXT.PTR -POINTER SAL_RESID_POINTER_DRAW_CAPTION DCAPT.PTR -POINTER SAL_RESID_POINTER_CHART CHART.PTR -POINTER SAL_RESID_POINTER_DETECTIVE DETECTIV.PTR -POINTER SAL_RESID_POINTER_PIVOT_COL PIVOTCOL.PTR -POINTER SAL_RESID_POINTER_PIVOT_ROW PIVOTROW.PTR -POINTER SAL_RESID_POINTER_PIVOT_FIELD PIVOTFLD.PTR -POINTER SAL_RESID_POINTER_CHAIN CHAIN.PTR -POINTER SAL_RESID_POINTER_CHAIN_NOTALLOWED CHAINNOT.PTR -POINTER SAL_RESID_POINTER_TIMEEVENT_MOVE TIMEMOVE.PTR -POINTER SAL_RESID_POINTER_TIMEEVENT_SIZE TIMESIZE.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_N ASN.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_S ASS.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_W ASW.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_E ASE.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_NW ASNW.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_NE ASNE.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_SW ASSW.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_SE ASSE.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_NS ASNS.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_WE ASWE.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_NSWE ASNSWE.PTR - -POINTER SAL_RESID_POINTER_AIRBRUSH AIRBRUSH.PTR -POINTER SAL_RESID_POINTER_TEXT_VERTICAL VTEXT.PTR -POINTER SAL_RESID_POINTER_TAB_SELECT_S TBLSELS.PTR -POINTER SAL_RESID_POINTER_TAB_SELECT_E TBLSELE.PTR -POINTER SAL_RESID_POINTER_TAB_SELECT_SE TBLSELSE.PTR -POINTER SAL_RESID_POINTER_TAB_SELECT_W TBLSELW.PTR -POINTER SAL_RESID_POINTER_TAB_SELECT_SW TBLSELSW.PTR -POINTER SAL_RESID_POINTER_PAINTBRUSH PNTBRSH.PTR - -ICON SAL_RESID_ICON_DEFAULT SD2.ICO - diff --git a/vcl/os2/source/src/sd.ico b/vcl/os2/source/src/sd.ico Binary files differdeleted file mode 100644 index 22cb33630b85..000000000000 --- a/vcl/os2/source/src/sd.ico +++ /dev/null diff --git a/vcl/os2/source/src/sd2.ico b/vcl/os2/source/src/sd2.ico Binary files differdeleted file mode 100644 index f7edd4524bc1..000000000000 --- a/vcl/os2/source/src/sd2.ico +++ /dev/null diff --git a/vcl/os2/source/src/tblsele.ptr b/vcl/os2/source/src/tblsele.ptr Binary files differdeleted file mode 100644 index 627c2f61662b..000000000000 --- a/vcl/os2/source/src/tblsele.ptr +++ /dev/null diff --git a/vcl/os2/source/src/tblsels.ptr b/vcl/os2/source/src/tblsels.ptr Binary files differdeleted file mode 100644 index 3553c0d1f5ae..000000000000 --- a/vcl/os2/source/src/tblsels.ptr +++ /dev/null diff --git a/vcl/os2/source/src/tblselse.ptr b/vcl/os2/source/src/tblselse.ptr Binary files differdeleted file mode 100644 index 355e5105f58f..000000000000 --- a/vcl/os2/source/src/tblselse.ptr +++ /dev/null diff --git a/vcl/os2/source/src/tblselsw.ptr b/vcl/os2/source/src/tblselsw.ptr Binary files differdeleted file mode 100644 index 435dec00c3e1..000000000000 --- a/vcl/os2/source/src/tblselsw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/tblselw.ptr b/vcl/os2/source/src/tblselw.ptr Binary files differdeleted file mode 100644 index de64ad06d6a2..000000000000 --- a/vcl/os2/source/src/tblselw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/timemove.ptr b/vcl/os2/source/src/timemove.ptr Binary files differdeleted file mode 100755 index a9298cee867b..000000000000 --- a/vcl/os2/source/src/timemove.ptr +++ /dev/null diff --git a/vcl/os2/source/src/timesize.ptr b/vcl/os2/source/src/timesize.ptr Binary files differdeleted file mode 100755 index e543c1ff790c..000000000000 --- a/vcl/os2/source/src/timesize.ptr +++ /dev/null diff --git a/vcl/os2/source/src/vshear.ptr b/vcl/os2/source/src/vshear.ptr Binary files differdeleted file mode 100644 index f335d5ea949b..000000000000 --- a/vcl/os2/source/src/vshear.ptr +++ /dev/null diff --git a/vcl/os2/source/src/vsizebar.ptr b/vcl/os2/source/src/vsizebar.ptr Binary files differdeleted file mode 100644 index b238889c594c..000000000000 --- a/vcl/os2/source/src/vsizebar.ptr +++ /dev/null diff --git a/vcl/os2/source/src/vsplit.ptr b/vcl/os2/source/src/vsplit.ptr Binary files differdeleted file mode 100644 index 662d760b0b2f..000000000000 --- a/vcl/os2/source/src/vsplit.ptr +++ /dev/null diff --git a/vcl/os2/source/src/vtext.ptr b/vcl/os2/source/src/vtext.ptr Binary files differdeleted file mode 100644 index a7f9901bdf68..000000000000 --- a/vcl/os2/source/src/vtext.ptr +++ /dev/null diff --git a/vcl/os2/source/window/makefile b/vcl/os2/source/window/makefile deleted file mode 100644 index e9aba563d9e8..000000000000 --- a/vcl/os2/source/window/makefile +++ /dev/null @@ -1,53 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..\..\.. - -PRJNAME=SV -TARGET=salwin - -# --- Settings ----------------------------------------------------- - -!INCLUDE <svpre.mak> -!INCLUDE <settings.mak> -!INCLUDE <sv.mak> - -!IF "$(COM)"=="ICC" -ENVCFLAGS=$(ENVCFLAGS) -D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE -!ENDIF - -# --- Files -------------------------------------------------------- - -CXXFILES= salframe.cxx \ - salobj.cxx - -SLOFILES= $(SLO)\salframe.obj \ - $(SLO)\salobj.obj - -# --- Targets ------------------------------------------------------ - -!INCLUDE <target.mak> diff --git a/vcl/os2/source/window/makefile.mk b/vcl/os2/source/window/makefile.mk deleted file mode 100644 index 560d35880b21..000000000000 --- a/vcl/os2/source/window/makefile.mk +++ /dev/null @@ -1,47 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=SV -TARGET=salwin - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -CXXFILES__YD= salframe.cxx \ - salobj.cxx - -SLOFILES= $(SLO)$/salframe.obj \ - $(SLO)$/salobj.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx deleted file mode 100644 index f465dc741a60..000000000000 --- a/vcl/os2/source/window/salframe.cxx +++ /dev/null @@ -1,3763 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> - -#define INCL_DOS -#define INCL_PM -#define INCL_WIN -#include <svpm.h> - -// ======================================================================= - -#define _SV_SALFRAME_CXX - -#ifndef DEBUG_HXX -#include <tools/debug.hxx> -#endif - -#define private public - -#ifndef _SV_SALLANG_HXX -#include <sallang.hxx> -#endif -#ifndef _SV_SALIDS_HRC -#include <salids.hrc> -#endif -#include <saldata.hxx> -#include <salinst.h> -#include <salgdi.h> -#include <salframe.h> -#include <vcl/timer.hxx> -#include <vcl/settings.hxx> -#ifndef _SV_KEYCOES_HXX -#include <vcl/keycodes.hxx> -#endif -#include <saltimer.h> - -#if OSL_DEBUG_LEVEL>10 -extern "C" int debug_printf(const char *f, ...); - -static BOOL _bCapture; - -#else -#define debug_printf( ...) { 1; } -#endif - -// ======================================================================= - -HPOINTER ImplLoadPointer( ULONG nId ); - -static void SetMaximizedFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ); -static void UpdateFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ); -static void ImplSalCalcFrameSize( HWND hWnd, - LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ); -static void ImplSalCalcFrameSize( const Os2SalFrame* pFrame, - LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ); -MRESULT EXPENTRY SalFrameSubClassWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ); - -// ======================================================================= - -static LanguageType eImplKeyboardLanguage = LANGUAGE_DONTKNOW; -BOOL Os2SalFrame::mbInReparent = FALSE; -ULONG Os2SalFrame::mnInputLang = 0; - -// ======================================================================= - -// define a new flag -#define SWP_CENTER (SWP_NOAUTOCLOSE<<4) -#define SWP_SHOWMAXIMIZED (SWP_ACTIVATE | SWP_SHOW | SWP_MAXIMIZE) -#define SWP_SHOWMINIMIZED (SWP_ACTIVATE | SWP_SHOW | SWP_MINIMIZE) -#define SWP_SHOWNORMAL (SWP_ACTIVATE | SWP_SHOW | SWP_RESTORE) - -static LONG nScreenHeight = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN); -static LONG nScreenWidth = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); - -BOOL APIENTRY _WinQueryWindowRect( HWND hwnd, PRECTL prclDest) -{ - BOOL rc = WinQueryWindowRect( hwnd, prclDest); - ULONG tmp = prclDest->yBottom; - prclDest->yBottom = prclDest->yTop; - prclDest->yTop = tmp; - return rc; -} - -BOOL APIENTRY _WinQueryPointerPos (HWND hwndDesktop, PPOINTL pptl) -{ - BOOL rc = WinQueryPointerPos( hwndDesktop, pptl); - pptl->y = nScreenHeight - pptl->y; - return rc; -} - -BOOL APIENTRY _WinQueryWindowPos( Os2SalFrame* pFrame, PSWP pswp) -{ - SWP swpOwner; - BOOL rc = WinQueryWindowPos( pFrame->mhWndFrame, pswp); - -#if OSL_DEBUG_LEVEL>1 - debug_printf( "> WinQueryWindowPos hwnd %x at %d,%d (%dx%d)\n", - pFrame->mhWndFrame, pswp->x, pswp->y, pswp->cx, pswp->cy); -#endif - - Os2SalFrame* pParentFrame = pFrame->mpParentFrame; - - //YD adjust to owner coordinates - if ( pParentFrame ) - { - POINTL ptlOwner = {0}; - - // coords are relative to screen, map to parent frame client area - ptlOwner.x = pswp->x; - ptlOwner.y = pswp->y; - WinMapWindowPoints( HWND_DESKTOP, pParentFrame->mhWndClient, &ptlOwner, 1); - pswp->x = ptlOwner.x; - pswp->y = ptlOwner.y; - // get parent client area size - WinQueryWindowPos( pParentFrame->mhWndClient, &swpOwner); - } else - { - // no owner info, use DESKTOP???? - swpOwner.cx = nScreenWidth; - swpOwner.cy = nScreenHeight; - } - - // invert Y coordinate - pswp->y = swpOwner.cy - (pswp->y + pswp->cy); - -#if OSL_DEBUG_LEVEL>1 - debug_printf( "< WinQueryWindowPos hwnd %x at %d,%d (%dx%d)\n", - pFrame->mhWndFrame, pswp->x, pswp->y, pswp->cx, pswp->cy); -#endif - return rc; -} - -BOOL APIENTRY _WinSetWindowPos( Os2SalFrame* pFrame, HWND hwndInsertBehind, LONG x, LONG y, - LONG cx, LONG cy, ULONG fl) -{ - SWP swpOwner = {0}; - POINTL ptlOwner = {0}; - HWND hParent = NULL; - -#if OSL_DEBUG_LEVEL>1 - debug_printf( ">WinSetWindowPos hwnd %x at %d,%d (%dx%d) fl 0x%08x\n", - pFrame->mhWndFrame, x, y, cx, cy, fl); -#endif - - // first resize window if requested - if ( (fl & SWP_SIZE) ) { - ULONG flag = SWP_SIZE; - LONG nX = 0, nY = 0; - LONG frameFrameX, frameFrameY, frameCaptionY; - - ImplSalCalcFrameSize( pFrame, frameFrameX, frameFrameY, frameCaptionY ); - // if we change y size, we need to move the window down - // because os2 window origin is lower left corner - if (pFrame->maGeometry.nHeight != cy) { - SWP aSWP; - WinQueryWindowPos( pFrame->mhWndFrame, &aSWP); - nX = aSWP.x; - nY = aSWP.y - (cy + 2*frameFrameY + frameCaptionY - aSWP.cy); - flag |= SWP_MOVE; - } - WinSetWindowPos( pFrame->mhWndFrame, NULL, nX, nY, - cx+2*frameFrameX, cy+2*frameFrameY+frameCaptionY, flag); - fl = fl & ~SWP_SIZE; - } - else // otherwise get current size - { - SWP swp = {0}; - WinQueryWindowPos( pFrame->mhWndClient, &swp); - cx = swp.cx; - cy = swp.cy; - } - - // get parent window handle - Os2SalFrame* pParentFrame = pFrame->mpParentFrame; - - // use desktop if parent is not defined - hParent = pParentFrame ? pParentFrame->mhWndClient : HWND_DESKTOP; - // if parent is not visible, use desktop as reference - hParent = WinIsWindowVisible( hParent) ? hParent : HWND_DESKTOP; - - WinQueryWindowPos( hParent, &swpOwner); - - //YD adjust to owner coordinates only when moving and not centering - //if (!(fl & SWP_CENTER) && (fl & SWP_MOVE)) - if ((fl & SWP_MOVE)) - { - - // if SWP_CENTER is specified, change position to parent center - if (fl & SWP_CENTER) { - ptlOwner.x = (swpOwner.cx - cx) / 2; - ptlOwner.y = (swpOwner.cy - cy) / 2; -#if OSL_DEBUG_LEVEL>0 - debug_printf( "_WinSetWindowPos SWP_CENTER\n"); -#endif - fl = fl & ~SWP_CENTER; - } else { - // coords are relative to parent frame client area, map to screen - // map Y to OS/2 system coordinates - ptlOwner.x = x; - ptlOwner.y = swpOwner.cy - (y + cy); - -#if OSL_DEBUG_LEVEL>0 - debug_printf( "_WinSetWindowPos owner 0x%x at %d,%d (%dx%d) OS2\n", - hParent, ptlOwner.x, ptlOwner.y, swpOwner.cx, swpOwner.cy); -#endif - } - // map from client area to screen - WinMapWindowPoints( hParent, HWND_DESKTOP, &ptlOwner, 1); - x = ptlOwner.x; - y = ptlOwner.y; - -#if OSL_DEBUG_LEVEL>0 - debug_printf( "_WinSetWindowPos owner 0x%x at %d,%d (%dx%d) MAPPED OS2\n", - hParent, ptlOwner.x, ptlOwner.y, swpOwner.cx, swpOwner.cy); -#endif - } - -#if OSL_DEBUG_LEVEL>0 - debug_printf( "<WinSetWindowPos hwnd %x at %d,%d (%dx%d) fl=%x\n", - pFrame->mhWndFrame, x, y, cx, cy, fl); -#endif - return WinSetWindowPos( pFrame->mhWndFrame, hwndInsertBehind, x, y, 0, 0, fl); -} - -// ======================================================================= - -#if OSL_DEBUG_LEVEL > 0 -static void dumpWindowInfo( char* fnc, HWND hwnd) -{ - SWP aSWP; - HWND hwnd2; - char szTitle[256]; - -#if 0 - _WinQueryWindowPos( hwnd, &aSWP ); - strcpy(szTitle,""); - WinQueryWindowText(hwnd, sizeof(szTitle), szTitle); - debug_printf( "%s: window %08x at %d,%d (size %dx%d) '%s'\n", fnc, hwnd, - aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, szTitle); - hwnd2 = WinQueryWindow(hwnd, QW_PARENT); - _WinQueryWindowPos( hwnd2, &aSWP ); - strcpy(szTitle,""); - WinQueryWindowText(hwnd2, sizeof(szTitle), szTitle); - debug_printf( "%s: parent %08x at %d,%d (size %dx%d) '%s'\n", fnc, hwnd2, - aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, szTitle); - hwnd2 = WinQueryWindow(hwnd, QW_OWNER); - _WinQueryWindowPos( hwnd2, &aSWP ); - strcpy(szTitle,""); - WinQueryWindowText(hwnd2, sizeof(szTitle), szTitle); - debug_printf( "%s: owner %08x at %d,%d (size %dx%d) '%s'\n", fnc, hwnd2, - aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, szTitle); -#endif -} -#endif - -// ======================================================================= - -#ifdef ENABLE_IME - -struct ImplSalIMEProc -{ - ULONG nOrd; - PFN* pProc; -}; - -#define SAL_IME_PROC_COUNT 12 - -// ----------------------------------------------------------------------- - -static SalIMEData* GetSalIMEData() -{ - SalData* pSalData = GetSalData(); - - if ( !pSalData->mbIMEInit ) - { - pSalData->mbIMEInit = TRUE; - - HMODULE hMod = 0; - if ( 0 == DosLoadModule( NULL, 0, "OS2IM", &hMod ) ) - { - SalIMEData* pIMEData = new SalIMEData; - BOOL bError = FALSE; - ImplSalIMEProc aProcAry[SAL_IME_PROC_COUNT] = - { - { 101, (PFN*)&(pIMEData->mpAssocIME) }, - { 104, (PFN*)&(pIMEData->mpGetIME) }, - { 106, (PFN*)&(pIMEData->mpReleaseIME) }, - { 117, (PFN*)&(pIMEData->mpSetConversionFont) }, - { 144, (PFN*)&(pIMEData->mpSetConversionFontSize) }, - { 118, (PFN*)&(pIMEData->mpGetConversionString) }, - { 122, (PFN*)&(pIMEData->mpGetResultString) }, - { 115, (PFN*)&(pIMEData->mpSetCandidateWin) }, - { 130, (PFN*)&(pIMEData->mpQueryIMEProperty) }, - { 131, (PFN*)&(pIMEData->mpRequestIME) }, - { 128, (PFN*)&(pIMEData->mpSetIMEMode) }, - { 127, (PFN*)&(pIMEData->mpQueryIMEMode) } - }; - - pIMEData->mhModIME = hMod; - for ( USHORT i = 0; i < SAL_IME_PROC_COUNT; i++ ) - { - if ( 0 != DosQueryProcAddr( pIMEData->mhModIME, aProcAry[i].nOrd, 0, aProcAry[i].pProc ) ) - { - bError = TRUE; - break; - } - } - - if ( bError ) - { - DosFreeModule( pIMEData->mhModIME ); - delete pIMEData; - } - else - pSalData->mpIMEData = pIMEData; - } - } - - return pSalData->mpIMEData; -} - -// ----------------------------------------------------------------------- - -void ImplReleaseSALIMEData() -{ - SalData* pSalData = GetSalData(); - - if ( pSalData->mpIMEData ) - { - DosFreeModule( pSalData->mpIMEData->mhModIME ); - delete pSalData->mpIMEData; - } -} - -#endif - -// ======================================================================= - -static void ImplSaveFrameState( Os2SalFrame* pFrame ) -{ - // Position, Groesse und Status fuer GetWindowState() merken - if ( !pFrame->mbFullScreen ) - { - SWP aSWP; - BOOL bVisible = WinIsWindowVisible( pFrame->mhWndFrame); - - // Query actual state (maState uses screen coords) - WinQueryWindowPos( pFrame->mhWndFrame, &aSWP ); - - if ( aSWP.fl & SWP_MINIMIZE ) - { -#if OSL_DEBUG_LEVEL>0 - debug_printf("Os2SalFrame::GetWindowState %08x SAL_FRAMESTATE_MINIMIZED\n", - pFrame->mhWndFrame); -#endif - pFrame->maState.mnState |= SAL_FRAMESTATE_MINIMIZED; - if ( bVisible ) - pFrame->mnShowState = SWP_SHOWMAXIMIZED; - } - else if ( aSWP.fl & SWP_MAXIMIZE ) - { -#if OSL_DEBUG_LEVEL>0 - debug_printf("Os2SalFrame::GetWindowState %08x SAL_FRAMESTATE_MAXIMIZED\n", - pFrame->mhWndFrame); -#endif - pFrame->maState.mnState &= ~SAL_FRAMESTATE_MINIMIZED; - pFrame->maState.mnState |= SAL_FRAMESTATE_MAXIMIZED; - if ( bVisible ) - pFrame->mnShowState = SWP_SHOWMINIMIZED; - pFrame->mbRestoreMaximize = TRUE; - } - else - { - LONG nFrameX, nFrameY, nCaptionY; - ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); - // to be consistent with Unix, the frame state is without(!) decoration - long nTopDeco = nFrameY + nCaptionY; - long nLeftDeco = nFrameX; - long nBottomDeco = nFrameY; - long nRightDeco = nFrameX; - - pFrame->maState.mnState &= ~(SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED); - // subtract decoration, store screen coords - pFrame->maState.mnX = aSWP.x+nLeftDeco; - pFrame->maState.mnY = nScreenHeight - (aSWP.y+aSWP.cy)+nTopDeco; - pFrame->maState.mnWidth = aSWP.cx-nLeftDeco-nRightDeco; - pFrame->maState.mnHeight = aSWP.cy-nTopDeco-nBottomDeco; -#if OSL_DEBUG_LEVEL>0 - debug_printf("Os2SalFrame::GetWindowState %08x (%dx%d) at %d,%d VCL\n", - pFrame->mhWndFrame, - pFrame->maState.mnWidth,pFrame->maState.mnHeight,pFrame->maState.mnX,pFrame->maState.mnY); -#endif - if ( bVisible ) - pFrame->mnShowState = SWP_SHOWNORMAL; - pFrame->mbRestoreMaximize = FALSE; - //debug_printf( "ImplSaveFrameState: window %08x at %d,%d (size %dx%d)\n", - // pFrame->mhWndFrame, - // pFrame->maState.mnX, pFrame->maState.mnY, pFrame->maState.mnWidth, pFrame->maState.mnHeight); - } - } -} - -// ----------------------------------------------------------------------- - -long ImplSalCallbackDummy( void*, SalFrame*, USHORT, const void* ) -{ - return 0; -} - -// ----------------------------------------------------------------------- - -static void ImplSalCalcFrameSize( HWND hWnd, - LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ) -{ - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( !pFrame ) - return; - return ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); -} - -static void ImplSalCalcFrameSize( const Os2SalFrame* pFrame, - LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ) -{ - if ( pFrame->mbSizeBorder ) - { - nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXSIZEBORDER ); - nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER ); - } - else if ( pFrame->mbFixBorder ) - { - nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXDLGFRAME ); - nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME ); - } - else if ( pFrame->mbBorder ) - { - nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXBORDER ); - nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYBORDER ); - } - else - { - nFrameX = 0; - nFrameY = 0; - } - if ( pFrame->mbCaption ) - nCaptionY = WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ); - else - nCaptionY = 0; - -#if OSL_DEBUG_LEVEL>0 - //if (_bCapture) - debug_printf("ImplSalCalcFrameSize 0x%08x x=%d y=%d t=%d\n", pFrame->mhWndFrame, nFrameX, nFrameY, nCaptionY); -#endif -} - -// ----------------------------------------------------------------------- - -static void ImplSalCalcFullScreenSize( const Os2SalFrame* pFrame, - LONG& rX, LONG& rY, LONG& rDX, LONG& rDY ) -{ - // set window to screen size - LONG nFrameX, nFrameY, nCaptionY; - LONG rScreenDX = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); - LONG rScreenDY = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ); - - // Framegroessen berechnen - ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); - - rX = -nFrameX; - rY = -(nFrameY+nCaptionY); - rDX = rScreenDX+(nFrameX*2); - rDY = rScreenDY+(nFrameY*2)+nCaptionY; -} - -// ----------------------------------------------------------------------- - -static void ImplSalFrameFullScreenPos( Os2SalFrame* pFrame, BOOL bAlways = FALSE ) -{ - SWP aSWP; - _WinQueryWindowPos( pFrame, &aSWP ); - if ( bAlways || !(aSWP.fl & SWP_MINIMIZE) ) - { - // set window to screen size - LONG nX; - LONG nY; - LONG nWidth; - LONG nHeight; - ImplSalCalcFullScreenSize( pFrame, nX, nY, nWidth, nHeight ); - _WinSetWindowPos( pFrame, 0, - nX, nY, nWidth, nHeight, - SWP_MOVE | SWP_SIZE ); - } -} - -// ----------------------------------------------------------------------- - -// Uebersetzungstabelle von System-Keycodes in StarView-Keycodes -#define KEY_TAB_SIZE (VK_ENDDRAG+1) - -static USHORT aImplTranslateKeyTab[KEY_TAB_SIZE] = -{ - // StarView-Code System-Code Index - 0, // 0x00 - 0, // VK_BUTTON1 0x01 - 0, // VK_BUTTON2 0x02 - 0, // VK_BUTTON3 0x03 - 0, // VK_BREAK 0x04 - KEY_BACKSPACE, // VK_BACKSPACE 0x05 - KEY_TAB, // VK_TAB 0x06 - KEY_TAB, // VK_BACKTAB 0x07 - KEY_RETURN, // VK_NEWLINE 0x08 - 0, // VK_SHIFT 0x09 - 0, // VK_CTRL 0x0A - 0, // VK_ALT 0x0B - 0, // VK_ALTGRAF 0x0C - 0, // VK_PAUSE 0x0D - 0, // VK_CAPSLOCK 0x0E - KEY_ESCAPE, // VK_ESC 0x0F - KEY_SPACE, // VK_SPACE 0x10 - KEY_PAGEUP, // VK_PAGEUP 0x11 - KEY_PAGEDOWN, // VK_PAGEDOWN 0x12 - KEY_END, // VK_END 0x13 - KEY_HOME, // VK_HOME 0x14 - KEY_LEFT, // VK_LEFT 0x15 - KEY_UP, // VK_UP 0x16 - KEY_RIGHT, // VK_RIGHT 0x17 - KEY_DOWN, // VK_DOWN 0x18 - 0, // VK_PRINTSCRN 0x19 - KEY_INSERT, // VK_INSERT 0x1A - KEY_DELETE, // VK_DELETE 0x1B - 0, // VK_SCRLLOCK 0x1C - 0, // VK_NUMLOCK 0x1D - KEY_RETURN, // VK_ENTER 0x1E - 0, // VK_SYSRQ 0x1F - KEY_F1, // VK_F1 0x20 - KEY_F2, // VK_F2 0x21 - KEY_F3, // VK_F3 0x22 - KEY_F4, // VK_F4 0x23 - KEY_F5, // VK_F5 0x24 - KEY_F6, // VK_F6 0x25 - KEY_F7, // VK_F7 0x26 - KEY_F8, // VK_F8 0x27 - KEY_F9, // VK_F9 0x28 - KEY_F10, // VK_F10 0x29 - KEY_F11, // VK_F11 0x2A - KEY_F12, // VK_F12 0x2B - KEY_F13, // VK_F13 0x2C - KEY_F14, // VK_F14 0x2D - KEY_F15, // VK_F15 0x2E - KEY_F16, // VK_F16 0x2F - KEY_F17, // VK_F17 0x30 - KEY_F18, // VK_F18 0x31 - KEY_F19, // VK_F19 0x32 - KEY_F20, // VK_F20 0x33 - KEY_F21, // VK_F21 0x34 - KEY_F22, // VK_F22 0x35 - KEY_F23, // VK_F23 0x36 - KEY_F24, // VK_F24 0x37 - 0 // VK_ENDDRAG 0x38 -}; - -// ======================================================================= - -SalFrame* ImplSalCreateFrame( Os2SalInstance* pInst, HWND hWndParent, ULONG nSalFrameStyle ) -{ - SalData* pSalData = GetSalData(); - Os2SalFrame* pFrame = new Os2SalFrame; - HWND hWndFrame; - HWND hWndClient; - ULONG nFrameFlags = FCF_NOBYTEALIGN | FCF_SCREENALIGN; - ULONG nFrameStyle = 0; - ULONG nClientStyle = WS_CLIPSIBLINGS; - BOOL bSubFrame = FALSE; - -#if OSL_DEBUG_LEVEL>0 - debug_printf(">ImplSalCreateFrame hWndParent 0x%x, nSalFrameStyle 0x%x\n", hWndParent, nSalFrameStyle); -#endif - - if ( hWndParent ) - { - bSubFrame = TRUE; - pFrame->mbNoIcon = TRUE; - } - - // determine creation data (bei Moveable nehmen wir DLG-Border, damit - // es besser aussieht) - if ( nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE ) - nFrameFlags |= FCF_CLOSEBUTTON; - - if ( nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE ) { - pFrame->mbCaption = TRUE; - nFrameStyle = WS_ANIMATE; - nFrameFlags |= FCF_SYSMENU | FCF_TITLEBAR | FCF_DLGBORDER; - if ( !hWndParent ) - nFrameFlags |= FCF_MINBUTTON; - - if ( nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE ) - { - pFrame->mbSizeBorder = TRUE; - nFrameFlags |= FCF_SIZEBORDER; - if ( !hWndParent ) - nFrameFlags |= FCF_MAXBUTTON; - } - else - pFrame->mbFixBorder = TRUE; - - // add task list style if not a tool window - if ( !(nSalFrameStyle & SAL_FRAME_STYLE_TOOLWINDOW) ) { - nFrameFlags |= FCF_TASKLIST; - } - } - - if( nSalFrameStyle & SAL_FRAME_STYLE_TOOLWINDOW ) - { - pFrame->mbNoIcon = TRUE; - // YD gives small caption -> nExSysStyle |= WS_EX_TOOLWINDOW; - } - - if ( nSalFrameStyle & SAL_FRAME_STYLE_FLOAT ) - { - //nExSysStyle |= WS_EX_TOOLWINDOW; - pFrame->mbFloatWin = TRUE; - } - //if( nSalFrameStyle & SAL_FRAME_STYLE_TOOLTIP ) - // nExSysStyle |= WS_EX_TOPMOST; - - // init frame data - pFrame->mnStyle = nSalFrameStyle; - - // determine show style - pFrame->mnShowState = SWP_SHOWNORMAL; - - // create frame - //YD FIXME this is a potential bug with multiple threads and cuncurrent - //window creation, because this field is accessed in - //WM_CREATE to get window data, - pSalData->mpCreateFrame = pFrame; - - //YD FIXME if SAL_FRAME_CHILD is specified, use hWndParent as parent handle... - hWndFrame = WinCreateStdWindow( HWND_DESKTOP, nFrameStyle, &nFrameFlags, - (PSZ)(bSubFrame ? SAL_SUBFRAME_CLASSNAME : SAL_FRAME_CLASSNAME), - NULL, - nClientStyle, 0, 0, &hWndClient ); - debug_printf("ImplSalCreateFrame hWndParent 0x%x, hWndFrame 0x%x, hWndClient 0x%x\n", hWndParent, hWndFrame, hWndClient); - if ( !hWndFrame ) - { - delete pFrame; - return NULL; - } - - // Parent setzen (Owner) - if ( hWndParent != 0 && hWndParent != HWND_DESKTOP ) - WinSetOwner( hWndFrame, hWndParent ); - - Os2SalFrame* pParentFrame = GetWindowPtr( hWndParent ); - if ( pParentFrame ) - pFrame->mpParentFrame = pParentFrame; - - // Icon setzen (YD win32 does it in the class registration) - if ( nFrameFlags & FCF_MINBUTTON ) - WinSendMsg( hWndFrame, WM_SETICON, (MPARAM)pInst->mhAppIcon, (MPARAM)0 ); - - // If we have an Window with an Caption Bar and without - // an MaximizeBox, we change the SystemMenu - if ( (nFrameFlags & (FCF_TITLEBAR | FCF_MAXBUTTON)) == (FCF_TITLEBAR) ) - { - HWND hSysMenu = WinWindowFromID( hWndFrame, FID_SYSMENU ); - if ( hSysMenu ) - { - if ( !(nFrameFlags & (FCF_MINBUTTON | FCF_MAXBUTTON)) ) - WinEnableMenuItem(hSysMenu, SC_RESTORE, FALSE); - if ( !(nFrameFlags & FCF_MINBUTTON) ) - WinEnableMenuItem(hSysMenu, SC_MINIMIZE, FALSE); - if ( !(nFrameFlags & FCF_MAXBUTTON) ) - WinEnableMenuItem(hSysMenu, SC_MAXIMIZE, FALSE); - if ( !(nFrameFlags & FCF_SIZEBORDER) ) - WinEnableMenuItem(hSysMenu, SC_SIZE, FALSE); - } - } - if ( (nFrameFlags & FCF_SYSMENU) && !(nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE) ) - { - HWND hSysMenu = WinWindowFromID( hWndFrame, FID_SYSMENU ); - if ( hSysMenu ) - { - WinEnableMenuItem(hSysMenu, SC_CLOSE, FALSE); - } - } - - // ticket#124 subclass frame window: we need to intercept TRACK message - aSalShlData.mpFrameProc = WinSubclassWindow( hWndFrame, SalFrameSubClassWndProc); - - // init OS/2 frame data - pFrame->mhAB = pInst->mhAB; - - // YD 18/08 under OS/2, invisible frames have size 0,0 at 0,0, so - // we need to set an initial size/position manually - SWP aSWP; - memset( &aSWP, 0, sizeof( aSWP ) ); - WinQueryTaskSizePos( pInst->mhAB, 0, &aSWP ); - WinSetWindowPos( hWndFrame, NULL, aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, - SWP_MOVE | SWP_SIZE); - -#ifdef ENABLE_IME - // Input-Context einstellen - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - pFrame->mhIMEContext = 0; - if ( 0 != pIMEData->mpAssocIME( hWndClient, pFrame->mhIMEContext, &pFrame->mhDefIMEContext ) ) - pFrame->mhDefIMEContext = 0; - } - else - { - pFrame->mhIMEContext = 0; - pFrame->mhDefIMEContext = 0; - } -#endif - - RECTL rectl; - _WinQueryWindowRect( hWndClient, &rectl ); - pFrame->mnWidth = rectl.xRight; - pFrame->mnHeight = rectl.yBottom; - debug_printf( "ImplSalCreateFrame %dx%d\n", pFrame->mnWidth, pFrame->mnHeight); - ImplSaveFrameState( pFrame ); - pFrame->mbDefPos = TRUE; - - UpdateFrameGeometry( hWndFrame, pFrame ); - - if( pFrame->mnShowState == SWP_SHOWMAXIMIZED ) - { - // #96084 set a useful internal window size because - // the window will not be maximized (and the size updated) before show() - SetMaximizedFrameGeometry( hWndFrame, pFrame ); - } - -#if OSL_DEBUG_LEVEL > 1 - dumpWindowInfo( "<ImplSalCreateFrame (exit)", hWndFrame); -#endif - - return pFrame; -} - -// ======================================================================= - -Os2SalFrame::Os2SalFrame() -{ - SalData* pSalData = GetSalData(); - - mbGraphics = NULL; - mhPointer = WinQuerySysPointer( HWND_DESKTOP, SPTR_ARROW, FALSE ); - mpGraphics = NULL; - mpInst = NULL; - mbFullScreen = FALSE; - mbAllwayOnTop = FALSE; - mbVisible = FALSE; - mbMinHide = FALSE; - mbInShow = FALSE; - mbRestoreMaximize = FALSE; - mbInMoveMsg = FALSE; - mbInSizeMsg = FALSE; - mbDefPos = TRUE; - mbOverwriteState = TRUE; - mbHandleIME = FALSE; - mbConversionMode = FALSE; - mbCandidateMode = FALSE; - mbCaption = FALSE; - //mhDefIMEContext = 0; - mpGraphics = NULL; - mnShowState = SWP_SHOWNORMAL; - mnWidth = 0; - mnHeight = 0; - mnMinWidth = 0; - mnMinHeight = 0; - mnMaxWidth = SHRT_MAX; - mnMaxHeight = SHRT_MAX; - mnInputLang = 0; - mnKeyboardHandle = 0; - mbGraphics = FALSE; - mbCaption = FALSE; - mbBorder = FALSE; - mbFixBorder = FALSE; - mbSizeBorder = FALSE; - mbFullScreen = FALSE; - //mbPresentation = FALSE; - mbInShow = FALSE; - mbRestoreMaximize = FALSE; - mbInMoveMsg = FALSE; - mbInSizeMsg = FALSE; - //mbFullScreenToolWin = FALSE; - mbDefPos = TRUE; - mbOverwriteState = TRUE; - //mbIME = FALSE; - mbHandleIME = FALSE; - //mbSpezIME = FALSE; - //mbAtCursorIME = FALSE; - mbCandidateMode = FALSE; - mbFloatWin = FALSE; - mbNoIcon = FALSE; - //mSelectedhMenu = 0; - //mLastActivatedhMenu = 0; - mpParentFrame = NULL; - - memset( &maState, 0, sizeof( SalFrameState ) ); - maSysData.nSize = sizeof( SystemEnvData ); - memset( &maGeometry, 0, sizeof( maGeometry ) ); - - // insert frame in framelist - mpNextFrame = pSalData->mpFirstFrame; - pSalData->mpFirstFrame = this; -} - -// ----------------------------------------------------------------------- - -Os2SalFrame::~Os2SalFrame() -{ - SalData* pSalData = GetSalData(); - - // destroy DC - if ( mpGraphics ) - { - ImplSalDeInitGraphics( mpGraphics ); - WinReleasePS( mpGraphics->mhPS ); - delete mpGraphics; - } - - // destroy system frame - WinDestroyWindow( mhWndFrame ); - - // remove frame from framelist - if ( this == pSalData->mpFirstFrame ) - pSalData->mpFirstFrame = mpNextFrame; - else - { - Os2SalFrame* pTempFrame = pSalData->mpFirstFrame; - while ( pTempFrame->mpNextFrame != this ) - pTempFrame = pTempFrame->mpNextFrame; - - pTempFrame->mpNextFrame = mpNextFrame; - } -} - -// ----------------------------------------------------------------------- - -static HDC ImplWinGetDC( HWND hWnd ) -{ - HDC hDC = WinQueryWindowDC( hWnd ); - if ( !hDC ) - hDC = WinOpenWindowDC( hWnd ); - return hDC; -} - -// ----------------------------------------------------------------------- - -SalGraphics* Os2SalFrame::GetGraphics() -{ - if ( mbGraphics ) - return NULL; - - if ( !mpGraphics ) - { - SalData* pSalData = GetSalData(); - mpGraphics = new Os2SalGraphics; - mpGraphics->mhPS = WinGetPS( mhWndClient ); - mpGraphics->mhDC = ImplWinGetDC( mhWndClient ); - mpGraphics->mhWnd = mhWndClient; - mpGraphics->mnHeight = mnHeight; - mpGraphics->mbPrinter = FALSE; - mpGraphics->mbVirDev = FALSE; - mpGraphics->mbWindow = TRUE; - mpGraphics->mbScreen = TRUE; - ImplSalInitGraphics( mpGraphics ); - mbGraphics = TRUE; - } - else - mbGraphics = TRUE; - - return mpGraphics; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::ReleaseGraphics( SalGraphics* ) -{ - mbGraphics = FALSE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalFrame::PostEvent( void* pData ) -{ - return (BOOL)WinPostMsg( mhWndClient, SAL_MSG_USEREVENT, 0, (MPARAM)pData ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetTitle( const XubString& rTitle ) -{ - // set window title - ByteString title( rTitle, gsl_getSystemTextEncoding() ); - debug_printf("Os2SalFrame::SetTitle %x '%s'\n", mhWndFrame, title.GetBuffer() ); - WinSetWindowText( mhWndFrame, title.GetBuffer() ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetIcon( USHORT nIcon ) -{ - debug_printf("Os2SalFrame::SetIcon\n"); - - // If we have a window without an Icon (for example a dialog), ignore this call - if ( mbNoIcon ) - return; - - // 0 means default (class) icon - HPOINTER hIcon = NULL; - if ( !nIcon ) - nIcon = 1; - - ImplLoadSalIcon( nIcon, hIcon ); - - DBG_ASSERT( hIcon , "Os2SalFrame::SetIcon(): Could not load icon !" ); - - // Icon setzen - WinSendMsg( mhWndFrame, WM_SETICON, (MPARAM)hIcon, (MPARAM)0 ); -} - -// ----------------------------------------------------------------------- - -SalFrame* Os2SalFrame::GetParent() const -{ - //debug_printf("Os2SalFrame::GetParent\n"); - return GetWindowPtr( WinQueryWindow(mhWndFrame, QW_OWNER) ); -} - -// ----------------------------------------------------------------------- - -static void ImplSalShow( HWND hWnd, ULONG bVisible, ULONG bNoActivate ) -{ - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( !pFrame ) - return; - - if ( bVisible ) - { - pFrame->mbDefPos = FALSE; - pFrame->mbOverwriteState = TRUE; - pFrame->mbInShow = TRUE; - -#if OSL_DEBUG_LEVEL > 0 - debug_printf( "ImplSalShow hwnd %x visible flag %d, no activate: flag %d\n", hWnd, bVisible, bNoActivate); -#endif - - if( bNoActivate ) - WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_SHOW); - else - WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, pFrame->mnShowState); - - pFrame->mbInShow = FALSE; - - // Direct Paint only, if we get the SolarMutx - if ( ImplSalYieldMutexTryToAcquire() ) - { - WinUpdateWindow( hWnd ); - ImplSalYieldMutexRelease(); - } - } - else - { -#if OSL_DEBUG_LEVEL > 0 - debug_printf( "ImplSalShow hwnd %x HIDE\n"); -#endif - WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_HIDE); - } -} - - -// ----------------------------------------------------------------------- - - -void Os2SalFrame::SetExtendedFrameStyle( SalExtStyle nExtStyle ) -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) -{ - // Post this Message to the window, because this only works - // in the thread of the window, which has create this window. - // We post this message to avoid deadlocks - if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() ) - WinPostMsg( mhWndFrame, SAL_MSG_SHOW, (MPARAM)bVisible, (MPARAM)bNoActivate ); - else - ImplSalShow( mhWndFrame, bVisible, bNoActivate ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::Enable( BOOL bEnable ) -{ - WinEnableWindow( mhWndFrame, bEnable ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetMinClientSize( long nWidth, long nHeight ) -{ - debug_printf("Os2SalFrame::SetMinClientSize\n"); - mnMinWidth = nWidth; - mnMinHeight = nHeight; -} - -void Os2SalFrame::SetMaxClientSize( long nWidth, long nHeight ) -{ - debug_printf("Os2SalFrame::SetMaxClientSize\n"); - mnMaxWidth = nWidth; - mnMaxHeight = nHeight; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, - USHORT nFlags ) -{ - // calculation frame size - USHORT nEvent = 0; - ULONG nPosFlags = 0; - -#if OSL_DEBUG_LEVEL > 0 - //dumpWindowInfo( "-Os2SalFrame::SetPosSize", mhWndFrame); - debug_printf( ">Os2SalFrame::SetPosSize go to %d,%d (%dx%d) VCL\n",nX,nY,nWidth,nHeight); -#endif - - SWP aSWP; - _WinQueryWindowPos( this, &aSWP ); - BOOL bVisible = WinIsWindowVisible( mhWndFrame ); - if ( !bVisible ) - { - if ( mbFloatWin ) - mnShowState = SWP_SHOW; - else - mnShowState = SWP_SHOWNORMAL; - } - else - { - if ( (aSWP.fl & SWP_MINIMIZE) || (aSWP.fl & SWP_MAXIMIZE) ) - WinSetWindowPos(mhWndFrame, NULL, 0, 0, 0, 0, SWP_RESTORE ); - } - - if ( (nFlags & (SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y)) ) { - nPosFlags |= SWP_MOVE; -#if OSL_DEBUG_LEVEL > 0 - debug_printf( "-Os2SalFrame::SetPosSize MOVE to %d,%d\n", nX, nY); -#endif - //DBG_ASSERT( nX && nY, " Windowposition of (0,0) requested!" ); - nEvent = SALEVENT_MOVE; - } - - if ( (nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT)) ) { - nPosFlags |= SWP_SIZE; -#if OSL_DEBUG_LEVEL > 0 - debug_printf( "-Os2SalFrame::SetPosSize SIZE to %d,%d\n", nWidth,nHeight); -#endif - nEvent = (nEvent == SALEVENT_MOVE) ? SALEVENT_MOVERESIZE : SALEVENT_RESIZE; - } - - // Default-Position, dann zentrieren, ansonsten Position beibehalten - if ( mbDefPos && !(nPosFlags & SWP_MOVE)) - { - // calculate bottom left corner of frame - mbDefPos = FALSE; - nPosFlags |= SWP_MOVE | SWP_CENTER; - nEvent = SALEVENT_MOVERESIZE; -#if OSL_DEBUG_LEVEL > 10 - debug_printf( "-Os2SalFrame::SetPosSize CENTER\n"); - debug_printf( "-Os2SalFrame::SetPosSize default position to %d,%d\n", nX, nY); -#endif - } - - // Adjust Window in the screen - BOOL bCheckOffScreen = TRUE; - - // but don't do this for floaters or ownerdraw windows that are currently moved interactively - if( (mnStyle & SAL_FRAME_STYLE_FLOAT) && !(mnStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) - bCheckOffScreen = FALSE; - - if( mnStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION ) - { - // may be the window is currently being moved (mouse is captured), then no check is required - if( mhWndClient == WinQueryCapture( HWND_DESKTOP) ) - bCheckOffScreen = FALSE; - else - bCheckOffScreen = TRUE; - } - - if( bCheckOffScreen ) - { - if ( nX+nWidth > nScreenWidth ) - nX = nScreenWidth - nWidth; - if ( nY+nHeight > nScreenHeight ) - nY = nScreenHeight - nHeight; - if ( nX < 0 ) - nX = 0; - if ( nY < 0 ) - nY = 0; - } - - // bring floating windows always to top - // do not change zorder, otherwise tooltips will bring main window to top (ticket:14) - //if( (mnStyle & SAL_FRAME_STYLE_FLOAT) ) - // nPosFlags |= SWP_ZORDER; // do not change z-order - - // set new position - _WinSetWindowPos( this, HWND_TOP, nX, nY, nWidth, nHeight, nPosFlags); // | SWP_RESTORE - - UpdateFrameGeometry( mhWndFrame, this ); - - // Notification -- really ??? - if( nEvent ) - CallCallback( nEvent, NULL ); - -#if OSL_DEBUG_LEVEL > 0 - dumpWindowInfo( "<Os2SalFrame::SetPosSize (exit)", mhWndFrame); -#endif - -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetParent( SalFrame* pNewParent ) -{ - APIRET rc; -#if OSL_DEBUG_LEVEL>0 - debug_printf("Os2SalFrame::SetParent mhWndFrame 0x%08x to 0x%08x\n", - static_cast<Os2SalFrame*>(this)->mhWndFrame, - static_cast<Os2SalFrame*>(pNewParent)->mhWndClient); -#endif - Os2SalFrame::mbInReparent = TRUE; - //rc = WinSetParent(static_cast<Os2SalFrame*>(this)->mhWndFrame, - // static_cast<Os2SalFrame*>(pNewParent)->mhWndClient, TRUE); - rc = WinSetOwner(static_cast<Os2SalFrame*>(this)->mhWndFrame, - static_cast<Os2SalFrame*>(pNewParent)->mhWndClient); - mpParentFrame = static_cast<Os2SalFrame*>(pNewParent); - Os2SalFrame::mbInReparent = FALSE; -} - -bool Os2SalFrame::SetPluginParent( SystemParentData* pNewParent ) -{ - APIRET rc; - if ( pNewParent->hWnd == 0 ) - { - pNewParent->hWnd = HWND_DESKTOP; - } - - Os2SalFrame::mbInReparent = TRUE; - rc = WinSetOwner(static_cast<Os2SalFrame*>(this)->mhWndFrame, - pNewParent->hWnd); - Os2SalFrame::mbInReparent = FALSE; - return true; -} - - -// ----------------------------------------------------------------------- - -void Os2SalFrame::GetWorkArea( RECTL &rRect ) -{ - rRect.xLeft = rRect.yTop = 0; - rRect.xRight = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN )-1; - rRect.yBottom = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN )-1; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::GetWorkArea( Rectangle &rRect ) -{ - RECTL aRect; - GetWorkArea( aRect); - rRect.nLeft = aRect.xLeft; - rRect.nRight = aRect.xRight; // win -1; - rRect.nTop = aRect.yTop; - rRect.nBottom = aRect.yBottom; // win -1; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::GetClientSize( long& rWidth, long& rHeight ) -{ - rWidth = maGeometry.nWidth; - rHeight = maGeometry.nHeight; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetWindowState( const SalFrameState* pState ) -{ - LONG nX; - LONG nY; - LONG nWidth; - LONG nHeight; - ULONG nPosSize = 0; - -#if OSL_DEBUG_LEVEL>0 - debug_printf("Os2SalFrame::SetWindowState\n"); - debug_printf("Os2SalFrame::SetWindowState %08x (%dx%d) at %d,%d VCL\n", - mhWndFrame, - pState->mnWidth,pState->mnHeight,pState->mnX,pState->mnY); -#endif - - BOOL bVisible = WinIsWindowVisible( mhWndFrame ); - - // get screen coordinates - SWP aSWP; - WinQueryWindowPos( mhWndFrame, &aSWP ); - LONG nFrameX, nFrameY, nCaptionY; - ImplSalCalcFrameSize( this, nFrameX, nFrameY, nCaptionY ); - - long nTopDeco = nFrameY + nCaptionY; - long nLeftDeco = nFrameX; - long nBottomDeco = nFrameY; - long nRightDeco = nFrameX; - - // Fenster-Position/Groesse in den Bildschirm einpassen - if ((pState->mnMask & (SAL_FRAMESTATE_MASK_X | SAL_FRAMESTATE_MASK_Y)) ) - nPosSize |= SWP_MOVE; - if ((pState->mnMask & (SAL_FRAMESTATE_MASK_WIDTH | SAL_FRAMESTATE_MASK_HEIGHT)) ) - nPosSize |= SWP_SIZE; - - if ( pState->mnMask & SAL_FRAMESTATE_MASK_X ) - nX = (int)pState->mnX - nLeftDeco; - else - nX = aSWP.x; - - // keep Y inverted since height is still unknown, will invert later - if ( pState->mnMask & SAL_FRAMESTATE_MASK_Y ) - nY = (int)pState->mnY - nTopDeco; - else - nY = nScreenHeight - (aSWP.y+aSWP.cy); - - if ( pState->mnMask & SAL_FRAMESTATE_MASK_WIDTH ) - nWidth = (int)pState->mnWidth + nLeftDeco + nRightDeco; - else - nWidth = aSWP.cx; - if ( pState->mnMask & SAL_FRAMESTATE_MASK_HEIGHT ) - nHeight = (int)pState->mnHeight + nTopDeco + nBottomDeco; - else - nHeight = aSWP.cy; - -#if OSL_DEBUG_LEVEL>0 - debug_printf("Os2SalFrame::SetWindowState (%dx%d) at %d,%d\n", nWidth,nHeight,nX,nY); -#endif - - // Adjust Window in the screen: - // if it does not fit into the screen do nothing, ie default pos/size will be used - // if there is an overlap with the screen border move the window while keeping its size - - //if( nWidth > nScreenWidth || nHeight > nScreenHeight ) - // nPosSize |= (SWP_NOMOVE | SWP_NOSIZE); - - if ( nX+nWidth > nScreenWidth ) - nX = (nScreenWidth) - nWidth; - if ( nY+nHeight > nScreenHeight ) - nY = (nScreenHeight) - nHeight; - if ( nX < 0 ) - nX = 0; - if ( nY < 0 ) - nY = 0; - - // Restore-Position setzen - SWP aPlacement; - WinQueryWindowPos( mhWndFrame, &aPlacement ); - - // Status setzen - bVisible = WinIsWindowVisible( mhWndFrame); - BOOL bUpdateHiddenFramePos = FALSE; - if ( !bVisible ) - { - aPlacement.fl = SWP_HIDE; - - if ( mbOverwriteState ) - { - if ( pState->mnMask & SAL_FRAMESTATE_MASK_STATE ) - { - if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED ) - mnShowState = SWP_SHOWMINIMIZED; - else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED ) - { - mnShowState = SWP_SHOWMAXIMIZED; - bUpdateHiddenFramePos = TRUE; - } - else if ( pState->mnState & SAL_FRAMESTATE_NORMAL ) - mnShowState = SWP_SHOWNORMAL; - } - } - } - else - { - if ( pState->mnMask & SAL_FRAMESTATE_MASK_STATE ) - { - if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED ) - { - //if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED ) - // aPlacement.flags |= WPF_RESTORETOMAXIMIZED; - aPlacement.fl = SWP_SHOWMINIMIZED; - } - else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED ) - aPlacement.fl = SWP_SHOWMAXIMIZED; - else if ( pState->mnState & SAL_FRAMESTATE_NORMAL ) - aPlacement.fl = SWP_RESTORE; - } - } - - // Wenn Fenster nicht minimiert/maximiert ist oder nicht optisch - // umgesetzt werden muss, dann SetWindowPos() benutzen, da - // SetWindowPlacement() die TaskBar mit einrechnet - if ( !(aPlacement.fl & SWP_MINIMIZE) - && !( aPlacement.fl & SWP_MAXIMIZE ) - && (!bVisible || (aPlacement.fl == SWP_RESTORE)) ) - { - if( bUpdateHiddenFramePos ) - { - // #96084 set a useful internal window size because - // the window will not be maximized (and the size updated) before show() - SetMaximizedFrameGeometry( mhWndFrame, this ); - } - else - WinSetWindowPos( mhWndFrame, 0, nX, - nScreenHeight - (nY+nHeight), nWidth, nHeight, nPosSize); - } - else - { - if( (nPosSize & (SWP_MOVE|SWP_SIZE)) ) - { - aPlacement.x = nX; - aPlacement.y = nScreenHeight-(nY+nHeight); - aPlacement.cx = nWidth; - aPlacement.cy = nHeight; - } - WinSetWindowPos( mhWndFrame, 0, aPlacement.x, aPlacement.y, - aPlacement.cx, aPlacement.cy, aPlacement.fl ); - } - -#if OSL_DEBUG_LEVEL>0 - debug_printf("Os2SalFrame::SetWindowState DONE\n"); -#endif -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalFrame::GetWindowState( SalFrameState* pState ) -{ - if ( maState.mnWidth && maState.mnHeight ) - { - *pState = maState; - // #94144# allow Minimize again, should be masked out when read from configuration - // 91625 - Don't save minimize - //if ( !(pState->mnState & SAL_FRAMESTATE_MAXIMIZED) ) - if ( !(pState->mnState & (SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED)) ) - pState->mnState |= SAL_FRAMESTATE_NORMAL; - return TRUE; - } - - return FALSE; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetScreenNumber( unsigned int nNewScreen ) -{ -#if 0 - WinSalSystem* pSys = static_cast<WinSalSystem*>(ImplGetSalSystem()); - if( pSys ) - { - const std::vector<WinSalSystem::DisplayMonitor>& rMonitors = - pSys->getMonitors(); - size_t nMon = rMonitors.size(); - if( nNewScreen < nMon ) - { - Point aOldMonPos, aNewMonPos( rMonitors[nNewScreen].m_aArea.TopLeft() ); - Point aCurPos( maGeometry.nX, maGeometry.nY ); - for( size_t i = 0; i < nMon; i++ ) - { - if( rMonitors[i].m_aArea.IsInside( aCurPos ) ) - { - aOldMonPos = rMonitors[i].m_aArea.TopLeft(); - break; - } - } - mnDisplay = nNewScreen; - maGeometry.nScreenNumber = nNewScreen; - SetPosSize( aNewMonPos.X() + (maGeometry.nX - aOldMonPos.X()), - aNewMonPos.Y() + (maGeometry.nY - aOldMonPos.Y()), - 0, 0, - SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ); - } - } -#endif -} - -// ----------------------------------------------------------------------- - -// native menu implementation - currently empty -void Os2SalFrame::DrawMenuBar() -{ -} - -void Os2SalFrame::SetMenu( SalMenu* pSalMenu ) -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) -{ - if ( mbFullScreen == bFullScreen ) - return; - - mbFullScreen = bFullScreen; - if ( bFullScreen ) - { - // save old position - memset( &maFullScreenRect, 0, sizeof( SWP ) ); - _WinQueryWindowPos( this, &maFullScreenRect ); - - // set window to screen size - ImplSalFrameFullScreenPos( this, TRUE ); - } - else - { - _WinSetWindowPos( this, - 0, - maFullScreenRect.x, maFullScreenRect.y, - maFullScreenRect.cx, maFullScreenRect.cy, - SWP_MOVE | SWP_SIZE ); - } -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::StartPresentation( BOOL bStart ) -{ - // SysSetObjectData("<WP_DESKTOP>","Autolockup=no"); oder OS2.INI: PM_Lockup -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetAlwaysOnTop( BOOL bOnTop ) -{ - mbAllwayOnTop = bOnTop; -#if 0 - HWND hWnd; - if ( bOnTop ) - hWnd = HWND_TOPMOST; - else - hWnd = HWND_NOTOPMOST; - SetWindowPos( mhWnd, hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE ); -#endif -} - - -// ----------------------------------------------------------------------- - -static void ImplSalToTop( HWND hWnd, ULONG nFlags ) -{ - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); -#if OSL_DEBUG_LEVEL>0 - debug_printf("ImplSalToTop hWnd %08x, nFlags %x\n", hWnd, nFlags); -#endif - - // if window is minimized, first restore it - SWP aSWP; - WinQueryWindowPos( hWnd, &aSWP ); - if ( aSWP.fl & SWP_MINIMIZE ) - WinSetWindowPos( hWnd, NULL, 0, 0, 0, 0, SWP_RESTORE ); - - if ( nFlags & SAL_FRAME_TOTOP_FOREGROUNDTASK ) - WinSetWindowPos( pFrame->mhWndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER); - - if ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN ) - { - ULONG nStyle; - if ( pFrame->mbRestoreMaximize ) - nStyle = SWP_MAXIMIZE; - else - nStyle = SWP_RESTORE; - - WinSetWindowPos( pFrame->mhWndFrame, NULL, 0, 0, 0, 0, nStyle ); - } - WinSetFocus( HWND_DESKTOP, pFrame->mhWndClient ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::ToTop( USHORT nFlags ) -{ - nFlags &= ~SAL_FRAME_TOTOP_GRABFOCUS; // this flag is not needed on win32 - // Post this Message to the window, because this only works - // in the thread of the window, which has create this window. - // We post this message to avoid deadlocks - if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() ) - WinPostMsg( mhWndFrame, SAL_MSG_TOTOP, (MPARAM)nFlags, 0 ); - else - ImplSalToTop( mhWndFrame, nFlags ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetPointer( PointerStyle ePointerStyle ) -{ - struct ImplPtrData - { - HPOINTER mhPointer; - ULONG mnSysId; - ULONG mnOwnId; - }; - - static ImplPtrData aImplPtrTab[POINTER_COUNT] = - { - { 0, SPTR_ARROW, 0 }, // POINTER_ARROW - { 0, 0, SAL_RESID_POINTER_NULL }, // POINTER_NULL - { 0, SPTR_WAIT, 0 }, // POINTER_WAIT - { 0, SPTR_TEXT, 0 }, // POINTER_BEAM - { 0, 0, SAL_RESID_POINTER_HELP }, // POINTER_HELP - { 0, 0, SAL_RESID_POINTER_CROSS }, // POINTER_CROSS - { 0, 0, SAL_RESID_POINTER_MOVE }, // POINTER_MOVE - { 0, SPTR_SIZENS, 0 }, // POINTER_NSIZE - { 0, SPTR_SIZENS, 0 }, // POINTER_SSIZE - { 0, SPTR_SIZEWE, 0 }, // POINTER_WSIZE - { 0, SPTR_SIZEWE, 0 }, // POINTER_ESIZE - { 0, SPTR_SIZENWSE, 0 }, // POINTER_NWSIZE - { 0, SPTR_SIZENESW, 0 }, // POINTER_NESIZE - { 0, SPTR_SIZENESW, 0 }, // POINTER_SWSIZE - { 0, SPTR_SIZENWSE, 0 }, // POINTER_SESIZE - { 0, SPTR_SIZENS, 0 }, // POINTER_WINDOW_NSIZE - { 0, SPTR_SIZENS, 0 }, // POINTER_WINDOW_SSIZE - { 0, SPTR_SIZEWE, 0 }, // POINTER_WINDOW_WSIZE - { 0, SPTR_SIZEWE, 0 }, // POINTER_WINDOW_ESIZE - { 0, SPTR_SIZENWSE, 0 }, // POINTER_WINDOW_NWSIZE - { 0, SPTR_SIZENESW, 0 }, // POINTER_WINDOW_NESIZE - { 0, SPTR_SIZENESW, 0 }, // POINTER_WINDOW_SWSIZE - { 0, SPTR_SIZENWSE, 0 }, // POINTER_WINDOW_SESIZE - { 0, 0, SAL_RESID_POINTER_HSPLIT }, // POINTER_HSPLIT - { 0, 0, SAL_RESID_POINTER_VSPLIT }, // POINTER_VSPLIT - { 0, 0, SAL_RESID_POINTER_HSIZEBAR }, // POINTER_HSIZEBAR - { 0, 0, SAL_RESID_POINTER_VSIZEBAR }, // POINTER_VSIZEBAR - { 0, 0, SAL_RESID_POINTER_HAND }, // POINTER_HAND - { 0, 0, SAL_RESID_POINTER_REFHAND }, // POINTER_REFHAND - { 0, 0, SAL_RESID_POINTER_PEN }, // POINTER_PEN - { 0, 0, SAL_RESID_POINTER_MAGNIFY }, // POINTER_MAGNIFY - { 0, 0, SAL_RESID_POINTER_FILL }, // POINTER_FILL - { 0, 0, SAL_RESID_POINTER_ROTATE }, // POINTER_ROTATE - { 0, 0, SAL_RESID_POINTER_HSHEAR }, // POINTER_HSHEAR - { 0, 0, SAL_RESID_POINTER_VSHEAR }, // POINTER_VSHEAR - { 0, 0, SAL_RESID_POINTER_MIRROR }, // POINTER_MIRROR - { 0, 0, SAL_RESID_POINTER_CROOK }, // POINTER_CROOK - { 0, 0, SAL_RESID_POINTER_CROP }, // POINTER_CROP - { 0, 0, SAL_RESID_POINTER_MOVEPOINT }, // POINTER_MOVEPOINT - { 0, 0, SAL_RESID_POINTER_MOVEBEZIERWEIGHT }, // POINTER_MOVEBEZIERWEIGHT - { 0, 0, SAL_RESID_POINTER_MOVEDATA }, // POINTER_MOVEDATA - { 0, 0, SAL_RESID_POINTER_COPYDATA }, // POINTER_COPYDATA - { 0, 0, SAL_RESID_POINTER_LINKDATA }, // POINTER_LINKDATA - { 0, 0, SAL_RESID_POINTER_MOVEDATALINK }, // POINTER_MOVEDATALINK - { 0, 0, SAL_RESID_POINTER_COPYDATALINK }, // POINTER_COPYDATALINK - { 0, 0, SAL_RESID_POINTER_MOVEFILE }, // POINTER_MOVEFILE - { 0, 0, SAL_RESID_POINTER_COPYFILE }, // POINTER_COPYFILE - { 0, 0, SAL_RESID_POINTER_LINKFILE }, // POINTER_LINKFILE - { 0, 0, SAL_RESID_POINTER_MOVEFILELINK }, // POINTER_MOVEFILELINK - { 0, 0, SAL_RESID_POINTER_COPYFILELINK }, // POINTER_COPYFILELINK - { 0, 0, SAL_RESID_POINTER_MOVEFILES }, // POINTER_MOVEFILES - { 0, 0, SAL_RESID_POINTER_COPYFILES }, // POINTER_COPYFILES - { 0, SPTR_ILLEGAL, 0 }, // POINTER_NOTALLOWED - { 0, 0, SAL_RESID_POINTER_DRAW_LINE }, // POINTER_DRAW_LINE - { 0, 0, SAL_RESID_POINTER_DRAW_RECT }, // POINTER_DRAW_RECT - { 0, 0, SAL_RESID_POINTER_DRAW_POLYGON }, // POINTER_DRAW_POLYGON - { 0, 0, SAL_RESID_POINTER_DRAW_BEZIER }, // POINTER_DRAW_BEZIER - { 0, 0, SAL_RESID_POINTER_DRAW_ARC }, // POINTER_DRAW_ARC - { 0, 0, SAL_RESID_POINTER_DRAW_PIE }, // POINTER_DRAW_PIE - { 0, 0, SAL_RESID_POINTER_DRAW_CIRCLECUT }, // POINTER_DRAW_CIRCLECUT - { 0, 0, SAL_RESID_POINTER_DRAW_ELLIPSE }, // POINTER_DRAW_ELLIPSE - { 0, 0, SAL_RESID_POINTER_DRAW_FREEHAND }, // POINTER_DRAW_FREEHAND - { 0, 0, SAL_RESID_POINTER_DRAW_CONNECT }, // POINTER_DRAW_CONNECT - { 0, 0, SAL_RESID_POINTER_DRAW_TEXT }, // POINTER_DRAW_TEXT - { 0, 0, SAL_RESID_POINTER_DRAW_CAPTION }, // POINTER_DRAW_CAPTION - { 0, 0, SAL_RESID_POINTER_CHART }, // POINTER_CHART - { 0, 0, SAL_RESID_POINTER_DETECTIVE }, // POINTER_DETECTIVE - { 0, 0, SAL_RESID_POINTER_PIVOT_COL }, // POINTER_PIVOT_COL - { 0, 0, SAL_RESID_POINTER_PIVOT_ROW }, // POINTER_PIVOT_ROW - { 0, 0, SAL_RESID_POINTER_PIVOT_FIELD }, // POINTER_PIVOT_FIELD - { 0, 0, SAL_RESID_POINTER_CHAIN }, // POINTER_CHAIN - { 0, 0, SAL_RESID_POINTER_CHAIN_NOTALLOWED }, // POINTER_CHAIN_NOTALLOWED - { 0, 0, SAL_RESID_POINTER_TIMEEVENT_MOVE }, // POINTER_TIMEEVENT_MOVE - { 0, 0, SAL_RESID_POINTER_TIMEEVENT_SIZE }, // POINTER_TIMEEVENT_SIZE - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_N }, // POINTER_AUTOSCROLL_N - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_S }, // POINTER_AUTOSCROLL_S - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_W }, // POINTER_AUTOSCROLL_W - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_E }, // POINTER_AUTOSCROLL_E - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NW }, // POINTER_AUTOSCROLL_NW - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NE }, // POINTER_AUTOSCROLL_NE - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SW }, // POINTER_AUTOSCROLL_SW - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SE }, // POINTER_AUTOSCROLL_SE - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NS }, // POINTER_AUTOSCROLL_NS - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_WE }, // POINTER_AUTOSCROLL_WE - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NSWE }, // POINTER_AUTOSCROLL_NSWE - { 0, 0, SAL_RESID_POINTER_AIRBRUSH }, // POINTER_AIRBRUSH - { 0, 0, SAL_RESID_POINTER_TEXT_VERTICAL }, // POINTER_TEXT_VERTICAL - { 0, 0, SAL_RESID_POINTER_PIVOT_DELETE }, // POINTER_PIVOT_DELETE - - // --> FME 2004-07-30 #i32329# Enhanced table selection - { 0, 0, SAL_RESID_POINTER_TAB_SELECT_S }, // POINTER_TAB_SELECT_S - { 0, 0, SAL_RESID_POINTER_TAB_SELECT_E }, // POINTER_TAB_SELECT_E - { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SE }, // POINTER_TAB_SELECT_SE - { 0, 0, SAL_RESID_POINTER_TAB_SELECT_W }, // POINTER_TAB_SELECT_W - { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SW }, // POINTER_TAB_SELECT_SW - // <-- - - // --> FME 2004-08-16 #i20119# Paintbrush tool - { 0, 0, SAL_RESID_POINTER_PAINTBRUSH } // POINTER_PAINTBRUSH - // <-- - }; - -#if POINTER_COUNT != 94 -#error New Pointer must be defined! -#endif - - //debug_printf("Os2SalFrame::SetPointer\n"); - - // Mousepointer loaded ? - if ( !aImplPtrTab[ePointerStyle].mhPointer ) - { - if ( aImplPtrTab[ePointerStyle].mnOwnId ) - aImplPtrTab[ePointerStyle].mhPointer = ImplLoadSalCursor( (ULONG)aImplPtrTab[ePointerStyle].mnOwnId ); - else - aImplPtrTab[ePointerStyle].mhPointer = WinQuerySysPointer( HWND_DESKTOP, aImplPtrTab[ePointerStyle].mnSysId, FALSE ); - } - if (aImplPtrTab[ePointerStyle].mhPointer == 0) { - debug_printf( "SetPointer ePointerStyle %d unknown\n", ePointerStyle); - aImplPtrTab[ePointerStyle].mhPointer = SPTR_ICONERROR; - } - - // Unterscheidet sich der Mauspointer, dann den neuen setzen - if ( mhPointer != aImplPtrTab[ePointerStyle].mhPointer ) - { - mhPointer = aImplPtrTab[ePointerStyle].mhPointer; - WinSetPointer( HWND_DESKTOP, mhPointer ); - } -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::CaptureMouse( BOOL bCapture ) -{ -#if OSL_DEBUG_LEVEL>10 - _bCapture=bCapture; - debug_printf("Os2SalFrame::CaptureMouse bCapture %d\n", bCapture); -#endif - if ( bCapture ) - WinSetCapture( HWND_DESKTOP, mhWndClient ); - else - WinSetCapture( HWND_DESKTOP, 0 ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetPointerPos( long nX, long nY ) -{ - POINTL aPt; - aPt.x = nX; - aPt.y = mnHeight - nY - 1; // convert sal coords to sys - WinMapWindowPoints( mhWndClient, HWND_DESKTOP, &aPt, 1 ); - WinSetPointerPos( HWND_DESKTOP, aPt.x, aPt.y ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::Flush() -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::Sync() -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetInputContext( SalInputContext* pContext ) -{ -#ifdef ENABLE_IME - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - HWND hWnd = mhWndClient; - HIMI hIMI = 0; - pIMEData->mpGetIME( hWnd, &hIMI ); - if ( hIMI ) - { - ULONG nInputMode; - ULONG nConversionMode; - if ( 0 == pIMEData->mpQueryIMEMode( hIMI, &nInputMode, &nConversionMode ) ) - { - if ( pContext->mnOptions & SAL_INPUTCONTEXT_TEXT ) - { - nInputMode &= ~IMI_IM_IME_DISABLE; - if ( pContext->mnOptions & SAL_INPUTCONTEXT_EXTTEXTINPUT_OFF ) - nInputMode &= ~IMI_IM_IME_ON; -// !!! Da derzeit ueber das OS2-IME-UI der IME-Mode nicht einschaltbar ist !!! -// if ( SAL_INPUTCONTEXT_EXTTEXTINPUT_ON ) - nInputMode |= IMI_IM_IME_ON; - } - else - nInputMode |= IMI_IM_IME_DISABLE; - pIMEData->mpSetIMEMode( hIMI, nInputMode, nConversionMode ); - } - - pIMEData->mpReleaseIME( hWnd, hIMI ); - } - } -#endif -} - -// ----------------------------------------------------------------------- -#if 0 -void Os2SalFrame::UpdateExtTextInputArea() -{ -#ifdef ENABLE_IME -#endif -} -#endif - -// ----------------------------------------------------------------------- - -void Os2SalFrame::EndExtTextInput( USHORT nFlags ) -{ -#ifdef ENABLE_IME - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - HWND hWnd = mhWndClient; - HIMI hIMI = 0; - pIMEData->mpGetIME( hWnd, &hIMI ); - if ( hIMI ) - { - ULONG nIndex; - if ( nFlags & SAL_FRAME_ENDEXTTEXTINPUT_COMPLETE ) - nIndex = CNV_COMPLETE; - else - nIndex = CNV_CANCEL; - - pIMEData->mpRequestIME( hIMI, REQ_CONVERSIONSTRING, nIndex, 0 ); - pIMEData->mpReleaseIME( hWnd, hIMI ); - } - } -#endif -} - -// ----------------------------------------------------------------------- - -XubString Os2SalFrame::GetKeyName( USHORT nCode ) -{ - if ( eImplKeyboardLanguage == LANGUAGE_DONTKNOW ) - eImplKeyboardLanguage = MsLangId::getSystemLanguage(); - - XubString aKeyCode; - XubString aCode; - const sal_Unicode** pLangTab = ImplGetLangTab( eImplKeyboardLanguage ); - - if ( nCode & KEY_SHIFT ) - aKeyCode = pLangTab[LSTR_KEY_SHIFT]; - - if ( nCode & KEY_MOD1 ) - { - if ( aKeyCode.Len() == 0 ) - aKeyCode = pLangTab[LSTR_KEY_CTRL]; - else - { - aKeyCode += '+'; - aKeyCode += pLangTab[LSTR_KEY_CTRL]; - } - } - - if ( nCode & KEY_MOD2 ) - { - if ( aKeyCode.Len() == 0 ) - aKeyCode = pLangTab[LSTR_KEY_ALT]; - else - { - aKeyCode += '+'; - aKeyCode += pLangTab[LSTR_KEY_ALT]; - } - } - - USHORT nKeyCode = nCode & 0x0FFF; - if ( (nKeyCode >= KEY_0) && (nKeyCode <= KEY_9) ) - aCode = sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_0)); - else if ( (nKeyCode >= KEY_A) && (nKeyCode <= KEY_Z) ) - aCode = sal::static_int_cast<sal_Char>('A' + (nKeyCode - KEY_A)); - else if ( (nKeyCode >= KEY_F1) && (nKeyCode <= KEY_F26) ) - { - aCode += 'F'; - if ( (nKeyCode >= KEY_F1) && (nKeyCode <= KEY_F9) ) - { - aCode += sal::static_int_cast<sal_Char>('1' + (nKeyCode - KEY_F1)); - } - else if ( (nKeyCode >= KEY_F10) && (nKeyCode <= KEY_F19) ) - { - aCode += '1'; - aCode += sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_F10)); - } - else - { - aCode += '2'; - aCode += sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_F20)); - } - } - else - { - switch ( nKeyCode ) - { - case KEY_DOWN: - aCode = pLangTab[LSTR_KEY_DOWN]; - break; - case KEY_UP: - aCode = pLangTab[LSTR_KEY_UP]; - break; - case KEY_LEFT: - aCode = pLangTab[LSTR_KEY_LEFT]; - break; - case KEY_RIGHT: - aCode = pLangTab[LSTR_KEY_RIGHT]; - break; - case KEY_HOME: - aCode = pLangTab[LSTR_KEY_HOME]; - break; - case KEY_END: - aCode = pLangTab[LSTR_KEY_END]; - break; - case KEY_PAGEUP: - aCode = pLangTab[LSTR_KEY_PAGEUP]; - break; - case KEY_PAGEDOWN: - aCode = pLangTab[LSTR_KEY_PAGEDOWN]; - break; - case KEY_RETURN: - aCode = pLangTab[LSTR_KEY_RETURN]; - break; - case KEY_ESCAPE: - aCode = pLangTab[LSTR_KEY_ESC]; - break; - case KEY_TAB: - aCode = pLangTab[LSTR_KEY_TAB]; - break; - case KEY_BACKSPACE: - aCode = pLangTab[LSTR_KEY_BACKSPACE]; - break; - case KEY_SPACE: - aCode = pLangTab[LSTR_KEY_SPACE]; - break; - case KEY_INSERT: - aCode = pLangTab[LSTR_KEY_INSERT]; - break; - case KEY_DELETE: - aCode = pLangTab[LSTR_KEY_DELETE]; - break; - - case KEY_ADD: - aCode += '+'; - break; - case KEY_SUBTRACT: - aCode += '-'; - break; - case KEY_MULTIPLY: - aCode += '*'; - break; - case KEY_DIVIDE: - aCode += '/'; - break; - case KEY_POINT: - aCode += '.'; - break; - case KEY_COMMA: - aCode += ','; - break; - case KEY_LESS: - aCode += '<'; - break; - case KEY_GREATER: - aCode += '>'; - break; - case KEY_EQUAL: - aCode += '='; - break; - } - } - - if ( aCode.Len() ) - { - if ( aKeyCode.Len() == 0 ) - aKeyCode = aCode; - else - { - aKeyCode += '+'; - aKeyCode += aCode; - } - } - - return aKeyCode; -} - -// ----------------------------------------------------------------------- - -XubString Os2SalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode ) -{ - return GetKeyName( nKeyCode ); -} - -// ----------------------------------------------------------------------- - -inline long ImplOS2ColorToSal( long nOS2Color ) -{ - return MAKE_SALCOLOR( (BYTE)( nOS2Color>>16), (BYTE)(nOS2Color>>8), (BYTE)nOS2Color ); -} - -// ----------------------------------------------------------------------- - -static USHORT ImplMouseSysValueToSAL( int iSysValue, USHORT& rCode, USHORT& rClicks, BOOL& rDown ) -{ - LONG lValue = WinQuerySysValue( HWND_DESKTOP, iSysValue ); - - rCode = 0; - rClicks = 1; - rDown = TRUE; - - switch ( lValue & 0xFFFF ) - { - case WM_BUTTON1UP: - case WM_BUTTON1CLICK: - rCode = MOUSE_LEFT; - rDown = FALSE; - break; - case WM_BUTTON1DOWN: - case WM_BUTTON1MOTIONSTART: - rCode = MOUSE_LEFT; - break; - case WM_BUTTON1DBLCLK: - rCode = MOUSE_LEFT; - rClicks = 2; - break; - - case WM_BUTTON2UP: - case WM_BUTTON2CLICK: - rCode = MOUSE_RIGHT; - rDown = FALSE; - break; - case WM_BUTTON2DOWN: - case WM_BUTTON2MOTIONSTART: - rCode = MOUSE_RIGHT; - break; - case WM_BUTTON2DBLCLK: - rCode = MOUSE_RIGHT; - rClicks = 2; - break; - - case WM_BUTTON3UP: - case WM_BUTTON3CLICK: - rCode = MOUSE_MIDDLE; - rDown = FALSE; - break; - case WM_BUTTON3DOWN: - case WM_BUTTON3MOTIONSTART: - rCode = MOUSE_MIDDLE; - break; - case WM_BUTTON3DBLCLK: - rCode = MOUSE_MIDDLE; - rClicks = 2; - break; - } - - if ( !rCode ) - return FALSE; - - lValue = (lValue & 0xFFFF0000) >> 16; - if ( lValue != 0xFFFF ) - { - if ( lValue & KC_SHIFT ) - rCode |= KEY_SHIFT; - if ( lValue & KC_CTRL ) - rCode |= KEY_MOD1; - if ( lValue & KC_ALT ) - rCode |= KEY_MOD2; - } - - return TRUE; -} - -// ----------------------------------------------------------------------- - -static BOOL ImplSalIsSameColor( const Color& rColor1, const Color& rColor2 ) -{ - ULONG nWrong = 0; - nWrong += Abs( (short)rColor1.GetRed()-(short)rColor2.GetRed() ); - nWrong += Abs( (short)rColor1.GetGreen()-(short)rColor2.GetGreen() ); - nWrong += Abs( (short)rColor1.GetBlue()-(short)rColor2.GetBlue() ); - return (nWrong < 30); -} - -// ----------------------------------------------------------------------- - -static BOOL ImplOS2NameFontToVCLFont( const char* pFontName, Font& rFont ) -{ - char aNumBuf[10]; - int nNumBufLen = 0; - - while ( *pFontName && (*pFontName != '.') && - (nNumBufLen < sizeof(aNumBuf)-1) ) - { - aNumBuf[nNumBufLen] = *pFontName; - nNumBufLen++; - pFontName++; - } - aNumBuf[nNumBufLen] = '\0'; - - pFontName++; - while ( *pFontName == ' ' ) - pFontName++; - - int nFontHeight = atoi( aNumBuf ); - int nFontNameLen = strlen( pFontName ); - if ( nFontHeight && nFontNameLen ) - { - rFont.SetFamily( FAMILY_DONTKNOW ); - rFont.SetWeight( WEIGHT_NORMAL ); - rFont.SetItalic( ITALIC_NONE ); - // search for a style embedded in the name, e.g. 'WarpSans Bold' - // because we need to split the style from the family name - if (strstr( pFontName, " Bold") - || strstr( pFontName, " Italic") - || strstr( pFontName, "-Normal")) - { - char* fontName = strdup( pFontName); - char* style = strstr( fontName, " Bold"); - if (style) - rFont.SetWeight( WEIGHT_BOLD ); - - if (!style) - style = strstr( fontName, " Italic"); - if (style) - rFont.SetItalic( ITALIC_NORMAL ); - - if (!style) - style = strstr( fontName, "-Normal"); - // store style, skip whitespace char - rFont.SetStyleName( ::rtl::OStringToOUString ( style+1, gsl_getSystemTextEncoding()) ); - // truncate name - *style = 0; - // store family name - rFont.SetName( ::rtl::OStringToOUString ( fontName, gsl_getSystemTextEncoding()) ); - free( fontName); - } - else - { - rFont.SetName( ::rtl::OStringToOUString (pFontName, gsl_getSystemTextEncoding()) ); - rFont.SetStyleName( ::rtl::OStringToOUString ("", gsl_getSystemTextEncoding()) ); - } - - rFont.SetSize( Size( 0, nFontHeight ) ); - return TRUE; - } - else - return FALSE; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::UpdateSettings( AllSettings& rSettings ) -{ - static char aControlPanel[] = "PM_ControlPanel"; - static char aSystemFonts[] = "PM_SystemFonts"; - char aDummyStr[] = ""; - - // --- Mouse setting --- - USHORT nCode; - USHORT nClicks; - BOOL bDown; - MouseSettings aMouseSettings = rSettings.GetMouseSettings(); - aMouseSettings.SetDoubleClickTime( WinQuerySysValue( HWND_DESKTOP, SV_DBLCLKTIME ) ); - if ( ImplMouseSysValueToSAL( SV_BEGINDRAG, nCode, nClicks, bDown ) ) - aMouseSettings.SetStartDragCode( nCode ); - if ( ImplMouseSysValueToSAL( SV_CONTEXTMENU, nCode, nClicks, bDown ) ) - { - aMouseSettings.SetContextMenuCode( nCode ); - aMouseSettings.SetContextMenuClicks( nClicks ); - aMouseSettings.SetContextMenuDown( bDown ); - } - aMouseSettings.SetButtonStartRepeat( WinQuerySysValue( HWND_DESKTOP, SV_FIRSTSCROLLRATE ) ); - aMouseSettings.SetButtonRepeat( WinQuerySysValue( HWND_DESKTOP, SV_SCROLLRATE ) ); - rSettings.SetMouseSettings( aMouseSettings ); - - // --- Style settings --- - StyleSettings aStyleSettings = rSettings.GetStyleSettings(); - // General settings - LONG nDisplayTime = PrfQueryProfileInt( HINI_PROFILE, (PSZ)aControlPanel, (PSZ)"LogoDisplayTime", -1 ); - ULONG nSalDisplayTime; - if ( nDisplayTime < 0 ) - nSalDisplayTime = LOGO_DISPLAYTIME_STARTTIME; - else if ( !nDisplayTime ) - nSalDisplayTime = LOGO_DISPLAYTIME_NOLOGO; - else - nSalDisplayTime = (ULONG)nDisplayTime; - aStyleSettings.SetLogoDisplayTime( nSalDisplayTime ); - - aStyleSettings.SetCursorBlinkTime( WinQuerySysValue( HWND_DESKTOP, SV_CURSORRATE ) ); - ULONG nDragFullOptions = aStyleSettings.GetDragFullOptions(); - if ( WinQuerySysValue( HWND_DESKTOP, SV_DYNAMICDRAG ) ) - nDragFullOptions |= DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT; - else - nDragFullOptions &= ~(DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT); - aStyleSettings.SetDragFullOptions( nDragFullOptions ); - - // Size settings - aStyleSettings.SetScrollBarSize( WinQuerySysValue( HWND_DESKTOP, SV_CYHSCROLL ) ); - aStyleSettings.SetTitleHeight( WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) ); - - // Color settings - aStyleSettings.SetFaceColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); - aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() ); - aStyleSettings.SetLightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0 ) ) ); - aStyleSettings.SetLightBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); - aStyleSettings.SetShadowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONDARK, 0 ) ) ); - aStyleSettings.SetDarkShadowColor( Color( COL_BLACK ) ); - aStyleSettings.SetDialogColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0 ) ) ); - aStyleSettings.SetButtonTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); - aStyleSettings.SetActiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLE, 0 ) ) ); - aStyleSettings.SetActiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLETEXT, 0 ) ) ); - aStyleSettings.SetActiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVEBORDER, 0 ) ) ); - aStyleSettings.SetDeactiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLE, 0 ) ) ); - aStyleSettings.SetDeactiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLETEXT, 0 ) ) ); - aStyleSettings.SetDeactiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVEBORDER, 0 ) ) ); - aStyleSettings.SetMenuColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENU, 0 ) ) ); - aStyleSettings.SetMenuTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); - aStyleSettings.SetMenuBarTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); - aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() ); - aStyleSettings.SetRadioCheckTextColor( aStyleSettings.GetButtonTextColor() ); - aStyleSettings.SetGroupTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOWSTATICTEXT, 0 ) ) ); - aStyleSettings.SetLabelTextColor( aStyleSettings.GetGroupTextColor() ); - aStyleSettings.SetInfoTextColor( aStyleSettings.GetGroupTextColor() ); - aStyleSettings.SetWindowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOW, 0 ) ) ); - aStyleSettings.SetActiveTabColor( aStyleSettings.GetWindowColor() ); - aStyleSettings.SetWindowTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOWTEXT, 0 ) ) ); - aStyleSettings.SetFieldColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ENTRYFIELD, 0 ) ) ); - aStyleSettings.SetFieldTextColor( aStyleSettings.GetWindowTextColor() ); - aStyleSettings.SetDisableColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUDISABLEDTEXT, 0 ) ) ); - aStyleSettings.SetHighlightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_HILITEBACKGROUND, 0 ) ) ); - aStyleSettings.SetHighlightTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_HILITEFOREGROUND, 0 ) ) ); - Color aMenuHighColor = ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUHILITEBGND, 0 ) ); - if ( ImplSalIsSameColor( aMenuHighColor, aStyleSettings.GetMenuColor() ) ) - { - aStyleSettings.SetMenuHighlightColor( Color( COL_BLUE ) ); - aStyleSettings.SetMenuHighlightTextColor( Color( COL_WHITE ) ); - } - else - { - aStyleSettings.SetMenuHighlightColor( aMenuHighColor ); - aStyleSettings.SetMenuHighlightTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUHILITE, 0 ) ) ); - } - // Checked-Color berechnen - Color aColor1 = aStyleSettings.GetFaceColor(); - Color aColor2 = aStyleSettings.GetLightColor(); - BYTE nRed = (BYTE)(((USHORT)aColor1.GetRed() + (USHORT)aColor2.GetRed())/2); - BYTE nGreen = (BYTE)(((USHORT)aColor1.GetGreen() + (USHORT)aColor2.GetGreen())/2); - BYTE nBlue = (BYTE)(((USHORT)aColor1.GetBlue() + (USHORT)aColor2.GetBlue())/2); - aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); - - // Fonts updaten - Font aFont; - char aFontNameBuf[255]; - aFont = aStyleSettings.GetMenuFont(); - if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"Menus", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) - { - if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) { -#if 0 - // Add Workplace Sans if not already listed - if ( aFont.GetName().Search( (sal_Unicode*)L"WorkPlace Sans" ) == STRING_NOTFOUND ) - { - XubString aFontName = aFont.GetName(); - aFontName.Insert( (sal_Unicode*)L"WorkPlace Sans;", 0 ); - aFont.SetName( aFontName ); - aFont.SetSize( Size( 0, 9 ) ); - } -#endif - aStyleSettings.SetMenuFont( aFont ); - } - } - aFont = aStyleSettings.GetIconFont(); - if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"IconText", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) - { - if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) - aStyleSettings.SetIconFont( aFont ); - } - aFont = aStyleSettings.GetTitleFont(); - if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"WindowTitles", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) - { - if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) - { - // Add Workplace Sans if not already listed - if ( aFont.GetName().Search( (sal_Unicode*)L"WorkPlace Sans" ) == STRING_NOTFOUND ) - { - XubString aFontName = aFont.GetName(); - aFontName.Insert( (sal_Unicode*)L"WorkPlace Sans;", 0 ); - aFont.SetName( aFontName ); - aFont.SetSize( Size( 0, 9 ) ); - aFont.SetWeight( WEIGHT_BOLD ); - aFont.SetItalic( ITALIC_NONE ); - } - aStyleSettings.SetTitleFont( aFont ); - aStyleSettings.SetFloatTitleFont( aFont ); - } - } - aFont = aStyleSettings.GetAppFont(); - if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"WindowText", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) - { - if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) - { - Font aHelpFont = aFont; - aHelpFont.SetName( (sal_Unicode*)L"Helv;WarpSans" ); - aHelpFont.SetSize( Size( 0, 8 ) ); - aHelpFont.SetWeight( WEIGHT_NORMAL ); - aHelpFont.SetItalic( ITALIC_NONE ); - aStyleSettings.SetHelpFont( aHelpFont ); - - // Add Workplace Sans if not already listed - if ( aFont.GetName().Search( (sal_Unicode*)L"WorkPlace Sans" ) == STRING_NOTFOUND ) - { - XubString aFontName = aFont.GetName(); - aFontName.Insert( (sal_Unicode*)L"WorkPlace Sans;", 0 ); - aFont.SetName( aFontName ); - aFont.SetSize( Size( 0, 9 ) ); - } - aStyleSettings.SetAppFont( aFont ); - aStyleSettings.SetToolFont( aFont ); - aStyleSettings.SetLabelFont( aFont ); - aStyleSettings.SetInfoFont( aFont ); - aStyleSettings.SetRadioCheckFont( aFont ); - aStyleSettings.SetPushButtonFont( aFont ); - aStyleSettings.SetFieldFont( aFont ); - aStyleSettings.SetGroupFont( aFont ); - } - } - - rSettings.SetStyleSettings( aStyleSettings ); -} - -// ----------------------------------------------------------------------- - -SalBitmap* Os2SalFrame::SnapShot() -{ -debug_printf("Os2SalFrame::SnapShot\n"); -return NULL; -} - -// ----------------------------------------------------------------------- - -const SystemEnvData* Os2SalFrame::GetSystemData() const -{ - return &maSysData; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::Beep( SoundType eSoundType ) -{ - static ULONG aImplSoundTab[5] = - { - WA_NOTE, // SOUND_DEFAULT - WA_NOTE, // SOUND_INFO - WA_WARNING, // SOUND_WARNING - WA_ERROR, // SOUND_ERROR - WA_NOTE // SOUND_QUERY - }; - -#if 0 -#if SOUND_COUNT != 5 -#error New Sound must be defined! -#endif -#endif - - debug_printf("Os2SalFrame::Beep %d\n", eSoundType); - WinAlarm( HWND_DESKTOP, aImplSoundTab[eSoundType] ); -} - -// ----------------------------------------------------------------------- - -SalFrame::SalPointerState Os2SalFrame::GetPointerState() -{ - SalPointerState aState; - aState.mnState = 0; - - // MausModus feststellen und setzen - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON1 ) & 0x8000 ) - aState.mnState |= MOUSE_LEFT; - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON2 ) & 0x8000 ) - aState.mnState |= MOUSE_RIGHT; - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON3 ) & 0x8000 ) - aState.mnState |= MOUSE_MIDDLE; - // Modifier-Tasten setzen - if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) - aState.mnState |= KEY_SHIFT; - if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) - aState.mnState |= KEY_MOD1; - if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) - aState.mnState |= KEY_MOD2; - - POINTL pt; - _WinQueryPointerPos( HWND_DESKTOP, &pt ); - - aState.maPos = Point( pt.x - maGeometry.nX, pt.y - maGeometry.nY ); - return aState; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetBackgroundBitmap( SalBitmap* ) -{ -} - -// ----------------------------------------------------------------------- - -void SalTestMouseLeave() -{ - SalData* pSalData = GetSalData(); - - if ( pSalData->mhWantLeaveMsg && !::WinQueryCapture( HWND_DESKTOP ) ) - { - POINTL aPt; - WinQueryPointerPos( HWND_DESKTOP, &aPt ); - if ( pSalData->mhWantLeaveMsg != WinWindowFromPoint( HWND_DESKTOP, &aPt, TRUE ) ) - WinSendMsg( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, MPFROM2SHORT( aPt.x, aPt.y ) ); - } -} - -// ----------------------------------------------------------------------- - -static long ImplHandleMouseMsg( HWND hWnd, - UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) -{ - SalMouseEvent aMouseEvt; - long nRet; - USHORT nEvent; - BOOL bCall = TRUE; - USHORT nFlags = SHORT2FROMMP( nMP2 ); - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( !pFrame ) - return 0; - - aMouseEvt.mnX = (short)SHORT1FROMMP( nMP1 ); - aMouseEvt.mnY = pFrame->mnHeight - (short)SHORT2FROMMP( nMP1 ) - 1; - aMouseEvt.mnCode = 0; - aMouseEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - - // MausModus feststellen und setzen - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON1 ) & 0x8000 ) - aMouseEvt.mnCode |= MOUSE_LEFT; - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON2 ) & 0x8000 ) - aMouseEvt.mnCode |= MOUSE_RIGHT; - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON3 ) & 0x8000 ) - aMouseEvt.mnCode |= MOUSE_MIDDLE; - // Modifier-Tasten setzen - if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) - aMouseEvt.mnCode |= KEY_SHIFT; - if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) - aMouseEvt.mnCode |= KEY_MOD1; - if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) - aMouseEvt.mnCode |= KEY_MOD2; - - switch ( nMsg ) - { - case WM_MOUSEMOVE: - { - SalData* pSalData = GetSalData(); - - // Da bei Druecken von Modifier-Tasten die MouseEvents - // nicht zusammengefast werden (da diese durch KeyEvents - // unterbrochen werden), machen wir dieses hier selber - if ( aMouseEvt.mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2) ) - { - QMSG aTempMsg; - if ( WinPeekMsg( pSalData->mhAB, &aTempMsg, - pFrame->mhWndClient, - WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE ) ) - { - if ( (aTempMsg.msg == WM_MOUSEMOVE) && - (aTempMsg.mp2 == nMP2) ) - return 1; - } - } - - // Test for MouseLeave - if ( pSalData->mhWantLeaveMsg && - (pSalData->mhWantLeaveMsg != pFrame->mhWndClient) ) - { - POINTL aMousePoint; - WinQueryMsgPos( pFrame->mhAB, &aMousePoint ); - WinSendMsg( pSalData->mhWantLeaveMsg, - SAL_MSG_MOUSELEAVE, - 0, MPFROM2SHORT( aMousePoint.x, aMousePoint.y ) ); - } - pSalData->mhWantLeaveMsg = pFrame->mhWndClient; - // Start MouseLeave-Timer - if ( !pSalData->mpMouseLeaveTimer ) - { - pSalData->mpMouseLeaveTimer = new AutoTimer; - pSalData->mpMouseLeaveTimer->SetTimeout( SAL_MOUSELEAVE_TIMEOUT ); - pSalData->mpMouseLeaveTimer->Start(); - // We dont need to set a timeout handler, because we test - // for mouseleave in the timeout callback - } - aMouseEvt.mnButton = 0; - nEvent = SALEVENT_MOUSEMOVE; - } - break; - - case SAL_MSG_MOUSELEAVE: - { - SalData* pSalData = GetSalData(); - if ( pSalData->mhWantLeaveMsg == pFrame->mhWndClient ) - { - pSalData->mhWantLeaveMsg = 0; - if ( pSalData->mpMouseLeaveTimer ) - { - delete pSalData->mpMouseLeaveTimer; - pSalData->mpMouseLeaveTimer = NULL; - } - - // Mouse-Coordinaates are relativ to the screen - POINTL aPt; - aPt.x = (short)SHORT1FROMMP( nMP2 ); - aPt.y = (short)SHORT2FROMMP( nMP2 ); - WinMapWindowPoints( HWND_DESKTOP, pFrame->mhWndClient, &aPt, 1 ); - aPt.y = pFrame->mnHeight - aPt.y - 1; - aMouseEvt.mnX = aPt.x; - aMouseEvt.mnY = aPt.y; - aMouseEvt.mnButton = 0; - nEvent = SALEVENT_MOUSELEAVE; - } - else - bCall = FALSE; - } - break; - - case WM_BUTTON1DBLCLK: - case WM_BUTTON1DOWN: - aMouseEvt.mnButton = MOUSE_LEFT; - nEvent = SALEVENT_MOUSEBUTTONDOWN; - break; - - case WM_BUTTON2DBLCLK: - case WM_BUTTON2DOWN: - aMouseEvt.mnButton = MOUSE_RIGHT; - nEvent = SALEVENT_MOUSEBUTTONDOWN; - break; - - case WM_BUTTON3DBLCLK: - case WM_BUTTON3DOWN: - aMouseEvt.mnButton = MOUSE_MIDDLE; - nEvent = SALEVENT_MOUSEBUTTONDOWN; - break; - - case WM_BUTTON1UP: - aMouseEvt.mnButton = MOUSE_LEFT; - nEvent = SALEVENT_MOUSEBUTTONUP; - break; - - case WM_BUTTON2UP: - aMouseEvt.mnButton = MOUSE_RIGHT; - nEvent = SALEVENT_MOUSEBUTTONUP; - break; - - case WM_BUTTON3UP: - aMouseEvt.mnButton = MOUSE_MIDDLE; - nEvent = SALEVENT_MOUSEBUTTONUP; - break; - } - - // check if this window was destroyed - this might happen if we are the help window - // and sent a mouse leave message to the application which killed the help window, ie ourself - if( !WinIsWindow( pFrame->mhAB, hWnd ) ) - return 0; - -#if OSL_DEBUG_LEVEL>10 - //if (_bCapture) - debug_printf("ImplHandleMouseMsg mouse %d,%d\n",aMouseEvt.mnX,aMouseEvt.mnY); -#endif - - if ( bCall ) - { - if ( nEvent == SALEVENT_MOUSEBUTTONDOWN ) - WinUpdateWindow( pFrame->mhWndClient ); - - // --- RTL --- (mirror mouse pos) - //if( Application::GetSettings().GetLayoutRTL() ) - // aMouseEvt.mnX = pFrame->maGeometry.nWidth-1-aMouseEvt.mnX; - - nRet = pFrame->CallCallback( nEvent, &aMouseEvt ); - if ( nMsg == WM_MOUSEMOVE ) - { - WinSetPointer( HWND_DESKTOP, pFrame->mhPointer ); - nRet = TRUE; - } - } - else - nRet = 0; - - return nRet; -} - -// ----------------------------------------------------------------------- - -static long ImplHandleWheelMsg( HWND hWnd, UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) -{ - - ImplSalYieldMutexAcquireWithWait(); - - long nRet = 0; - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - - // Mouse-Coordinaates are relativ to the screen - POINTL aPt; - WinQueryMsgPos( pFrame->mhAB, &aPt ); - WinMapWindowPoints( HWND_DESKTOP, pFrame->mhWndClient, &aPt, 1 ); - aPt.y = pFrame->mnHeight - aPt.y - 1; - - SalWheelMouseEvent aWheelEvt; - aWheelEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - aWheelEvt.mnX = aPt.x; - aWheelEvt.mnY = aPt.y; - aWheelEvt.mnCode = 0; - bool bNeg = (SHORT2FROMMP(nMP2) == SB_LINEDOWN || SHORT2FROMMP(nMP2) == SB_PAGEDOWN ); - aWheelEvt.mnDelta = bNeg ? -120 : 120; - aWheelEvt.mnNotchDelta = bNeg ? -1 : 1; - if (SHORT2FROMMP(nMP2) == SB_PAGEUP || SHORT2FROMMP(nMP2) == SB_PAGEDOWN) - aWheelEvt.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; - else - aWheelEvt.mnScrollLines = 1; - - if( nMsg == WM_HSCROLL ) - aWheelEvt.mbHorz = TRUE; - - // Modifier-Tasten setzen - if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) - aWheelEvt.mnCode |= KEY_SHIFT; - if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) - aWheelEvt.mnCode |= KEY_MOD1; - if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) - aWheelEvt.mnCode |= KEY_MOD2; - - nRet = pFrame->CallCallback( SALEVENT_WHEELMOUSE, &aWheelEvt ); - } - - ImplSalYieldMutexRelease(); - - return nRet; -} - - -// ----------------------------------------------------------------------- - -static USHORT ImplSalGetKeyCode( Os2SalFrame* pFrame, MPARAM aMP1, MPARAM aMP2 ) -{ - USHORT nKeyFlags = SHORT1FROMMP( aMP1 ); - UCHAR nCharCode = (UCHAR)SHORT1FROMMP( aMP2 ); - USHORT nKeyCode = (UCHAR)SHORT2FROMMP( aMP2 ); - UCHAR nScanCode = (UCHAR)CHAR4FROMMP( aMP1 ); - USHORT rSVCode = 0; - - // Ist virtueller KeyCode gesetzt und befindet sich der KeyCode in der - // Tabelle, dann mappen - if ( (nKeyFlags & KC_VIRTUALKEY) && (nKeyCode < KEY_TAB_SIZE) ) - rSVCode = aImplTranslateKeyTab[nKeyCode]; - - // Wenn kein KeyCode ermittelt werden konnte, versuchen wir aus dem - // CharCode einen zu erzeugen - if ( !rSVCode && nCharCode ) - { - // Bei 0-9, a-z und A-Z auch KeyCode setzen - if ( (nCharCode >= '0') && (nCharCode <= '9') && (!rSVCode || !(nKeyFlags & KC_SHIFT)) ) - rSVCode = KEYGROUP_NUM + (nCharCode-'0'); - else if ( (nCharCode >= 'a') && (nCharCode <= 'z') ) - rSVCode = KEYGROUP_ALPHA + (nCharCode-'a'); - else if ( (nCharCode >= 'A') && (nCharCode <= 'Z') ) - rSVCode = KEYGROUP_ALPHA + (nCharCode-'A'); - else - { - switch ( nCharCode ) - { - case '+': - rSVCode = KEY_ADD; - break; - case '-': - rSVCode = KEY_SUBTRACT; - break; - case '*': - rSVCode = KEY_MULTIPLY; - break; - case '/': - rSVCode = KEY_DIVIDE; - break; - case '.': - rSVCode = KEY_POINT; - break; - case ',': - rSVCode = KEY_COMMA; - break; - case '<': - rSVCode = KEY_LESS; - break; - case '>': - rSVCode = KEY_GREATER; - break; - case '=': - rSVCode = KEY_EQUAL; - break; - } - } - } - - // "Numlock-Hack": we want to get correct keycodes from the numpad - if ( (nCharCode >= '0') && (nCharCode <= '9') && !(nKeyFlags & KC_SHIFT) ) - rSVCode = KEYGROUP_NUM + (nCharCode-'0'); - if ( nCharCode == ',' ) - rSVCode = KEY_COMMA; - if ( nCharCode == '.' ) - rSVCode = KEY_POINT; - - return rSVCode; -} - -// ----------------------------------------------------------------------- - -static void ImplUpdateInputLang( Os2SalFrame* pFrame ) -{ - BOOL bLanguageChange = FALSE; - ULONG nLang = 0; - APIRET rc; - UconvObject uconv_object = NULL; - LocaleObject locale_object = NULL; - UniChar *pinfo_item; - - // we do not support change of input language while working, - // so exit if already defined (mnInputLang is a static class field) - if (pFrame->mnInputLang) - return; - - // get current locale - rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locale_object); - // get Win32 locale id and sublanguage (hex uni string) - rc = UniQueryLocaleItem(locale_object, LOCI_xWinLocale, &pinfo_item); - // convert uni string to integer - rc = UniStrtoul(locale_object, pinfo_item, &pinfo_item, 16, &nLang); - rc = UniFreeMem(pinfo_item); -#if OSL_DEBUG_LEVEL>10 - debug_printf("ImplUpdateInputLang nLang %04x\n", nLang); - char char_buffer[256]; - rc = UniCreateUconvObject((UniChar *)L"", &uconv_object); - rc = UniQueryLocaleItem(locale_object, LOCI_sKeyboard, &pinfo_item); - rc = UniStrFromUcs(uconv_object, char_buffer, pinfo_item, sizeof(char_buffer)); - debug_printf("Keyboard name is: %s\n", char_buffer ); - rc = UniFreeMem(pinfo_item); -#endif - rc = UniFreeLocaleObject(locale_object); - - // keep input lang up-to-date -#if OSL_DEBUG_LEVEL>10 - debug_printf("ImplUpdateInputLang pFrame %08x lang changed from %d to %d\n", - pFrame, pFrame->mnInputLang, nLang); -#endif - pFrame->mnInputLang = nLang; -} - - -static sal_Unicode ImplGetCharCode( Os2SalFrame* pFrame, USHORT nKeyFlags, - sal_Char nCharCode, UCHAR nScanCode ) -{ - ImplUpdateInputLang( pFrame ); -#if OSL_DEBUG_LEVEL>10 - debug_printf("ImplGetCharCode nCharCode %c, %04x\n", nCharCode, nCharCode); -#endif - return OUString( &nCharCode, 1, gsl_getSystemTextEncoding()).toChar(); -} - -// ----------------------------------------------------------------------- - -LanguageType Os2SalFrame::GetInputLanguage() -{ - if( !mnInputLang ) - ImplUpdateInputLang( this ); - - if( !mnInputLang ) - return LANGUAGE_DONTKNOW; - else - return (LanguageType) mnInputLang; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) -{ - // not supported yet - return FALSE; -} - -// ----------------------------------------------------------------------- - -static sal_Unicode ImplConvertKey( Os2SalFrame* pFrame, MPARAM aMP1, MPARAM aMP2 ) -{ - USHORT nKeyFlags = SHORT1FROMMP( aMP1 ); - UCHAR nCharCode = (UCHAR)SHORT1FROMMP( aMP2 ); - USHORT nKeyCode = (UCHAR)SHORT2FROMMP( aMP2 ); - UCHAR nScanCode = (UCHAR)CHAR4FROMMP( aMP1 ); - sal_Unicode rSVCharCode = 0; - - // Ist Character-Code gesetzt - // !!! Bei CTRL/ALT ist KC_CHAR nicht gesetzt, jedoch moechten wir - // !!! dann auch einen CharCode und machen die Behandlung deshalb - // !!! selber - if ( (nKeyFlags & KC_CHAR) || (nKeyFlags & KC_CTRL) || (nKeyFlags & KC_ALT) ) - rSVCharCode = ImplGetCharCode( pFrame, nKeyFlags, nCharCode, nScanCode); - - // ret unicode - return rSVCharCode; -} - -// ----------------------------------------------------------------------- - -static long ImplHandleKeyMsg( HWND hWnd, - UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) -{ - static USHORT nLastOS2KeyChar = 0; - static sal_Unicode nLastChar = 0; - USHORT nRepeat = CHAR3FROMMP( nMP1 ) - 1; - SHORT nFlags = SHORT1FROMMP( nMP1 ); - USHORT nModCode = 0; - USHORT nSVCode = 0; - USHORT nOS2KeyCode = (UCHAR)SHORT2FROMMP( nMP2 ); - sal_Unicode nSVCharCode = 0; - long nRet = 0; - - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( !pFrame ) - return 0; - - // determine modifiers - if ( nFlags & KC_SHIFT ) - nModCode |= KEY_SHIFT; - if ( nFlags & KC_CTRL ) - nModCode |= KEY_MOD1; - if ( nFlags & KC_ALT ) - nModCode |= KEY_MOD2; - - // Bei Shift, Control und Alt schicken wir einen KeyModChange-Event - if ( (nOS2KeyCode == VK_SHIFT) || (nOS2KeyCode == VK_CTRL) || - (nOS2KeyCode == VK_ALT) || (nOS2KeyCode == VK_ALTGRAF) ) - { - SalKeyModEvent aModEvt; - aModEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - aModEvt.mnCode = nModCode; -#if OSL_DEBUG_LEVEL>10 - debug_printf("SALEVENT_KEYMODCHANGE\n"); -#endif - nRet = pFrame->CallCallback( SALEVENT_KEYMODCHANGE, &aModEvt ); - } - else - { - nSVCode = ImplSalGetKeyCode( pFrame, nMP1, nMP2 ); - nSVCharCode = ImplConvertKey( pFrame, nMP1, nMP2 ); -#if OSL_DEBUG_LEVEL>10 - debug_printf("nSVCode %04x nSVCharCode %04x\n",nSVCode,nSVCharCode ); -#endif - - // Fuer Java muessen wir bei KeyUp einen CharCode liefern - if ( nFlags & KC_KEYUP ) - { - if ( !nSVCharCode ) - { - if ( nLastOS2KeyChar == nOS2KeyCode ) - { - nSVCharCode = nLastChar; - nLastOS2KeyChar = 0; - nLastChar = 0; - } - } - else - { - nLastOS2KeyChar = 0; - nLastChar = 0; - } - } - else - { - nLastOS2KeyChar = nOS2KeyCode; - nLastChar = nSVCharCode; - } - - if ( nSVCode || nSVCharCode ) - { - SalKeyEvent aKeyEvt; - aKeyEvt.mnCode = nSVCode; - aKeyEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - aKeyEvt.mnCode |= nModCode; - aKeyEvt.mnCharCode = nSVCharCode; - aKeyEvt.mnRepeat = nRepeat; - -#if OSL_DEBUG_LEVEL>10 - debug_printf( (nFlags & KC_KEYUP) ? "SALEVENT_KEYUP\n" : "SALEVENT_KEYINPUT\n"); -#endif - nRet = pFrame->CallCallback( (nFlags & KC_KEYUP) ? SALEVENT_KEYUP : SALEVENT_KEYINPUT, - &aKeyEvt ); - } - } - - return nRet; -} - -// ----------------------------------------------------------------------- - -static bool ImplHandlePaintMsg( HWND hWnd ) -{ - BOOL bMutex = FALSE; - - if ( ImplSalYieldMutexTryToAcquire() ) - bMutex = TRUE; - - // if we don't get the mutex, we can also change the clip region, - // because other threads doesn't use the mutex from the main - // thread --> see GetGraphics() - - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - // Laut Window-Doku soll man erst abfragen, ob ueberhaupt eine - // Paint-Region anliegt - if ( WinQueryUpdateRect( hWnd, NULL ) ) - { - // Call BeginPaint/EndPaint to query the rect and send - // this Notofication to rect - HPS hPS; - RECTL aUpdateRect; - hPS = WinBeginPaint( hWnd, NULLHANDLE, &aUpdateRect ); - WinEndPaint( hPS ); - - // Paint - if ( bMutex ) - { - SalPaintEvent aPEvt( aUpdateRect.xLeft, pFrame->mnHeight - aUpdateRect.yTop, aUpdateRect.xRight- aUpdateRect.xLeft, aUpdateRect.yTop - aUpdateRect.yBottom ); - - pFrame->CallCallback( SALEVENT_PAINT, &aPEvt ); - } - else - { - RECTL* pRect = new RECTL; - WinCopyRect( pFrame->mhAB, pRect, &aUpdateRect ); - WinPostMsg( hWnd, SAL_MSG_POSTPAINT, (MPARAM)pRect, 0 ); - } - } - } - - if ( bMutex ) - ImplSalYieldMutexRelease(); - - return bMutex ? true : false; -} - -// ----------------------------------------------------------------------- - -static void ImplHandlePaintMsg2( HWND hWnd, RECTL* pRect ) -{ - // Paint - if ( ImplSalYieldMutexTryToAcquire() ) - { - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - SalPaintEvent aPEvt( pRect->xLeft, pFrame->mnHeight - pRect->yTop, pRect->xRight - pRect->xLeft, pRect->yTop - pRect->yBottom ); - pFrame->CallCallback( SALEVENT_PAINT, &aPEvt ); - } - ImplSalYieldMutexRelease(); - delete pRect; - } - else - WinPostMsg( hWnd, SAL_MSG_POSTPAINT, (MPARAM)pRect, 0 ); -} - -// ----------------------------------------------------------------------- - -static void SetMaximizedFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ) -{ - // calculate and set frame geometry of a maximized window - useful if the window is still hidden - - RECTL aRect; - pFrame->GetWorkArea( aRect); - - // a maximized window has no other borders than the caption - pFrame->maGeometry.nLeftDecoration = pFrame->maGeometry.nRightDecoration = pFrame->maGeometry.nBottomDecoration = 0; - pFrame->maGeometry.nTopDecoration = pFrame->mbCaption ? WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) : 0; - - aRect.yTop += pFrame->maGeometry.nTopDecoration; - pFrame->maGeometry.nX = aRect.xLeft; - pFrame->maGeometry.nY = aRect.yBottom; - pFrame->maGeometry.nWidth = aRect.xRight - aRect.xLeft + 1; - pFrame->maGeometry.nHeight = aRect.yBottom - aRect.yTop + 1; -} - -static void UpdateFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ) -{ - if( !pFrame ) - return; - - //SalFrame has a - //maGeometry member that holds absolute screen positions (and needs to be - //updated if the window is moved by the way). - - // reset data - memset(&pFrame->maGeometry, 0, sizeof(SalFrameGeometry) ); - - SWP swp; - LONG nFrameX, nFrameY, nCaptionY; - - // get frame size - WinQueryWindowPos(pFrame->mhWndFrame, &swp); - if (swp.fl & SWP_MINIMIZE) - return; - - // map from client area to screen - ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY); - pFrame->maGeometry.nTopDecoration = nFrameY + nCaptionY; - pFrame->maGeometry.nLeftDecoration = nFrameX; - pFrame->maGeometry.nRightDecoration = nFrameX; - pFrame->maGeometry.nBottomDecoration = nFrameY; - - // position of client area, not of frame corner! - pFrame->maGeometry.nX = swp.x + nFrameX; - pFrame->maGeometry.nY = nScreenHeight - (swp.y + swp.cy) + nFrameY + nCaptionY; - - int nWidth = swp.cx - pFrame->maGeometry.nRightDecoration - pFrame->maGeometry.nLeftDecoration; - int nHeight = swp.cy - pFrame->maGeometry.nBottomDecoration - pFrame->maGeometry.nTopDecoration; - - // clamp to zero - pFrame->maGeometry.nHeight = nHeight < 0 ? 0 : nHeight; - pFrame->maGeometry.nWidth = nWidth < 0 ? 0 : nWidth; -#if OSL_DEBUG_LEVEL>0 - debug_printf( "UpdateFrameGeometry: hwnd %x, frame %x at %d,%d (%dx%d)\n", - hWnd, pFrame->mhWndFrame, - pFrame->maGeometry.nX, pFrame->maGeometry.nY, - pFrame->maGeometry.nWidth,pFrame->maGeometry.nHeight); -#endif -} - -// ----------------------------------------------------------------------- - -static void ImplHandleMoveMsg( HWND hWnd) -{ - if ( ImplSalYieldMutexTryToAcquire() ) - { - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - UpdateFrameGeometry( hWnd, pFrame ); - - if ( WinIsWindowVisible( hWnd )) - pFrame->mbDefPos = FALSE; - - // Gegen moegliche Rekursionen sichern - if ( !pFrame->mbInMoveMsg ) - { - // Fenster im FullScreenModus wieder einpassen - pFrame->mbInMoveMsg = TRUE; - if ( pFrame->mbFullScreen ) - ImplSalFrameFullScreenPos( pFrame ); - pFrame->mbInMoveMsg = FALSE; - } - - // Status merken - ImplSaveFrameState( pFrame ); - - // Call Hdl - //#93851 if we call this handler, VCL floating windows are not updated correctly - //ImplCallMoveHdl( hWnd ); - - } - - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SAL_MSG_POSTMOVE, 0, 0 ); -} - -// ----------------------------------------------------------------------- - -static void ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 ) -{ - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - UpdateFrameGeometry( hWnd, pFrame ); - pFrame->mbDefPos = FALSE; - pFrame->mnWidth = (short)SHORT1FROMMP( nMP2 ); - pFrame->mnHeight = (short)SHORT2FROMMP( nMP2 ); - if ( pFrame->mpGraphics ) - pFrame->mpGraphics->mnHeight = (int)SHORT2FROMMP(nMP2); - // Status merken - ImplSaveFrameState( pFrame ); - pFrame->CallCallback( SALEVENT_RESIZE, 0 ); - if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow ) - WinUpdateWindow( pFrame->mhWndClient ); - } -} - -// ----------------------------------------------------------------------- - -static long ImplHandleFocusMsg( Os2SalFrame* pFrame, MPARAM nMP2 ) -{ -if ( pFrame && !Os2SalFrame::mbInReparent ) -{ - if ( SHORT1FROMMP( nMP2 ) ) - { - if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow ) - WinUpdateWindow( pFrame->mhWndClient ); - return pFrame->CallCallback( SALEVENT_GETFOCUS, 0 ); - } - else - { - return pFrame->CallCallback( SALEVENT_LOSEFOCUS, 0 ); - } -} -} - -// ----------------------------------------------------------------------- - -static void ImplHandleCloseMsg( HWND hWnd ) -{ - if ( ImplSalYieldMutexTryToAcquire() ) - { - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - pFrame->CallCallback( SALEVENT_CLOSE, 0 ); - } - - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, WM_CLOSE, 0, 0 ); -} - -// ----------------------------------------------------------------------- - -inline void ImplHandleUserEvent( HWND hWnd, MPARAM nMP2 ) -{ - ImplSalYieldMutexAcquireWithWait(); - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - pFrame->CallCallback( SALEVENT_USEREVENT, (void*)nMP2 ); - } - ImplSalYieldMutexRelease(); -} - -// ----------------------------------------------------------------------- - -static int SalImplHandleProcessMenu( Os2SalFrame* pFrame, ULONG nMsg, MPARAM nMP1, MPARAM nMP2) -{ - long nRet = 0; -debug_printf("SalImplHandleProcessMenu\n"); -#if 0 - DWORD err=0; - if( !HIWORD(wParam) ) - { - // Menu command - WORD nId = LOWORD(wParam); - if( nId ) // zero for separators - { - SalMenuEvent aMenuEvt; - aMenuEvt.mnId = nId; - WinSalMenuItem *pSalMenuItem = ImplGetSalMenuItem( pFrame->mSelectedhMenu, nId, FALSE ); - if( pSalMenuItem ) - aMenuEvt.mpMenu = pSalMenuItem->mpMenu; - else - aMenuEvt.mpMenu = NULL; - - nRet = pFrame->CallCallback( SALEVENT_MENUCOMMAND, &aMenuEvt ); - } - } -#endif - //return (nRet != 0); - return (nRet == 0); -} - -// ----------------------------------------------------------------------- - -static void ImplHandleInputLangChange( HWND hWnd ) -{ - ImplSalYieldMutexAcquireWithWait(); - - // Feststellen, ob wir IME unterstuetzen - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); -#if 0 - if ( pFrame && pFrame->mbIME && pFrame->mhDefIMEContext ) - { - HWND hWnd = pFrame->mhWnd; - HKL hKL = (HKL)lParam; - UINT nImeProps = ImmGetProperty( hKL, IGP_PROPERTY ); - - pFrame->mbSpezIME = (nImeProps & IME_PROP_SPECIAL_UI) != 0; - pFrame->mbAtCursorIME = (nImeProps & IME_PROP_AT_CARET) != 0; - pFrame->mbHandleIME = !pFrame->mbSpezIME; - } -#endif - - // trigger input language and codepage update - UINT nLang = pFrame->mnInputLang; - ImplUpdateInputLang( pFrame ); - debug_printf("ImplHandleInputLangChange new language 0x%04x\n",pFrame->mnInputLang); - - // notify change - if( nLang != pFrame->mnInputLang ) - pFrame->CallCallback( SALEVENT_INPUTLANGUAGECHANGE, 0 ); - - ImplSalYieldMutexRelease(); -} - -// ----------------------------------------------------------------------- - -#ifdef ENABLE_IME - -static long ImplHandleIMEStartConversion( Os2SalFrame* pFrame ) -{ - long nRet = FALSE; - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - HWND hWnd = pFrame->mhWndClient; - HIMI hIMI = 0; - pIMEData->mpGetIME( hWnd, &hIMI ); - if ( hIMI ) - { - ULONG nProp; - if ( 0 != pIMEData->mpQueryIMEProperty( hIMI, QIP_PROPERTY, &nProp ) ) - pFrame->mbHandleIME = FALSE; - else - { - pFrame->mbHandleIME = !(nProp & PRP_SPECIALUI); - - } - if ( pFrame->mbHandleIME ) - { -/* Windows-Code, der noch nicht angepasst wurde !!! - // Cursor-Position ermitteln und aus der die Default-Position fuer - // das Composition-Fenster berechnen - SalCursorPosEvent aCursorPosEvt; - pFrame->CallCallback( pFrame->mpInst, pFrame, - SALEVENT_CURSORPOS, (void*)&aCursorPosEvt ); - COMPOSITIONFORM aForm; - memset( &aForm, 0, sizeof( aForm ) ); - if ( !aCursorPosEvt.mnWidth || !aCursorPosEvt.mnHeight ) - aForm.dwStyle |= CFS_DEFAULT; - else - { - aForm.dwStyle |= CFS_POINT; - aForm.ptCurrentPos.x = aCursorPosEvt.mnX; - aForm.ptCurrentPos.y = aCursorPosEvt.mnY; - } - ImmSetCompositionWindow( hIMC, &aForm ); - - // Den InputContect-Font ermitteln und diesem dem Composition-Fenster - // bekannt machen -*/ - - pFrame->mbConversionMode = TRUE; - pFrame->CallCallback( SALEVENT_STARTEXTTEXTINPUT, (void*)NULL ); - nRet = TRUE; - } - - pIMEData->mpReleaseIME( hWnd, hIMI ); - } - } - - return nRet; -} - -// ----------------------------------------------------------------------- - -static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) -{ - long nRet = FALSE; - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - HWND hWnd = pFrame->mhWndClient; - HIMI hIMI = 0; - ULONG nMP2 = (ULONG)nMP2Param; - pIMEData->mpGetIME( hWnd, &hIMI ); - if ( hIMI ) - { - if ( nMP2 & (IMR_RESULT_RESULTSTRING | - IMR_CONV_CONVERSIONSTRING | IMR_CONV_CONVERSIONATTR | - IMR_CONV_CURSORPOS | IMR_CONV_CURSORATTR) ) - { - SalExtTextInputEvent aEvt; - aEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - aEvt.mpTextAttr = NULL; - aEvt.mnCursorPos = 0; - aEvt.mnDeltaStart = 0; - aEvt.mbOnlyCursor = FALSE; - aEvt.mbCursorVisible = TRUE; - - ULONG nBufLen = 0; - xub_Unicode* pBuf = NULL; - ULONG nAttrBufLen = 0; - PM_BYTE* pAttrBuf = NULL; - BOOL bLastCursor = FALSE; - if ( nMP2 & IMR_RESULT_RESULTSTRING ) - { - pIMEData->mpGetResultString( hIMI, IMR_RESULT_RESULTSTRING, 0, &nBufLen ); - if ( nBufLen > 0 ) - { - pBuf = new xub_Unicode[nBufLen]; - pIMEData->mpGetResultString( hIMI, IMR_RESULT_RESULTSTRING, pBuf, &nBufLen ); - } - - bLastCursor = TRUE; - aEvt.mbCursorVisible = TRUE; - } - else if ( nMP2 & (IMR_CONV_CONVERSIONSTRING | IMR_CONV_CONVERSIONATTR | - IMR_CONV_CURSORPOS | IMR_CONV_CURSORATTR) ) - { - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, 0, &nBufLen ); - if ( nBufLen > 0 ) - { - pBuf = new xub_Unicode[nBufLen]; - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, pBuf, &nBufLen ); - } - - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONATTR, 0, &nAttrBufLen ); - if ( nAttrBufLen > 0 ) - { - pAttrBuf = new PM_BYTE[nAttrBufLen]; - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONATTR, pAttrBuf, &nAttrBufLen ); - } - -/* !!! Wir bekommen derzeit nur falsche Daten, deshalb zeigen wir derzeit - !!! auch keine Cursor an - ULONG nTempBufLen; - ULONG nCursorPos = 0; - ULONG nCursorAttr = 0; - ULONG nChangePos = 0; - nTempBufLen = sizeof( ULONG ); - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORPOS, &nCursorPos, &nTempBufLen ); - nTempBufLen = sizeof( ULONG ); - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORATTR, &nCursorAttr, &nTempBufLen ); - nTempBufLen = sizeof( ULONG ); - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CHANGESTART, &nChangePos, &nTempBufLen ); - - aEvt.mnCursorPos = nCursorPos; - aEvt.mnDeltaStart = nChangePos; - if ( nCursorAttr & CP_CURSORATTR_INVISIBLE ) - aEvt.mbCursorVisible = FALSE; -*/ - aEvt.mnCursorPos = 0; - aEvt.mnDeltaStart = 0; - aEvt.mbCursorVisible = FALSE; - - if ( (nMP2 == IMR_CONV_CURSORPOS) || - (nMP2 == IMR_CONV_CURSORATTR) ) - aEvt.mbOnlyCursor = TRUE; - } - - USHORT* pSalAttrAry = NULL; - if ( pBuf ) - { - aEvt.maText = XubString( pBuf, (USHORT)nBufLen ); - delete [] pBuf; - if ( pAttrBuf ) - { - USHORT nTextLen = aEvt.maText.Len(); - if ( nTextLen ) - { - pSalAttrAry = new USHORT[nTextLen]; - memset( pSalAttrAry, 0, nTextLen*sizeof( USHORT ) ); - for ( USHORT i = 0; (i < nTextLen) && (i < nAttrBufLen); i++ ) - { - PM_BYTE nOS2Attr = pAttrBuf[i]; - USHORT nSalAttr; - if ( nOS2Attr == CP_ATTR_TARGET_CONVERTED ) - nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETCONVERTED | SAL_EXTTEXTINPUT_ATTR_UNDERLINE | SAL_EXTTEXTINPUT_ATTR_HIGHLIGHT; - else if ( nOS2Attr == CP_ATTR_CONVERTED ) - nSalAttr = SAL_EXTTEXTINPUT_ATTR_CONVERTED | SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE; - else if ( nOS2Attr == CP_ATTR_TARGET_NOTCONVERTED ) - nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETNOTCONVERTED | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; - else if ( nOS2Attr == CP_ATTR_INPUT_ERROR ) - nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUTERROR | SAL_EXTTEXTINPUT_ATTR_REDTEXT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; - else /* ( nOS2Attr == CP_ATTR_INPUT ) */ - nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; - pSalAttrAry[i] = nSalAttr; - } - aEvt.mpTextAttr = pSalAttrAry; - } - delete [] pAttrBuf; - } - if ( bLastCursor ) - aEvt.mnCursorPos = aEvt.maText.Len(); - } - - pIMEData->mpReleaseIME( hWnd, hIMI ); - - // Handler rufen und wenn wir ein Attribute-Array haben, danach - // wieder zerstoeren - pFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void*)&aEvt ); - if ( pSalAttrAry ) - delete [] pSalAttrAry; - } - else - pIMEData->mpReleaseIME( hWnd, hIMI ); - } - - nRet = TRUE; - } - - return nRet; -} - -// ----------------------------------------------------------------------- - -inline long ImplHandleIMEEndConversion( Os2SalFrame* pFrame ) -{ - pFrame->mbConversionMode = FALSE; - pFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, (void*)NULL ); - return TRUE; -} - -// ----------------------------------------------------------------------- - -static void ImplHandleIMEOpenCandidate( Os2SalFrame* pFrame ) -{ - pFrame->mbCandidateMode = TRUE; - - long nRet = FALSE; - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - HWND hWnd = pFrame->mhWndClient; - HIMI hIMI = 0; - pIMEData->mpGetIME( hWnd, &hIMI ); - if ( hIMI ) - { - ULONG nBufLen = 0; - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, 0, &nBufLen ); - if ( nBufLen > 0 ) - { -/* !!! Wir bekommen derzeit nur falsche Daten steht der Cursor immer bei 0 - ULONG nTempBufLen = sizeof( ULONG ); - ULONG nCursorPos = 0; - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORPOS, &nCursorPos, &nTempBufLen ); -*/ - ULONG nCursorPos = 0; - - SalExtTextInputPosEvent aEvt; - aEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - aEvt.mnFirstPos = nCursorPos; - aEvt.mnChars = nBufLen-nCursorPos; - aEvt.mpPosAry = new SalExtCharPos[aEvt.mnChars]; - memset( aEvt.mpPosAry, 0, aEvt.mnChars*sizeof(SalExtCharPos) ); - - pFrame->CallCallback( SALEVENT_EXTTEXTINPUTPOS, (void*)&aEvt ); - - long nMinLeft = aEvt.mpPosAry[0].mnX; - long nMinTop = aEvt.mpPosAry[0].mnY; - long nMaxBottom = aEvt.mpPosAry[0].mnY+aEvt.mpPosAry[0].mnHeight; - long nMaxRight = nMinLeft; - USHORT i = 0; - while ( i < aEvt.mnChars ) - { - // Solange wir uns auf der gleichen Zeile bewegen, - // ermitteln wir die Rechteck-Grenzen - if ( !aEvt.mpPosAry[i].mnHeight || - (aEvt.mpPosAry[i].mnY < nMaxBottom-1) ) - { - if ( aEvt.mpPosAry[i].mnX < nMinLeft ) - nMinLeft = aEvt.mpPosAry[i].mnX; - if ( aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth > nMaxRight ) - nMaxRight = aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth; - if ( aEvt.mpPosAry[i].mnY < nMinTop ) - nMinTop = aEvt.mpPosAry[i].mnY; - i++; - } - else - break; - } - - CANDIDATEPOS aForm; - aForm.ulIndex = 0; - aForm.ulStyle = CPS_EXCLUDE; - aForm.ptCurrentPos.x = aEvt.mpPosAry[0].mnX; - aForm.ptCurrentPos.y = pFrame->mnHeight - (nMaxBottom+1) - 1; - aForm.rcArea.xLeft = nMinLeft; - aForm.rcArea.yBottom = pFrame->mnHeight - nMaxBottom - 1; - aForm.rcArea.xRight = nMaxRight+1; - aForm.rcArea.yTop = pFrame->mnHeight - nMinTop - 1; - pIMEData->mpSetCandidateWin( hIMI, &aForm ); - - delete aEvt.mpPosAry; - } - - pIMEData->mpReleaseIME( hWnd, hIMI ); - } - } -} - -// ----------------------------------------------------------------------- - -inline void ImplHandleIMECloseCandidate( Os2SalFrame* pFrame ) -{ - pFrame->mbCandidateMode = FALSE; -} - -#endif - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalFrameWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - Os2SalFrame* pFrame = (Os2SalFrame*)GetWindowPtr( hWnd ); - MRESULT nRet = (MRESULT)0; - BOOL bDef = TRUE; - bool bCheckTimers= false; - -#if OSL_DEBUG_LEVEL>10 - if (nMsg!=WM_TIMER && nMsg!=WM_MOUSEMOVE) - debug_printf( "SalFrameWndProc hWnd 0x%x nMsg 0x%x\n", hWnd, nMsg); -#endif - - switch( nMsg ) - { - case WM_MOUSEMOVE: - case WM_BUTTON1DOWN: - case WM_BUTTON2DOWN: - case WM_BUTTON3DOWN: - case WM_BUTTON1DBLCLK: - case WM_BUTTON2DBLCLK: - case WM_BUTTON3DBLCLK: - case WM_BUTTON1UP: - case WM_BUTTON2UP: - case WM_BUTTON3UP: - case SAL_MSG_MOUSELEAVE: - // ButtonUp/Down nie an die WinDefWindowProc weiterleiten, weil sonst - // die Message an den Owner weitergeleitet wird - ImplSalYieldMutexAcquireWithWait(); - bDef = !ImplHandleMouseMsg( hWnd, nMsg, nMP1, nMP2 ); - ImplSalYieldMutexRelease(); - break; - - case WM_CHAR: - if ( pFrame->mbConversionMode ) - bDef = FALSE; - else - bDef = !ImplHandleKeyMsg( hWnd, nMsg, nMP1, nMP2 ); - break; - - case WM_ERASEBACKGROUND: - nRet = (MRESULT)FALSE; - bDef = FALSE; - break; - - case WM_PAINT: - bCheckTimers = ImplHandlePaintMsg( hWnd ); - bDef = FALSE; - break; - case SAL_MSG_POSTPAINT: - ImplHandlePaintMsg2( hWnd, (RECTL*)nMP1 ); - bCheckTimers = true; - bDef = FALSE; - break; - - case WM_MOVE: - case SAL_MSG_POSTMOVE: - ImplHandleMoveMsg( hWnd ); - bDef = FALSE; - break; - - case WM_SIZE: - if ( ImplSalYieldMutexTryToAcquire() ) - { - ImplHandleSizeMsg( hWnd, nMP2 ); - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SAL_MSG_POSTSIZE, nMP1, nMP2 ); - break; - case SAL_MSG_POSTSIZE: - ImplHandleSizeMsg( hWnd, nMP2 ); - break; - case WM_MINMAXFRAME: - if ( ImplSalYieldMutexTryToAcquire() ) - { - PSWP pswp = (PSWP) nMP1; - ImplHandleSizeMsg( hWnd, MPFROM2SHORT( pswp->cx, pswp->cy) ); - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SAL_MSG_POSTSIZE, 0, nMP2 ); - break; - - case WM_CALCVALIDRECTS: - return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); - - case WM_SETFOCUS: - if ( ImplSalYieldMutexTryToAcquire() ) - { - ImplHandleFocusMsg( pFrame, nMP2 ); - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SAL_MSG_POSTFOCUS, 0, nMP2 ); - break; - case SAL_MSG_POSTFOCUS: - ImplHandleFocusMsg( pFrame, nMP2 ); - break; - - case WM_TRANSLATEACCEL: - { - // Da uns OS/2 zu viele Tasten abfaegnt, unternehmen wir etwas, - // damit wir Shift+F1, Shift+F10 und Shift+Enter bekommen - PQMSG pMsg = (PQMSG)nMP1; - USHORT nKeyFlags = SHORT1FROMMP( pMsg->mp1 ); - USHORT nKeyCode = (UCHAR)SHORT2FROMMP( pMsg->mp2 ); - - if ( !(nKeyFlags & KC_KEYUP) && (nKeyFlags & KC_VIRTUALKEY) && - (nKeyFlags & KC_SHIFT) && (nKeyCode != VK_ESC) ) - return (MRESULT)FALSE; - - if ( nKeyCode == VK_F1 ) - return (MRESULT)FALSE; - } - break; - - case WM_CREATE: - { - HWND hWndFrame = WinQueryWindow(hWnd, QW_PARENT); - if (hWndFrame == 0) - debug_printf(" WARNING NULL FRAME!!\n"); - SalData* pSalData = GetSalData(); - // Window-Instanz am Windowhandle speichern - pFrame = pSalData->mpCreateFrame; - pSalData->mpCreateFrame = NULL; - SetWindowPtr( hWnd, pFrame ); - SetWindowPtr( hWndFrame, pFrame); - // HWND schon hier setzen, da schon auf den Instanzdaten - // gearbeitet werden kann, wenn Messages waehrend - // CreateWindow() gesendet werden - pFrame->mhWndClient = hWnd; - pFrame->mhWndFrame = hWndFrame; - pFrame->maSysData.hWnd = hWnd; - } - break; - - case WM_CLOSE: - ImplHandleCloseMsg( hWnd ); - bDef = FALSE; - break; - - case WM_SYSVALUECHANGED: - if ( pFrame->mbFullScreen ) - ImplSalFrameFullScreenPos( pFrame ); - // kein break, da der Rest auch noch verarbeitet werden soll - case PL_ALTERED: - case WM_SYSCOLORCHANGE: - ImplSalYieldMutexAcquire(); - pFrame->CallCallback( SALEVENT_SETTINGSCHANGED, 0 ); - ImplSalYieldMutexRelease(); - break; - - case SAL_MSG_USEREVENT: - ImplHandleUserEvent( hWnd, nMP2 ); - bDef = FALSE; - break; - case SAL_MSG_TOTOP: - ImplSalToTop( hWnd, (ULONG)nMP1 ); - bDef = FALSE; - break; - case SAL_MSG_SHOW: - ImplSalShow( hWnd, (ULONG)nMP1, (ULONG)nMP2 ); - bDef = FALSE; - break; - - case WM_KBDLAYERCHANGED: - debug_printf("hWnd 0x%08x WM_KBDLAYERCHANGED\n", hWnd); - ImplHandleInputLangChange( hWnd ); - break; - - case WM_HSCROLL: - case WM_VSCROLL: - ImplHandleWheelMsg( hWnd, nMsg, nMP1, nMP2 ); - bDef = FALSE; - break; - - case WM_COMMAND: - case SAL_MSG_SYSPROCESSMENU: - if ( SalImplHandleProcessMenu( pFrame, nMsg, nMP1, nMP2 ) ) - { - bDef = FALSE; - nRet = (MRESULT)1; - } - break; - -#ifdef ENABLE_IME - case WM_IMEREQUEST: - if ( (ULONG)nMP1 == IMR_CONVRESULT ) - { - if ( pFrame->mbHandleIME ) - { - // Nur im Conversionmodus akzeptieren wir den IME-Input - if ( pFrame->mbConversionMode ) - { - ImplSalYieldMutexAcquire(); - if ( ImplHandleIMEConversion( pFrame, nMP2 ) ) - { - bDef = FALSE; - nRet = (MRESULT)TRUE; - } - ImplSalYieldMutexRelease(); - } - } - } - else if ( (ULONG)nMP1 == IMR_CANDIDATE ) - { - if ( pFrame->mbHandleIME ) - { - ImplSalYieldMutexAcquire(); - if ( (ULONG)nMP2 & IMR_CANDIDATE_SHOW ) - ImplHandleIMEOpenCandidate( pFrame ); - else if ( (ULONG)nMP2 & IMR_CANDIDATE_HIDE ) - ImplHandleIMECloseCandidate( pFrame ); - ImplSalYieldMutexRelease(); - } - } - break; - - case WM_IMENOTIFY: - if ( (ULONG)nMP1 == IMN_STARTCONVERSION ) - { - ImplSalYieldMutexAcquire(); - if ( ImplHandleIMEStartConversion( pFrame ) ) - { - bDef = FALSE; - nRet = (MRESULT)TRUE; - } - ImplSalYieldMutexRelease(); - } - else if ( (ULONG)nMP1 == IMN_ENDCONVERSION ) - { - if ( pFrame->mbHandleIME ) - { - ImplSalYieldMutexAcquire(); - if ( ImplHandleIMEEndConversion( pFrame ) ) - { - bDef = FALSE; - nRet = (MRESULT)TRUE; - } - ImplSalYieldMutexRelease(); - } - } - break; -#endif - } - - if( bCheckTimers ) - { - SalData* pSalData = GetSalData(); - if( pSalData->mnNextTimerTime ) - { - ULONG nCurTime; - DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, (PVOID)&nCurTime, sizeof(ULONG)); - if( pSalData->mnNextTimerTime < nCurTime ) - { - QMSG aMsg; - if (!WinPeekMsg( pFrame->mhAB, &aMsg, 0, WM_PAINT, WM_PAINT, PM_NOREMOVE ) ) - WinPostMsg( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_POSTTIMER, 0, (MPARAM)nCurTime ); - } - } - } - - if ( bDef ) - nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); - - return nRet; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::ResetClipRegion() -{ -} - -void Os2SalFrame::BeginSetClipRegion( ULONG ) -{ -} - -void Os2SalFrame::UnionClipRegion( long, long, long, long ) -{ -} - -void Os2SalFrame::EndSetClipRegion() -{ -} - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalFrameSubClassWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - MRESULT mReturn = 0L; - - // ticket#124 min size of 132 px is too much - if (nMsg == WM_QUERYTRACKINFO) { - PTRACKINFO pti; - // first, let PM initialize TRACKINFO - mReturn = aSalShlData.mpFrameProc( hWnd, nMsg, nMP1, nMP2 ); - // now change default min size - pti = (PTRACKINFO) nMP2; - pti->ptlMinTrackSize.x = 64L; - // now return to PM - return mReturn; - } - - return aSalShlData.mpFrameProc( hWnd, nMsg, nMP1, nMP2 ); -} - -// ----------------------------------------------------------------------- diff --git a/vcl/os2/source/window/salobj.cxx b/vcl/os2/source/window/salobj.cxx deleted file mode 100644 index e55ce448f7d0..000000000000 --- a/vcl/os2/source/window/salobj.cxx +++ /dev/null @@ -1,574 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svpm.h> - -#define _SV_SALOBJ_CXX -#include <saldata.hxx> -#include <salinst.h> -#include <salframe.h> -#include <salobj.h> - -// ======================================================================= - -static BOOL ImplIsSysWindowOrChild( HWND hWndParent, HWND hWndChild ) -{ - if ( hWndParent == hWndChild ) - return TRUE; - - HWND hTempWnd = WinQueryWindow( hWndChild, QW_PARENT ); - while ( hTempWnd ) - { - if ( hTempWnd == hWndParent ) - return TRUE; - hTempWnd = WinQueryWindow( hTempWnd, QW_PARENT ); - } - - return FALSE; -} - -// ----------------------------------------------------------------------- - -static Os2SalObject* ImplFindOs2SalObject( HWND hWndChild ) -{ - SalData* pSalData = GetSalData(); - Os2SalObject* pObject = pSalData->mpFirstObject; - while ( pObject ) - { - if ( ImplIsSysWindowOrChild( pObject->mhWndChild, hWndChild ) ) - return pObject; - - pObject = pObject->mpNextObject; - } - - return NULL; -} - -// ======================================================================= - -BOOL EXPENTRY SalSysMsgProc( HAB /* hAB */, QMSG* pMsg, ULONG /* fs */ ) -{ - if ( (pMsg->msg == WM_BUTTON1DOWN) || - (pMsg->msg == WM_BUTTON2DOWN) || - (pMsg->msg == WM_BUTTON3DOWN) ) - { - SalData* pSalData = GetSalData(); - Os2SalObject* pObject = ImplFindOs2SalObject( pMsg->hwnd ); - if ( pObject ) - WinPostMsg( pObject->mhWnd, SALOBJ_MSG_TOTOP, 0, 0 ); - } - - // Focus fangen wir hier nicht ab, da wir erstmal davon ausgehen, - // das unser Os2SalObject-Fenster immer eine WM_FOCUSCHANGE-Message - // bekommt. - - return FALSE; -} - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalSysObjWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - Os2SalObject* pSysObj; - MRESULT nRet = 0; - int bDef = TRUE; - -#if OSL_DEBUG_LEVEL>0 - debug_printf( "SalSysObjWndProc hWnd 0x%x nMsg %d\n", hWnd, nMsg); -#endif - - switch( nMsg ) - { - case WM_ERASEBACKGROUND: - nRet = (MRESULT)FALSE; - bDef = FALSE; - break; - case WM_PAINT: - { - HPS hPS; - RECTL aRect; - hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect ); - WinEndPaint( hPS ); - bDef = FALSE; - } - bDef = FALSE; - break; - - case WM_BUTTON1DOWN: - case WM_BUTTON2DOWN: - case WM_BUTTON3DOWN: - case SALOBJ_MSG_TOTOP: - if ( ImplSalYieldMutexTryToAcquire() ) - { - pSysObj = GetSalObjWindowPtr( hWnd ); - pSysObj->mpProc( pSysObj->mpInst, pSysObj, - SALOBJ_EVENT_TOTOP, 0 ); - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SALOBJ_MSG_TOTOP, 0, 0 ); - break; - - case WM_FOCUSCHANGE: - case SALOBJ_MSG_POSTFOCUS: - if ( ImplSalYieldMutexTryToAcquire() ) - { - pSysObj = GetSalObjWindowPtr( hWnd ); - if ( SHORT1FROMMP( nMP2 ) ) - { - pSysObj->mhLastFocusWnd = WinQueryFocus( HWND_DESKTOP ); - pSysObj->mpProc( pSysObj->mpInst, pSysObj, - SALOBJ_EVENT_GETFOCUS, 0 ); - } - else - { - HWND hWndFocus = HWNDFROMMP( nMP1 ); - if ( !hWndFocus || !ImplIsSysWindowOrChild( hWnd, hWndFocus ) ) - { - pSysObj->mpProc( pSysObj->mpInst, pSysObj, - SALOBJ_EVENT_LOSEFOCUS, 0 ); - } - } - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SALOBJ_MSG_POSTFOCUS, nMP1, nMP2 ); - break; - - case WM_SIZE: - { - pSysObj = GetSalObjWindowPtr( hWnd ); - pSysObj->mnHeight = (short)SHORT2FROMMP( nMP2 ); - WinSetWindowPos( pSysObj->mhWndChild, 0, - 0, 0, - (short)SHORT1FROMMP( nMP2 ), (short)SHORT2FROMMP( nMP2 ), - SWP_SIZE | SWP_MOVE ); - bDef = FALSE; - } - break; - - case WM_CREATE: - { - // Window-Instanz am Windowhandle speichern - CREATESTRUCT* pStruct = (CREATESTRUCT*)nMP2; - pSysObj = (Os2SalObject*)pStruct->pPresParams; - SetSalObjWindowPtr( hWnd, pSysObj ); - bDef = FALSE; - } - break; - } - - if ( bDef ) - nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); - return nRet; -} - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalSysObjChildWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - MRESULT nRet = 0; - int bDef = TRUE; - - debug_printf( "SalSysObjChildWndProc hWnd 0x%x nMsg %d\n", hWnd, nMsg); - - switch( nMsg ) - { - case WM_ERASEBACKGROUND: - // Wegen PlugIn's loeschen wir erstmal den Hintergrund -/* - nRet = (MRESULT)FALSE; - bDef = FALSE; -*/ - break; - case WM_PAINT: - { - HPS hPS; - RECTL aRect; - hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect ); - WinEndPaint( hPS ); - bDef = FALSE; - } - break; - } - - if ( bDef ) - nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); - return nRet; -} - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalSysObjClipWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - MRESULT nRet = 0; - int bDef = TRUE; - - debug_printf( "SalSysObjClipWndProc hWnd 0x%x nMsg %d\n", hWnd, nMsg); - - switch( nMsg ) - { - case WM_MOUSEMOVE: - case WM_BUTTON1DOWN: - case WM_BUTTON2DOWN: - case WM_BUTTON3DOWN: - case WM_BUTTON1DBLCLK: - case WM_BUTTON2DBLCLK: - case WM_BUTTON3DBLCLK: - case WM_BUTTON1UP: - case WM_BUTTON2UP: - case WM_BUTTON3UP: - { - // Alle Events an den Frame weiterreichen, da diese Bereiche - // dem Frame gehoeren. Dazu muessen die Mouse-Koordinaaten - // entsprechend umgerechnet werden - HWND hWndParent = WinQueryWindow( hWnd, QW_PARENT ); // ergibt SysChild-Fenster - hWndParent = WinQueryWindow( hWndParent, QW_PARENT ); - short nX = (short)SHORT1FROMMP( nMP1 ); - short nY = (short)SHORT2FROMMP( nMP1 ); - POINTL aPos; - aPos.x = nX; - aPos.y = nY; - WinMapWindowPoints( hWnd, hWndParent, &aPos, 1 ); - nMP1 = MPFROM2SHORT( (short)aPos.x, (short)aPos.y ); - bDef = FALSE; - nRet = WinSendMsg( hWndParent, nMsg, nMP1, nMP2 ); - } - break; - - case WM_HITTEST: - // Damit im disablten Zustand die MouseKlicks immer noch - // an den Frame geschickt werden - // Dieser Code reicht leider nicht aus, deshalb wir unter - // OS2 immer das Child-Fenster disablen, im Gegensatz - // zu Windows, wo immer der Parent disablte wird, da - // sich das Fenster evtl. anders Darstellen koennte, - // wenn es disablte wird. Da dieser Fall uns bisher - // nicht bekannt ist, ignorieren wir das. - nRet = HT_NORMAL; - bDef = FALSE; - break; - - case WM_ERASEBACKGROUND: - nRet = (MRESULT)FALSE; - bDef = FALSE; - break; - case WM_PAINT: - { - HPS hPS; - RECTL aRect; - hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect ); - WinEndPaint( hPS ); - bDef = FALSE; - } - break; - } - - if ( bDef ) - nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); - return nRet; -} - -// ======================================================================= - -void ImplDestroyAllClipWindows( HWND hWndLast ) -{ - if ( hWndLast == HWND_TOP ) - return; - - HWND hWndPrev; - while ( hWndLast ) - { - hWndPrev = WinQueryWindow( hWndLast, QW_PREV ); - WinDestroyWindow( hWndLast ); - hWndLast = hWndPrev; - } -} - -// ======================================================================= - -SalObject* ImplSalCreateObject( Os2SalInstance* pInst, Os2SalFrame* pParent ) -{ - SalData* pSalData = GetSalData(); - - if ( !pSalData->mbObjClassInit ) - { - if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CLASSNAME, - (PFNWP)SalSysObjWndProc, CS_MOVENOTIFY, - SAL_OBJECT_WNDEXTRA ) ) - { - if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CLIPCLASSNAME, - (PFNWP)SalSysObjClipWndProc, CS_HITTEST | CS_MOVENOTIFY, 0 ) ) - { - if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CHILDCLASSNAME, - (PFNWP)SalSysObjChildWndProc, CS_HITTEST | CS_MOVENOTIFY, 32 ) ) - pSalData->mbObjClassInit = TRUE; - } - } - } - - if ( pSalData->mbObjClassInit ) - { - Os2SalObject* pObject = new Os2SalObject; - HWND hWnd = WinCreateWindow( pParent->mhWndClient, SAL_OBJECT_CLASSNAME, "", - 0, - 0, 0, 0, 0, - pParent->mhWndClient, HWND_TOP, - 0, NULL, (void*)pObject ); - HWND hWndChild = WinCreateWindow( hWnd, SAL_OBJECT_CHILDCLASSNAME, "", - WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE, - 0, 0, 0, 0, - hWnd, HWND_TOP, - 0, NULL, NULL ); - - if ( !hWndChild ) - { - if ( hWnd ) - WinDestroyWindow( hWnd ); - delete pObject; - return NULL; - } - - if ( hWnd ) - { - debug_printf("ImplSalCreateObject hWndChild %x\n", hWndChild); - debug_printf("ImplSalCreateObject hWnd %x\n", hWnd); - pObject->mhWnd = hWnd; - pObject->mhWndChild = hWndChild; - pObject->maSysData.hWnd = hWndChild; - return pObject; - } - } - - return NULL; -} - -// ======================================================================= - -long ImplSalObjCallbackDummy( void*, SalObject*, USHORT, const void* ) -{ - return 0; -} - -// ======================================================================= - -Os2SalObject::Os2SalObject() -{ - SalData* pSalData = GetSalData(); - - mhLastClipWnd = HWND_TOP; - - mhWnd = 0; - mhWndChild = 0; - mhLastFocusWnd = 0; - maSysData.nSize = sizeof( SystemEnvData ); - mnHeight = 0; - mpInst = NULL; - mpProc = ImplSalObjCallbackDummy; - - // Hook installieren, wenn es das erste Os2SalObject ist - if ( !pSalData->mpFirstObject ) - { - WinSetHook( pSalData->mhAB, pSalData->mhMQ, - HK_INPUT, (PFN)SalSysMsgProc, (HMODULE)0 ); - } - - // Insert object in objectlist - mpNextObject = pSalData->mpFirstObject; - pSalData->mpFirstObject = this; -} - -// ----------------------------------------------------------------------- - -Os2SalObject::~Os2SalObject() -{ - SalData* pSalData = GetSalData(); - - // remove frame from framelist - if ( this == pSalData->mpFirstObject ) - { - pSalData->mpFirstObject = mpNextObject; - - // Wenn letztes Os2SalObject, dann Hook wieder entfernen - if ( !pSalData->mpFirstObject ) - { - WinReleaseHook( pSalData->mhAB, pSalData->mhMQ, - HK_INPUT, (PFN)SalSysMsgProc, (HMODULE)0 ); - } - } - else - { - Os2SalObject* pTempObject = pSalData->mpFirstObject; - while ( pTempObject->mpNextObject != this ) - pTempObject = pTempObject->mpNextObject; - - pTempObject->mpNextObject = mpNextObject; - } - - // Cache-Daten zerstoeren - ImplDestroyAllClipWindows( mhLastClipWnd ); - - if ( mhWndChild ) - WinDestroyWindow( mhWndChild ); - if ( mhWnd ) - WinDestroyWindow( mhWnd ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::ResetClipRegion() -{ - ImplDestroyAllClipWindows( mhLastClipWnd ); - mhLastClipWnd = HWND_TOP; -} - -// ----------------------------------------------------------------------- - -USHORT Os2SalObject::GetClipRegionType() -{ - return SAL_OBJECT_CLIP_EXCLUDERECTS; -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::BeginSetClipRegion( ULONG nRectCount ) -{ - mhOldLastClipWnd = mhLastClipWnd; -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - HWND hClipWnd = WinCreateWindow( mhWnd, SAL_OBJECT_CLIPCLASSNAME, "", - WS_VISIBLE, - nX, mnHeight-(nY+nHeight), nWidth, nHeight, - mhWnd, mhLastClipWnd, - 0, NULL, NULL ); - debug_printf("Os2SalObject::UnionClipRegion hClipWnd %x\n", hClipWnd); - mhLastClipWnd = hClipWnd; -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::EndSetClipRegion() -{ - ImplDestroyAllClipWindows( mhOldLastClipWnd ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) -{ - ULONG nStyle = 0; - BOOL bVisible = WinIsWindowVisible( mhWnd ); - if ( bVisible ) - { - WinShowWindow( mhWnd, FALSE ); - nStyle |= SWP_SHOW; - } - SWP aParentSWP; - WinQueryWindowPos( WinQueryWindow( mhWnd, QW_PARENT ), &aParentSWP ); - WinSetWindowPos( mhWnd, 0, nX, aParentSWP.cy-(nY+nHeight), nWidth, nHeight, - SWP_MOVE | SWP_SIZE | nStyle ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::Show( BOOL bVisible ) -{ - WinShowWindow( mhWnd, bVisible ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::Enable( BOOL bEnable ) -{ - // Im Gegensatz zu Windows disablen wir das Childfenster, - // da ansonsten unser Clippen nicht mehr funktioniert, da - // wir keine Events mehr bekommen. Dadurch kann sich evtl. - // das Fenster anders darstellen, was wir eigentlich nicht - // wollen. Aber da uns bisher kein Fall bekannt ist, - // ignorieren wir dies. Ansonsten muss ein Fenster dazwischen - // gezogen werden oder getestet werden, wie wir die - // Maustransparenz erreichen, wenn mhWnd - // disablte wird. - WinEnableWindow( mhWndChild, bEnable ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::GrabFocus() -{ - if ( mhLastFocusWnd && - WinIsWindow( GetSalData()->mhAB, mhLastFocusWnd ) && - ImplIsSysWindowOrChild( mhWndChild, mhLastFocusWnd ) ) - WinSetFocus( HWND_DESKTOP, mhLastFocusWnd ); - else - WinSetFocus( HWND_DESKTOP, mhWndChild ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::SetBackground() -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::SetBackground( SalColor nSalColor ) -{ -} - -// ----------------------------------------------------------------------- - -const SystemChildData* Os2SalObject::GetSystemData() const -{ - return &maSysData; -} - -// ----------------------------------------------------------------------- -#if 0 -void Os2SalObject::SetCallback( void* pInst, SALOBJECTPROC pProc ) -{ - mpInst = pInst; - if ( pProc ) - mpProc = pProc; - else - mpProc = ImplSalObjCallbackDummy; -} -#endif - -// ----------------------------------------------------------------------- - -void Os2SalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) -{ -} - diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index 352528d87d29..9e0ccdba440b 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -1,4 +1,4 @@ -vc vcl : L10N: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 LIBXSLT:libxslt NULL +vc vcl : TRANSLATIONS:translations 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 cpputools svl LIBXSLT:libxslt NULL vc vcl usr1 - all vc_mkout NULL vc vcl\prj nmake - all vc_prj NULL diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index 8b137891791f..16647e36920a 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -1 +1,4 @@ +..\inc\vcl\fontcapabilities.hxx %_DEST%\inc\vcl\fontcapabilities.hxx +..\inc\vcl\scopedbitmapaccess.hxx %_DEST%\inc\vcl\scopedbitmapaccess.hxx +..\inc\vcl\solarmutex.hxx %_DEST%\inc\vcl\solarmutex.hxx diff --git a/vcl/qa/complex/memCheck/testdocuments/CalcDoc.sxc b/vcl/qa/complex/memCheck/testdocuments/CalcDoc.sxc Binary files differindex 4b2b572085dc..4b2b572085dc 100755..100644 --- a/vcl/qa/complex/memCheck/testdocuments/CalcDoc.sxc +++ b/vcl/qa/complex/memCheck/testdocuments/CalcDoc.sxc diff --git a/vcl/qa/complex/memCheck/testdocuments/ImpressDoc.sxi b/vcl/qa/complex/memCheck/testdocuments/ImpressDoc.sxi Binary files differindex efcdf9b6a25e..efcdf9b6a25e 100755..100644 --- a/vcl/qa/complex/memCheck/testdocuments/ImpressDoc.sxi +++ b/vcl/qa/complex/memCheck/testdocuments/ImpressDoc.sxi diff --git a/vcl/qa/complex/memCheck/testdocuments/WriterDoc.sxw b/vcl/qa/complex/memCheck/testdocuments/WriterDoc.sxw Binary files differindex 1b2c2cb2dab6..1b2c2cb2dab6 100755..100644 --- a/vcl/qa/complex/memCheck/testdocuments/WriterDoc.sxw +++ b/vcl/qa/complex/memCheck/testdocuments/WriterDoc.sxw diff --git a/vcl/source/app/brand.cxx b/vcl/source/app/brand.cxx new file mode 100644 index 000000000000..1657be61c4ff --- /dev/null +++ b/vcl/source/app/brand.cxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Novell, Inc. + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Michael Meeks <michael.meeks@novell.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include <rtl/ustring.hxx> +#include <rtl/bootstrap.hxx> +#include <rtl/locale.hxx> +#include <osl/process.h> +#include <tools/urlobj.hxx> +#include <tools/stream.hxx> +#include <vcl/pngread.hxx> +#include <vcl/svapp.hxx> + +namespace { + static bool loadPng(const char *pPath, const rtl::OUString &rName, BitmapEx &rBitmap) + { + rtl::OUString uri = rtl::OUString::createFromAscii( pPath ) + rName; + rtl::Bootstrap::expandMacros( uri ); + INetURLObject aObj( uri ); + SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ ); + if ( !aStrm.GetError() ) { + vcl::PNGReader aReader( aStrm ); + rBitmap = aReader.Read(); + return !rBitmap.IsEmpty(); + } + else + return false; + } +} + +bool Application::LoadBrandBitmap (const char* pName, BitmapEx &rBitmap) +{ + // TODO - if we want more flexibility we could add a branding path + // in an rc file perhaps fallback to "about.bmp" + rtl::OUString aBaseName = ( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + + rtl::OUString::createFromAscii( pName ) ); + rtl::OUString aPng( RTL_CONSTASCII_USTRINGPARAM(".png") ); + + rtl_Locale *pLoc = NULL; + osl_getProcessLocale (&pLoc); + rtl::OLocale aLoc( pLoc ); + + rtl::OUString aName = aBaseName + aPng; + rtl::OUString aLocaleName = ( aBaseName + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("-")) + + aLoc.getLanguage() + + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("_")) + + aLoc.getCountry() + aPng ); + + return ( loadPng ("$BRAND_BASE_DIR/program/edition", aLocaleName, rBitmap) || + loadPng ("$BRAND_BASE_DIR/program", aLocaleName, rBitmap) || + loadPng ("$BRAND_BASE_DIR/program/edition", aName, rBitmap) || + loadPng ("$BRAND_BASE_DIR/program", aName, rBitmap) ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index 94ebbf3ad9d8..d32fd848b45d 100755 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,8 +40,6 @@ #include "tools/debug.hxx" -#include "vos/mutex.hxx" - #include "vcl/svapp.hxx" #include "vcl/event.hxx" #include "vcl/lstbox.hxx" @@ -1975,6 +1974,7 @@ void DbgAbort( char const * i_message ) void ImplDbgTestSolarMutex() { bool bCheck = ImplGetSVData()->mpDefInst->CheckYieldMutex(); + (void)bCheck; OSL_ENSURE( bCheck, "SolarMutex not locked" ); } @@ -2036,3 +2036,5 @@ sal_uInt16 DbgRegisterNamedUserChannel( const XubString& _rChannelUIName, DbgPri } #endif // DBG_UTIL + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/dndhelp.cxx b/vcl/source/app/dndhelp.cxx index d1eb2014b4df..ceaa8f904816 100644 --- a/vcl/source/app/dndhelp.cxx +++ b/vcl/source/app/dndhelp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -180,3 +181,4 @@ void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const ::com::sun::st mpClient->dropActionChanged( rDTDE ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index ce582916ea62..75bab1a29694 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -381,12 +382,6 @@ HelpTextWindow::~HelpTextWindow() if( this == ImplGetSVData()->maHelpData.mpHelpWin ) ImplGetSVData()->maHelpData.mpHelpWin = NULL; - - if ( maStatusText.Len() ) - { - ImplSVData* pSVData = ImplGetSVData(); - pSVData->mpApp->HideHelpStatusText(); - } } // ----------------------------------------------------------------------- @@ -435,11 +430,6 @@ void HelpTextWindow::SetHelpText( const String& rHelpText ) void HelpTextWindow::ImplShow() { ImplDelData aDogTag( this ); - if ( maStatusText.Len() ) - { - ImplSVData* pSVData = ImplGetSVData(); - pSVData->mpApp->ShowHelpStatusText( maStatusText ); - } Show( sal_True, SHOW_NOACTIVATE ); if( !aDogTag.IsDelete() ) Update(); @@ -801,3 +791,5 @@ void ImplSetHelpWindowPos( Window* pHelpWin, sal_uInt16 nHelpWinStyle, sal_uInt1 aPos = pWindow->AbsoluteScreenToOutputPixel( aPos ); pHelpWin->SetPosPixel( aPos ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/i18nhelp.cxx b/vcl/source/app/i18nhelp.cxx index b7ae51615c08..b55a988fa7da 100644 --- a/vcl/source/app/i18nhelp.cxx +++ b/vcl/source/app/i18nhelp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -187,3 +188,5 @@ String vcl::I18nHelper::GetNum( long nNumber, sal_uInt16 nDecimals, sal_Bool bUs { return ImplGetLocaleDataWrapper().getNum( nNumber, nDecimals, bUseThousandSep, bTrailingZeros ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/idlemgr.cxx b/vcl/source/app/idlemgr.cxx index de1c2b985f4a..57547d80a007 100644 --- a/vcl/source/app/idlemgr.cxx +++ b/vcl/source/app/idlemgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <tools/list.hxx> #include <vcl/svapp.hxx> @@ -43,15 +43,13 @@ struct ImplIdleData sal_Bool mbTimeout; }; -DECLARE_LIST( ImplIdleList, ImplIdleData* ) - #define IMPL_IDLETIMEOUT 350 // ======================================================================= ImplIdleMgr::ImplIdleMgr() { - mpIdleList = new ImplIdleList( 8, 8, 8 ); + mpIdleList = new ImplIdleList(); maTimer.SetTimeout( IMPL_IDLETIMEOUT ); maTimer.SetTimeoutHdl( LINK( this, ImplIdleMgr, TimeoutHdl ) ); @@ -62,13 +60,10 @@ ImplIdleMgr::ImplIdleMgr() ImplIdleMgr::~ImplIdleMgr() { // Liste loeschen - ImplIdleData* pIdleData = mpIdleList->First(); - while ( pIdleData ) - { - delete pIdleData; - pIdleData = mpIdleList->Next(); + for ( size_t i = 0, n = mpIdleList->size(); i < n; ++i ) { + delete (*mpIdleList)[ i ]; } - + mpIdleList->clear(); delete mpIdleList; } @@ -76,30 +71,30 @@ ImplIdleMgr::~ImplIdleMgr() sal_Bool ImplIdleMgr::InsertIdleHdl( const Link& rLink, sal_uInt16 nPriority ) { - sal_uLong nPos = LIST_APPEND; - ImplIdleData* pIdleData = mpIdleList->First(); - while ( pIdleData ) - { - // Wenn Link schon existiert, dann gebe sal_False zurueck - if ( pIdleData->maIdleHdl == rLink ) + size_t nPos = (size_t)-1; + size_t n = mpIdleList->size(); + for ( size_t i = 0; i < n; ++i ) { + // we need to check each element to verify that rLink isn't in the array + if ( (*mpIdleList)[ i ]->maIdleHdl == rLink ) { return sal_False; - - // Nach Prioritaet sortieren - if ( nPriority <= pIdleData->mnPriority ) - nPos = mpIdleList->GetCurPos(); - - // Schleife nicht beenden, da noch - // geprueft werden muss, ob sich der Link - // schon in der Liste befindet - - pIdleData = mpIdleList->Next(); + } + if ( nPriority <= (*mpIdleList)[ i ]->mnPriority ) { + nPos = i; + } } - pIdleData = new ImplIdleData; + ImplIdleData* pIdleData = new ImplIdleData; pIdleData->maIdleHdl = rLink; pIdleData->mnPriority = nPriority; pIdleData->mbTimeout = sal_False; - mpIdleList->Insert( pIdleData, nPos ); + + if ( nPos < mpIdleList->size() ) { + ImplIdleList::iterator it = mpIdleList->begin(); + ::std::advance( it, nPos ); + mpIdleList->insert( it, pIdleData ); + } else { + mpIdleList->push_back( pIdleData ); + } // Wenn Timer noch nicht gestartet ist, dann starten if ( !maTimer.IsActive() ) @@ -112,21 +107,16 @@ sal_Bool ImplIdleMgr::InsertIdleHdl( const Link& rLink, sal_uInt16 nPriority ) void ImplIdleMgr::RemoveIdleHdl( const Link& rLink ) { - ImplIdleData* pIdleData = mpIdleList->First(); - while ( pIdleData ) - { - if ( pIdleData->maIdleHdl == rLink ) - { - mpIdleList->Remove(); - delete pIdleData; + for ( ImplIdleList::iterator it = mpIdleList->begin(); it < mpIdleList->end(); ++it ) { + if ( (*it)->maIdleHdl == rLink ) { + delete *it; + mpIdleList->erase( it ); break; } - - pIdleData = mpIdleList->Next(); } // keine Handdler mehr da - if ( !mpIdleList->Count() ) + if ( mpIdleList->empty() ) maTimer.Stop(); } @@ -134,20 +124,22 @@ void ImplIdleMgr::RemoveIdleHdl( const Link& rLink ) IMPL_LINK( ImplIdleMgr, TimeoutHdl, Timer*, EMPTYARG ) { - ImplIdleData* pIdleData = mpIdleList->First(); - while ( pIdleData ) - { - if ( !pIdleData->mbTimeout ) - { + for ( size_t i = 0; i < mpIdleList->size(); ++i ) { + ImplIdleData* pIdleData = (*mpIdleList)[ i ]; + if ( !pIdleData->mbTimeout ) { pIdleData->mbTimeout = sal_True; pIdleData->maIdleHdl.Call( GetpApp() ); - // Kann im Handler entfernt worden sein - if ( mpIdleList->GetPos( pIdleData ) != LIST_ENTRY_NOTFOUND ) - pIdleData->mbTimeout = sal_False; + // May have been removed in the handler + for ( size_t j = 0; j < mpIdleList->size(); ++j ) { + if ( (*mpIdleList)[ j ] == pIdleData ) { + pIdleData->mbTimeout = sal_False; + break; + } + } } - - pIdleData = mpIdleList->Next(); } return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 3bb06c03ebdb..d30637f1e54e 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -161,3 +162,4 @@ SalMenuItem::~SalMenuItem() { } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index 780d91c4e41a..afcbab4bcc71 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,7 +54,8 @@ namespace css = com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::frame; -using namespace rtl; + +using ::rtl::OUString; SalSession::~SalSession() { @@ -366,7 +368,7 @@ OUString SAL_CALL vcl_session_getImplementationName() Sequence< rtl::OUString > SAL_CALL vcl_session_getSupportedServiceNames() { Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.frame.SessionManagerClient"); + aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.SessionManagerClient")); return aRet; } @@ -378,3 +380,5 @@ css::uno::Reference< XInterface > SAL_CALL vcl_session_createInstance( const css return css::uno::Reference< XInterface >(pSVData->xSMClient, UNO_QUERY ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 55974b57815c..9ffb8bc373da 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" - +#include <svsys.h> #include "tools/debug.hxx" #include "i18npool/mslangid.hxx" @@ -48,17 +49,10 @@ #include "unotools/confignode.hxx" #include "unotools/syslocaleoptions.hxx" -#ifdef WNT -#include "tools/prewin.h" -#include <windows.h> -#include "tools/postwin.h" -#endif +using ::rtl::OUString; #include "svdata.hxx" #include "impimagetree.hxx" - -using namespace rtl; - // ======================================================================= DBG_NAME( AllSettings ) @@ -436,6 +430,7 @@ ImplStyleData::ImplStyleData() mnAutoMnemonic = 1; mnToolbarIconSize = STYLE_TOOLBAR_ICONSIZE_UNKNOWN; mnSymbolsStyle = STYLE_SYMBOLS_AUTO; + mnUseImagesInMenus = STYLE_MENUIMAGES_AUTO; mnPreferredSymbolsStyle = STYLE_SYMBOLS_AUTO; mpFontOptions = NULL; @@ -536,7 +531,10 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : mnUseFlatMenues = rData.mnUseFlatMenues; mnAutoMnemonic = rData.mnAutoMnemonic; mnUseImagesInMenus = rData.mnUseImagesInMenus; + mbPreferredUseImagesInMenus = rData.mbPreferredUseImagesInMenus; mnSkipDisabledInMenus = rData.mnSkipDisabledInMenus; + mbHideDisabledMenuItems = rData.mbHideDisabledMenuItems; + mnAcceleratorsInContextMenus = rData.mnAcceleratorsInContextMenus; mnToolbarIconSize = rData.mnToolbarIconSize; mnSymbolsStyle = rData.mnSymbolsStyle; mnPreferredSymbolsStyle = rData.mnPreferredSymbolsStyle; @@ -550,7 +548,7 @@ void ImplStyleData::SetStandardStyles() Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) ); aStdFont.SetCharSet( gsl_getSystemTextEncoding() ); aStdFont.SetWeight( WEIGHT_NORMAL ); - aStdFont.SetName( utl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) ); + aStdFont.SetName( utl::DefaultFontConfiguration::get().getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) ); maAppFont = aStdFont; maHelpFont = aStdFont; maMenuFont = aStdFont; @@ -562,8 +560,8 @@ void ImplStyleData::SetStandardStyles() maPushButtonFont = aStdFont; maFieldFont = aStdFont; maIconFont = aStdFont; - maFloatTitleFont = aStdFont; aStdFont.SetWeight( WEIGHT_BOLD ); + maFloatTitleFont = aStdFont; maTitleFont = aStdFont; maFaceColor = Color( COL_LIGHTGRAY ); @@ -623,8 +621,10 @@ void ImplStyleData::SetStandardStyles() mnUseSystemUIFonts = 1; mnUseFlatBorders = 0; mnUseFlatMenues = 0; - mnUseImagesInMenus = (sal_uInt16)sal_True; + mbPreferredUseImagesInMenus = sal_True; mnSkipDisabledInMenus = (sal_uInt16)sal_False; + mbHideDisabledMenuItems = sal_False; + mnAcceleratorsInContextMenus = sal_True; Gradient aGrad( GRADIENT_LINEAR, DEFAULT_WORKSPACE_GRADIENT_START_COLOR, DEFAULT_WORKSPACE_GRADIENT_END_COLOR ); maWorkspaceGradient = Wallpaper( aGrad ); @@ -696,36 +696,39 @@ void StyleSettings::Set3DColors( const Color& rColor ) { switch ( nStyle ) { - case STYLE_SYMBOLS_DEFAULT: return ::rtl::OUString::createFromAscii( "default" ); - case STYLE_SYMBOLS_HICONTRAST: return ::rtl::OUString::createFromAscii( "hicontrast" ); - case STYLE_SYMBOLS_INDUSTRIAL: return ::rtl::OUString::createFromAscii( "industrial" ); - case STYLE_SYMBOLS_CRYSTAL: return ::rtl::OUString::createFromAscii( "crystal" ); - case STYLE_SYMBOLS_TANGO: return ::rtl::OUString::createFromAscii( "tango" ); - case STYLE_SYMBOLS_OXYGEN: return ::rtl::OUString::createFromAscii( "oxygen" ); - case STYLE_SYMBOLS_CLASSIC: return ::rtl::OUString::createFromAscii( "classic" ); + case STYLE_SYMBOLS_DEFAULT: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default")); + case STYLE_SYMBOLS_HICONTRAST: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hicontrast")); + case STYLE_SYMBOLS_INDUSTRIAL: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tango")); // industrial is dead + case STYLE_SYMBOLS_CRYSTAL: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("crystal")); + case STYLE_SYMBOLS_TANGO: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tango")); + case STYLE_SYMBOLS_OXYGEN: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("oxygen")); + case STYLE_SYMBOLS_CLASSIC: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("classic")); + case STYLE_SYMBOLS_HUMAN: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("human")); } - return ::rtl::OUString::createFromAscii( "auto" ); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("auto")); } // ----------------------------------------------------------------------- sal_uLong StyleSettings::ImplNameToSymbolsStyle( const ::rtl::OUString &rName ) const { - if ( rName == ::rtl::OUString::createFromAscii( "default" ) ) + if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default")) ) return STYLE_SYMBOLS_DEFAULT; - else if ( rName == ::rtl::OUString::createFromAscii( "hicontrast" ) ) + else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hicontrast")) ) return STYLE_SYMBOLS_HICONTRAST; - else if ( rName == ::rtl::OUString::createFromAscii( "industrial" ) ) - return STYLE_SYMBOLS_INDUSTRIAL; - else if ( rName == ::rtl::OUString::createFromAscii( "crystal" ) ) + else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("industrial")) ) + return STYLE_SYMBOLS_TANGO; // industrial is dead + else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("crystal")) ) return STYLE_SYMBOLS_CRYSTAL; - else if ( rName == ::rtl::OUString::createFromAscii( "tango" ) ) + else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tango")) ) return STYLE_SYMBOLS_TANGO; - else if ( rName == ::rtl::OUString::createFromAscii( "oxygen" ) ) + else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("oxygen")) ) return STYLE_SYMBOLS_OXYGEN; - else if ( rName == ::rtl::OUString::createFromAscii( "classic" ) ) + else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("classic")) ) return STYLE_SYMBOLS_CLASSIC; + else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("human")) ) + return STYLE_SYMBOLS_HUMAN; return STYLE_SYMBOLS_AUTO; } @@ -750,6 +753,21 @@ void StyleSettings::SetPreferredSymbolsStyleName( const ::rtl::OUString &rName ) } } +void StyleSettings::SetCheckedColorSpecialCase( ) +{ + CopyData(); + // Light gray checked color special case + if ( GetFaceColor() == COL_LIGHTGRAY ) + mpData->maCheckedColor = Color( 0xCC, 0xCC, 0xCC ); + else + { + sal_uInt8 nRed = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetRed() + (sal_uInt16)mpData->maLightColor.GetRed())/2); + sal_uInt8 nGreen = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetGreen() + (sal_uInt16)mpData->maLightColor.GetGreen())/2); + sal_uInt8 nBlue = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetBlue() + (sal_uInt16)mpData->maLightColor.GetBlue())/2); + mpData->maCheckedColor = Color( nRed, nGreen, nBlue ); + } +} + // ----------------------------------------------------------------------- sal_uLong StyleSettings::GetCurrentSymbolsStyle() const @@ -811,7 +829,8 @@ sal_uLong StyleSettings::GetAutoSymbolsStyle() const if( bCont ) { - if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) ) + if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) || + rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "windows" ) ) nRet = STYLE_SYMBOLS_TANGO; else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) ) nRet = STYLE_SYMBOLS_CRYSTAL; @@ -851,12 +870,28 @@ sal_uLong StyleSettings::GetAutoSymbolsStyle() const bool StyleSettings::CheckSymbolStyle( sal_uLong nStyle ) const { + if ( nStyle == STYLE_SYMBOLS_INDUSTRIAL ) + return false; // industrial is dead + static ImplImageTreeSingletonRef aImageTree; return aImageTree->checkStyle( ImplSymbolsStyleToName( nStyle ) ); } // ----------------------------------------------------------------------- +sal_Bool StyleSettings::GetUseImagesInMenus() const +{ + // icon mode selected in Tools -> Options... -> OpenOffice.org -> View + sal_uInt16 nStyle = mpData->mnUseImagesInMenus; + + if ( nStyle == STYLE_MENUIMAGES_AUTO ) + return GetPreferredUseImagesInMenus(); + + return (sal_Bool)nStyle; +} + +// ----------------------------------------------------------------------- + void StyleSettings::SetStandardStyles() { CopyData(); @@ -1063,7 +1098,10 @@ sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const (mpData->maFieldFont == rSet.mpData->maFieldFont) && (mpData->maIconFont == rSet.mpData->maIconFont) && (mpData->mnUseImagesInMenus == rSet.mpData->mnUseImagesInMenus) && + (mpData->mbPreferredUseImagesInMenus == rSet.mpData->mbPreferredUseImagesInMenus) && (mpData->mnSkipDisabledInMenus == rSet.mpData->mnSkipDisabledInMenus) && + (mpData->mbHideDisabledMenuItems == rSet.mpData->mbHideDisabledMenuItems) && + (mpData->mnAcceleratorsInContextMenus == rSet.mpData->mnAcceleratorsInContextMenus) && (mpData->maFontColor == rSet.mpData->maFontColor )) return sal_True; else @@ -1253,7 +1291,7 @@ void MiscSettings::SetDisablePrinting( sal_Bool bEnable ) vcl::SettingsConfigItem::get()-> setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DesktopManagement" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisablePrinting" ) ), - rtl::OUString::createFromAscii( bEnable ? "true" : "false" ) ); + bEnable ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true")) : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false" )) ); mpData->mnDisablePrinting = bEnable ? 1 : 0; } } @@ -1309,7 +1347,7 @@ void MiscSettings::SetEnableATToolSupport( sal_Bool bEnable ) vcl::SettingsConfigItem::get()-> setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Accessibility" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableATToolSupport" ) ), - rtl::OUString::createFromAscii( bEnable ? "true" : "false" ) ); + bEnable ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true")) : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false" )) ); mpData->mnEnableATT = bEnable ? 1 : 0; } } @@ -1525,8 +1563,6 @@ ImplAllSettingsData::ImplAllSettingsData() meUILanguage = LANGUAGE_SYSTEM; mpLocaleDataWrapper = NULL; mpUILocaleDataWrapper = NULL; - mpCollatorWrapper = NULL; - mpUICollatorWrapper = NULL; mpI18nHelper = NULL; mpUII18nHelper = NULL; maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() ); @@ -1552,8 +1588,6 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) : // called mpLocaleDataWrapper = NULL; mpUILocaleDataWrapper = NULL; - mpCollatorWrapper = NULL; - mpUICollatorWrapper = NULL; mpI18nHelper = NULL; mpUII18nHelper = NULL; } @@ -1566,10 +1600,6 @@ ImplAllSettingsData::~ImplAllSettingsData() delete mpLocaleDataWrapper; if ( mpUILocaleDataWrapper ) delete mpUILocaleDataWrapper; - if ( mpCollatorWrapper ) - delete mpCollatorWrapper; - if ( mpUICollatorWrapper ) - delete mpUICollatorWrapper; if ( mpI18nHelper ) delete mpI18nHelper; if ( mpUII18nHelper ) @@ -1890,11 +1920,11 @@ sal_Bool AllSettings::GetLayoutRTL() const nUIMirroring = 0; // ask configuration only once utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( vcl::unohelper::GetMultiServiceFactory(), - OUString::createFromAscii( "org.openoffice.Office.Common/I18N/CTL" ) ); // note: case sensisitive ! + OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/I18N/CTL")) ); // note: case sensisitive ! if ( aNode.isValid() ) { sal_Bool bTmp = sal_Bool(); - ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString::createFromAscii( "UIMirroring" ) ); + ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("UIMirroring")) ); if( aValue >>= bTmp ) { // found true or false; if it was nil, nothing is changed @@ -1997,32 +2027,6 @@ const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const return *mpData->mpUII18nHelper; } - -// ----------------------------------------------------------------------- -/* -const CollatorWrapper& AllSettings::GetCollatorWrapper() const -{ - if ( !mpData->mpCollatorWrapper ) - { - ((AllSettings*)this)->mpData->mpCollatorWrapper = new CollatorWrapper( vcl::unohelper::GetMultiServiceFactory() ); - ((AllSettings*)this)->mpData->mpCollatorWrapper->loadDefaultCollator( GetLocale(), 0 ); - } - return *mpData->mpCollatorWrapper; -} -*/ -// ----------------------------------------------------------------------- -/* -const CollatorWrapper& AllSettings::GetUICollatorWrapper() const -{ - if ( !mpData->mpUICollatorWrapper ) - { - ((AllSettings*)this)->mpData->mpUICollatorWrapper = new CollatorWrapper( vcl::unohelper::GetMultiServiceFactory() ); - ((AllSettings*)this)->mpData->mpUICollatorWrapper->loadDefaultCollator( GetUILocale(), 0 ); - } - return *mpData->mpUICollatorWrapper; -} -*/ - void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint ) { AllSettings aAllSettings( Application::GetSettings() ); @@ -2042,3 +2046,5 @@ void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint ) Application::SetSettings( aAllSettings ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/salsys.h b/vcl/source/app/solarmutex.cxx index fa76ac349cc9..ab07911fca32 100644 --- a/vcl/os2/inc/salsys.h +++ b/vcl/source/app/solarmutex.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,20 +26,32 @@ * ************************************************************************/ -#ifndef _SV_SALSYS_H -#define _SV_SALSYS_H +#include <vcl/solarmutex.hxx> -#include <vcl/salsys.hxx> -#include <vcl/sv.h> +using namespace vcl; -class SalFrame; +SolarMutexObject::SolarMutexObject() : m_solarMutex( osl_createMutex() ) +{ +} + +SolarMutexObject::~SolarMutexObject() +{ + osl_destroyMutex( m_solarMutex ); +} -// ----------------- -// - SalSystemData - -// ----------------- +void SolarMutexObject::acquire() +{ + osl_acquireMutex( m_solarMutex ); +} + +sal_Bool SolarMutexObject::tryToAcquire() +{ + return osl_tryToAcquireMutex( m_solarMutex ); +} -class SalSystemData +void SolarMutexObject::release() { -}; + osl_releaseMutex( m_solarMutex ); +} -#endif // _SV_SALSYS_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/sound.cxx b/vcl/source/app/sound.cxx index 9c9caa81da49..5fe5b5d38143 100644 --- a/vcl/source/app/sound.cxx +++ b/vcl/source/app/sound.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,6 @@ #include <unotools/localfilehelper.hxx> #include <unotools/ucbstreamhelper.hxx> - #include <vcl/svapp.hxx> #include <vcl/window.hxx> #include <vcl/salbtype.hxx> @@ -57,3 +57,5 @@ void Sound::Beep( SoundType eType, Window* pWindow ) else pWindow->ImplGetFrame()->Beep( eType ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/stdtext.cxx b/vcl/source/app/stdtext.cxx index bbe09eb1b411..d33fbd7da71f 100644 --- a/vcl/source/app/stdtext.cxx +++ b/vcl/source/app/stdtext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -64,3 +65,5 @@ void ShowServiceNotAvailableError( Window* pParent, aBox.Execute(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index da70672b7b2d..fe536addac98 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,8 +40,6 @@ #include "rtl/tencinfo.h" #include "rtl/instance.hxx" -#include "vos/process.hxx" -#include "vos/mutex.hxx" #include "tools/tools.h" #include "tools/debug.hxx" @@ -78,6 +77,8 @@ #include "com/sun/star/awt/XToolkit.hpp" #include "com/sun/star/uno/XNamingService.hpp" #include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "osl/mutex.hxx" +#include "osl/process.h" #include <utility> @@ -145,7 +146,6 @@ namespace } -// #include <usr/refl.hxx> class Reflection; @@ -272,12 +272,6 @@ void Application::ShowStatusText( const XubString& ) // ----------------------------------------------------------------------- -void Application::ShowHelpStatusText( const XubString& ) -{ -} - -// ----------------------------------------------------------------------- - void Application::ActivateExtHelp() { } @@ -296,24 +290,23 @@ void Application::HideStatusText() // ----------------------------------------------------------------------- -void Application::HideHelpStatusText() +void Application::FocusChanged() { } // ----------------------------------------------------------------------- -void Application::FocusChanged() +void Application::DataChanged( const DataChangedEvent& ) { } // ----------------------------------------------------------------------- - -void Application::DataChanged( const DataChangedEvent& ) +void Application::Init() { } // ----------------------------------------------------------------------- -void Application::Init() +void Application::InitFinished() { } @@ -327,18 +320,16 @@ void Application::DeInit() sal_uInt16 Application::GetCommandLineParamCount() { - vos::OStartupInfo aStartInfo; - return (sal_uInt16)aStartInfo.getCommandArgCount(); + return (sal_uInt16)osl_getCommandArgCount(); } // ----------------------------------------------------------------------- XubString Application::GetCommandLineParam( sal_uInt16 nParam ) { - vos::OStartupInfo aStartInfo; - rtl::OUString aParam; - aStartInfo.getCommandArg( nParam, aParam ); - return XubString( aParam ); + rtl::OUString aParam; + osl_getCommandArg( nParam, &aParam.pData ); + return aParam; } // ----------------------------------------------------------------------- @@ -357,10 +348,8 @@ const XubString& Application::GetAppFileName() static String aAppFileName; if( !aAppFileName.Len() ) { - vos::OStartupInfo aStartInfo; - ::rtl::OUString aExeFileName; - - aStartInfo.getExecutableFile( aExeFileName ); + rtl::OUString aExeFileName; + osl_getExecutableFile( &aExeFileName.pData ); // convert path to native file format rtl::OUString aNativeFileName; @@ -527,7 +516,7 @@ void Application::Quit() // ----------------------------------------------------------------------- -vos::IMutex& Application::GetSolarMutex() +osl::SolarMutex& Application::GetSolarMutex() { ImplSVData* pSVData = ImplGetSVData(); return *(pSVData->mpDefInst->GetYieldMutex()); @@ -535,7 +524,7 @@ vos::IMutex& Application::GetSolarMutex() // ----------------------------------------------------------------------- -vos::OThread::TThreadIdentifier Application::GetMainThreadIdentifier() +oslThreadIdentifier Application::GetMainThreadIdentifier() { return ImplGetSVData()->mnMainThreadId; } @@ -850,8 +839,7 @@ void Application::ImplCallEventListeners( sal_uLong nEvent, Window *pWin, void* VclWindowEvent aEvent( pWin, nEvent, pData ); if ( pSVData->maAppData.mpEventListeners ) - if ( !pSVData->maAppData.mpEventListeners->empty() ) - pSVData->maAppData.mpEventListeners->Call( &aEvent ); + pSVData->maAppData.mpEventListeners->Call( &aEvent ); } // ----------------------------------------------------------------------- @@ -861,8 +849,7 @@ void Application::ImplCallEventListeners( VclSimpleEvent* pEvent ) ImplSVData* pSVData = ImplGetSVData(); if ( pSVData->maAppData.mpEventListeners ) - if ( !pSVData->maAppData.mpEventListeners->empty() ) - pSVData->maAppData.mpEventListeners->Call( pEvent ); + pSVData->maAppData.mpEventListeners->Call( pEvent ); } // ----------------------------------------------------------------------- @@ -872,7 +859,7 @@ void Application::AddEventListener( const Link& rEventListener ) ImplSVData* pSVData = ImplGetSVData(); if( !pSVData->maAppData.mpEventListeners ) pSVData->maAppData.mpEventListeners = new VclEventListeners; - pSVData->maAppData.mpEventListeners->push_back( rEventListener ); + pSVData->maAppData.mpEventListeners->addListener( rEventListener ); } // ----------------------------------------------------------------------- @@ -881,7 +868,7 @@ void Application::RemoveEventListener( const Link& rEventListener ) { ImplSVData* pSVData = ImplGetSVData(); if( pSVData->maAppData.mpEventListeners ) - pSVData->maAppData.mpEventListeners->remove( rEventListener ); + pSVData->maAppData.mpEventListeners->removeListener( rEventListener ); } // ----------------------------------------------------------------------- @@ -890,7 +877,7 @@ void Application::AddKeyListener( const Link& rKeyListener ) ImplSVData* pSVData = ImplGetSVData(); if( !pSVData->maAppData.mpKeyListeners ) pSVData->maAppData.mpKeyListeners = new VclEventListeners; - pSVData->maAppData.mpKeyListeners->push_back( rKeyListener ); + pSVData->maAppData.mpKeyListeners->addListener( rKeyListener ); } // ----------------------------------------------------------------------- @@ -899,7 +886,7 @@ void Application::RemoveKeyListener( const Link& rKeyListener ) { ImplSVData* pSVData = ImplGetSVData(); if( pSVData->maAppData.mpKeyListeners ) - pSVData->maAppData.mpKeyListeners->remove( rKeyListener ); + pSVData->maAppData.mpKeyListeners->removeListener( rKeyListener ); } // ----------------------------------------------------------------------- @@ -913,8 +900,7 @@ sal_Bool Application::HandleKey( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyE sal_Bool bProcessed = sal_False; if ( pSVData->maAppData.mpKeyListeners ) - if ( !pSVData->maAppData.mpKeyListeners->empty() ) - bProcessed = pSVData->maAppData.mpKeyListeners->Process( &aEvent ); + bProcessed = pSVData->maAppData.mpKeyListeners->Process( &aEvent ); return bProcessed; } @@ -923,7 +909,7 @@ sal_Bool Application::HandleKey( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyE sal_uLong Application::PostKeyEvent( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyEvent ) { - const ::vos::OGuard aGuard( GetSolarMutex() ); + const SolarMutexGuard aGuard; sal_uLong nEventId = 0; if( pWin && pKeyEvent ) @@ -950,7 +936,7 @@ sal_uLong Application::PostKeyEvent( sal_uLong nEvent, Window *pWin, KeyEvent* p sal_uLong Application::PostMouseEvent( sal_uLong nEvent, Window *pWin, MouseEvent* pMouseEvent ) { - const ::vos::OGuard aGuard( GetSolarMutex() ); + const SolarMutexGuard aGuard; sal_uLong nEventId = 0; if( pWin && pMouseEvent ) @@ -985,7 +971,7 @@ sal_uLong Application::PostMouseEvent( sal_uLong nEvent, Window *pWin, MouseEven IMPL_STATIC_LINK_NOINSTANCE( Application, PostEventHandler, void*, pCallData ) { - const ::vos::OGuard aGuard( GetSolarMutex() ); + const SolarMutexGuard aGuard; ImplPostEventData* pData = static_cast< ImplPostEventData * >( pCallData ); const void* pEventData; sal_uLong nEvent; @@ -1048,7 +1034,7 @@ IMPL_STATIC_LINK_NOINSTANCE( Application, PostEventHandler, void*, pCallData ) void Application::RemoveMouseAndKeyEvents( Window* pWin ) { - const ::vos::OGuard aGuard( GetSolarMutex() ); + const SolarMutexGuard aGuard; // remove all events for specific window, watch for destruction of internal data ::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() ); @@ -1072,7 +1058,7 @@ void Application::RemoveMouseAndKeyEvents( Window* pWin ) sal_Bool Application::IsProcessedMouseOrKeyEvent( sal_uLong nEventId ) { - const ::vos::OGuard aGuard( GetSolarMutex() ); + const SolarMutexGuard aGuard; // find event ::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() ); @@ -1601,7 +1587,7 @@ Window* Application::GetDefDialogParent() // check for corrupted window hierarchy, #122232#, may be we now crash somewhere else if( !pWin->mpWindowImpl ) { - DBG_ERROR( "Window hierarchy corrupted!" ); + OSL_FAIL( "Window hierarchy corrupted!" ); pSVData->maWinData.mpFocusWin = NULL; // avoid further access return NULL; } @@ -2091,3 +2077,5 @@ void Application::SetPropertyHandler( PropertyHandler* p ) void Application::AppEvent( const ApplicationEvent& /*rAppEvent*/ ) { } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 51bbbef353a8..7648dbbae75c 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,18 +31,17 @@ #include <string.h> -#include "rtl/instance.hxx" +#include <boost/ptr_container/ptr_vector.hpp> -#include "osl/process.h" -#include "osl/file.hxx" +#include <osl/file.hxx> +#include <osl/mutex.hxx> +#include <rtl/process.h> #include "tools/debug.hxx" #include "tools/resary.hxx" #include "unotools/fontcfg.hxx" -#include "vos/mutex.hxx" - #include "cppuhelper/implbase1.hxx" #include "uno/current_context.hxx" @@ -53,7 +53,6 @@ #include "vcl/unohelp.hxx" #include "vcl/button.hxx" // for Button::GetStandardText #include "vcl/dockwin.hxx" // for DockingManager - #include "salinst.hxx" #include "salframe.hxx" #include "svdata.hxx" @@ -81,7 +80,7 @@ namespace css = com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::awt; -using namespace rtl; +using ::rtl::OUString; // ======================================================================= @@ -130,7 +129,7 @@ void ImplInitSVData() { rtl::OUString aArg; osl_getCommandArg( i, &aArg.pData ); - if( aArg.equalsAscii( "-enableautomation" ) ) + if( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-enableautomation" ) ) ) { pImplSVData->mbIsTestTool = true; break; @@ -331,7 +330,7 @@ com::sun::star::uno::Any AccessBridgeCurrentContext::getValueByName( const rtl:: throw (com::sun::star::uno::RuntimeException) { com::sun::star::uno::Any ret; - if( Name.equalsAscii( "java-vm.interaction-handler" ) ) + if( Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "java-vm.interaction-handler" ) ) ) { // Currently, for accessbility no interaction handler shall be offered. // There may be introduced later on a handler using native toolkits @@ -392,14 +391,14 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) new AccessBridgeCurrentContext( com::sun::star::uno::getCurrentContext() ) ); pSVData->mxAccessBridge = xFactory->createInstanceWithArguments( - OUString::createFromAscii( "com.sun.star.accessibility.AccessBridge" ), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessBridge")), arguments ); } else { pSVData->mxAccessBridge = xFactory->createInstanceWithArguments( - OUString::createFromAscii( "com.sun.star.accessibility.AccessBridge" ), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessBridge")), arguments ); } @@ -521,11 +520,11 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) String aTitle; String aMessage(ResId(SV_ACCESSERROR_BRIDGE_MSG, *pResMgr)); - if( 0 == e.Message.compareTo(::rtl::OUString::createFromAscii("ClassNotFound"), 13) ) + if( 0 == e.Message.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ClassNotFound")), 13) ) { aTitle = String(ResId(SV_ACCESSERROR_MISSING_BRIDGE, *pResMgr)); } - else if( 0 == e.Message.compareTo(::rtl::OUString::createFromAscii("NoSuchMethod"), 12) ) + else if( 0 == e.Message.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NoSuchMethod")), 12) ) { aTitle = String(ResId(SV_ACCESSERROR_WRONG_VERSION, *pResMgr)); } @@ -599,3 +598,4 @@ void LocaleConfigurationListener::ConfigurationChanged( utl::ConfigurationBroadc AllSettings::LocaleSettingsChanged( nHint ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index d819b52f7944..e1f9052792ff 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,10 +31,8 @@ #include "rtl/logfile.hxx" -#include "osl/file.hxx" - -#include "vos/signal.hxx" -#include "vos/process.hxx" +#include <osl/file.hxx> +#include <osl/signal.h> #include "tools/tools.h" #include "tools/debug.hxx" @@ -55,10 +54,9 @@ #include "vcl/lazydelete.hxx" #ifdef WNT -#include <tools/prewin.h> +#include <svsys.h> #include <process.h> // for _beginthreadex #include <ole2.h> // for _beginthreadex -#include <tools/postwin.h> #endif // [ed 5/14/02 Add in explicit check for quartz graphics. OS X will define @@ -86,6 +84,7 @@ #include "impimagetree.hxx" #include "xconnection.hxx" +#include "osl/process.h" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/lang/XComponent.hpp" @@ -97,31 +96,14 @@ #include "rtl/strbuf.hxx" #endif -namespace { - -namespace css = com::sun::star; - -} - -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; - - +using ::rtl::OUString; +using namespace ::com::sun::star; // ======================================================================= -class ImplVCLExceptionHandler : public ::vos::OSignalHandler +oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo* pInfo) { -public: - virtual ::vos::OSignalHandler::TSignalAction SAL_CALL signal( ::vos::OSignalHandler::TSignalInfo* pInfo ); -}; - -// ----------------------------------------------------------------------- - -::vos::OSignalHandler::TSignalAction SAL_CALL ImplVCLExceptionHandler::signal( ::vos::OSignalHandler::TSignalInfo* pInfo ) -{ - static sal_Bool bIn = sal_False; + static bool bIn = false; // Wenn wir nocheinmal abstuerzen, verabschieden wir uns gleich if ( !bIn ) @@ -152,9 +134,9 @@ public: if ( nVCLException ) { - bIn = sal_True; + bIn = true; - ::vos::OGuard aLock(&Application::GetSolarMutex()); + SolarMutexGuard aLock; // Timer nicht mehr anhalten, da ansonsten die UAE-Box // auch nicht mehr gepaintet wird @@ -166,17 +148,18 @@ public: pSVData->mpApp->Exception( nVCLException ); Application::SetSystemWindowMode( nOldMode ); } - bIn = sal_False; + bIn = false; - return vos::OSignalHandler::TAction_CallNextHandler; + return osl_Signal_ActCallNextHdl; } } - return vos::OSignalHandler::TAction_CallNextHandler; + return osl_Signal_ActCallNextHdl; + } // ======================================================================= -sal_Bool ImplSVMain() +int ImplSVMain() { // The 'real' SVMain() RTL_LOGFILE_CONTEXT( aLog, "vcl (ss112471) ::SVMain" ); @@ -185,8 +168,9 @@ sal_Bool ImplSVMain() DBG_ASSERT( pSVData->mpApp, "no instance of class Application" ); - css::uno::Reference<XMultiServiceFactory> xMS; + uno::Reference<lang::XMultiServiceFactory> xMS; + int nReturn = EXIT_FAILURE; sal_Bool bInit = InitVCL( xMS ); @@ -194,7 +178,7 @@ sal_Bool ImplSVMain() { // Application-Main rufen pSVData->maAppData.mbInAppMain = sal_True; - pSVData->mpApp->Main(); + nReturn = pSVData->mpApp->Main(); pSVData->maAppData.mbInAppMain = sal_False; } @@ -209,7 +193,7 @@ sal_Bool ImplSVMain() // be some events in the AWT EventQueue, which need the SolarMutex which // - on the other hand - is destroyed in DeInitVCL(). So empty the queue // here .. - css::uno::Reference< XComponent > xComponent(pSVData->mxAccessBridge, UNO_QUERY); + uno::Reference< lang::XComponent > xComponent(pSVData->mxAccessBridge, uno::UNO_QUERY); if( xComponent.is() ) { sal_uLong nCount = Application::ReleaseSolarMutex(); @@ -219,17 +203,17 @@ sal_Bool ImplSVMain() } DeInitVCL(); - return bInit; + return nReturn; } -sal_Bool SVMain() +int SVMain() { // #i47888# allow for alternative initialization as required for e.g. MacOSX - extern sal_Bool ImplSVMainHook( sal_Bool* ); + extern sal_Bool ImplSVMainHook( int* ); - sal_Bool bInit; - if( ImplSVMainHook( &bInit ) ) - return bInit; + int nRet; + if( ImplSVMainHook( &nRet ) ) + return nRet; else return ImplSVMain(); } @@ -237,12 +221,12 @@ sal_Bool SVMain() // before SVInit is called static Application * pOwnSvApp = NULL; // Exception handler. pExceptionHandler != NULL => VCL already inited -ImplVCLExceptionHandler * pExceptionHandler = NULL; +oslSignalHandler pExceptionHandler = NULL; class Application_Impl : public Application { public: - void Main(){}; + int Main() { return EXIT_SUCCESS; }; }; class DesktopEnvironmentContext: public cppu::WeakImplHelper1< com::sun::star::uno::XCurrentContext > @@ -259,13 +243,13 @@ private: com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > m_xNextContext; }; -Any SAL_CALL DesktopEnvironmentContext::getValueByName( const rtl::OUString& Name) throw (RuntimeException) +uno::Any SAL_CALL DesktopEnvironmentContext::getValueByName( const rtl::OUString& Name) throw (uno::RuntimeException) { - Any retVal; + uno::Any retVal; - if ( 0 == Name.compareToAscii( "system.desktop-environment" ) ) + if (Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("system.desktop-environment"))) { - retVal = makeAny( Application::GetDesktopEnvironment() ); + retVal = uno::makeAny( Application::GetDesktopEnvironment() ); } else if( m_xNextContext.is() ) { @@ -303,11 +287,7 @@ sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang pSVData->maAppData.mxMSF = rSMgr; // Main-Thread-Id merken - pSVData->mnMainThreadId = ::vos::OThread::getCurrentIdentifier(); - - vos::OStartupInfo aStartInfo; - rtl::OUString aExeFileName; - + pSVData->mnMainThreadId = ::osl::Thread::getCurrentIdentifier(); // Sal initialisieren RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ ::CreateSalInstance" ); @@ -328,7 +308,8 @@ sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang // Den AppFileName gleich holen und absolut machen, bevor das // WorkingDirectory sich aendert... - aStartInfo.getExecutableFile( aExeFileName ); + rtl::OUString aExeFileName; + osl_getExecutableFile( &aExeFileName.pData ); // convert path to native file format rtl::OUString aNativeFileName; @@ -341,7 +322,7 @@ sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang pSVData->maGDIData.mpGrfConverter = new GraphicConverter; // Exception-Handler setzen - pExceptionHandler = new ImplVCLExceptionHandler(); + pExceptionHandler = osl_addSignalHandler(VCLExceptionSignal_impl, NULL); // Debug-Daten initialisieren DBGGUI_INIT(); @@ -349,6 +330,33 @@ sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang return sal_True; } +namespace +{ + +/** Serves for destroying the VCL UNO wrapper as late as possible. This avoids + crash at exit in some special cases when a11y is enabled (e.g., when + a bundled extension is registered/deregistered during startup, forcing exit + while the app is still in splash screen.) + */ +class VCLUnoWrapperDeleter : public cppu::WeakImplHelper1<com::sun::star::lang::XEventListener> +{ + virtual void SAL_CALL disposing(lang::EventObject const& rSource) throw(uno::RuntimeException); +}; + +void +VCLUnoWrapperDeleter::disposing(lang::EventObject const& /* rSource */) + throw(uno::RuntimeException) +{ + ImplSVData* const pSVData = ImplGetSVData(); + if (pSVData && pSVData->mpUnoWrapper) + { + pSVData->mpUnoWrapper->Destroy(); + pSVData->mpUnoWrapper = NULL; + } +} + +} + void DeInitVCL() { ImplSVData* pSVData = ImplGetSVData(); @@ -388,7 +396,7 @@ void DeInitVCL() ImplImageTreeSingletonRef()->shutDown(); - delete pExceptionHandler; + osl_removeSignalHandler( pExceptionHandler); pExceptionHandler = NULL; // Debug Daten zuruecksetzen @@ -413,11 +421,6 @@ void DeInitVCL() delete pSVData->maWinData.mpMsgBoxImgList; pSVData->maWinData.mpMsgBoxImgList = NULL; } - if ( pSVData->maWinData.mpMsgBoxHCImgList ) - { - delete pSVData->maWinData.mpMsgBoxHCImgList; - pSVData->maWinData.mpMsgBoxHCImgList = NULL; - } if ( pSVData->maCtrlData.mpCheckImgList ) { delete pSVData->maCtrlData.mpCheckImgList; @@ -458,32 +461,32 @@ void DeInitVCL() 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; pSVData->mpDefaultWin = NULL; } - // #114285# Moved here from ImplDeInitSVData... if ( pSVData->mpUnoWrapper ) { - pSVData->mpUnoWrapper->Destroy(); - pSVData->mpUnoWrapper = NULL; + try + { + uno::Reference<lang::XComponent> const xDesktop( + comphelper::createProcessComponent( + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), + uno::UNO_QUERY_THROW) + ; + xDesktop->addEventListener(new VCLUnoWrapperDeleter()); + } + catch (uno::Exception const&) + { + // ignore + } } pSVData->maAppData.mxMSF.clear(); @@ -648,3 +651,5 @@ void JoinMainLoopThread() #endif } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/svmainhook.cxx b/vcl/source/app/svmainhook.cxx index 789af7efbe2b..dd446125a7aa 100644 --- a/vcl/source/app/svmainhook.cxx +++ b/vcl/source/app/svmainhook.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #ifndef MACOSX -sal_Bool ImplSVMainHook( sal_Bool * ) +sal_Bool ImplSVMainHook( int * ) { return sal_False; // indicate that ImplSVMainHook is not implemented } @@ -56,7 +57,7 @@ static void SourceContextCallBack( void *pInfo ) struct ThreadContext { - sal_Bool* pRet; + int* pRet; CFRunLoopRef* pRunLoopRef; }; @@ -75,7 +76,7 @@ static void RunSVMain(void *pData) _exit( 0 ); } -sal_Bool ImplSVMainHook( sal_Bool *pbInit ) +sal_Bool ImplSVMainHook( int *pnInit ) { // Mac OS X requires that any Cocoa code have a CFRunLoop started in the // primordial thread. Since all of the AWT classes in Java 1.4 and higher @@ -86,7 +87,7 @@ sal_Bool ImplSVMainHook( sal_Bool *pbInit ) CFRunLoopRef runLoopRef = CFRunLoopGetCurrent(); ThreadContext tcx; - tcx.pRet = pbInit; // the return value + tcx.pRet = pnInit; // the return value tcx.pRunLoopRef = &runLoopRef; oslThread hThreadID = osl_createThread(RunSVMain, &tcx); @@ -114,3 +115,5 @@ sal_Bool ImplSVMainHook( sal_Bool *pbInit ) #endif // MACOSX #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx index ec421651637e..fc2242522433 100644 --- a/vcl/source/app/timer.cxx +++ b/vcl/source/app/timer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -318,7 +319,7 @@ void Timer::Start() } else if( !mpTimerData->mpSVTimer ) // TODO: remove when guilty found { - DBG_ERROR( "Timer::Start() on a destroyed Timer!" ); + OSL_FAIL( "Timer::Start() on a destroyed Timer!" ); } else { @@ -376,3 +377,5 @@ AutoTimer& AutoTimer::operator=( const AutoTimer& rTimer ) Timer::operator=( rTimer ); return *this; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx index c67abda51f60..096321e05cfe 100644 --- a/vcl/source/app/unohelp.cxx +++ b/vcl/source/app/unohelp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,7 +46,6 @@ #include <com/sun/star/i18n/XBreakIterator.hpp> #include <com/sun/star/i18n/XCharacterClassification.hpp> -#include <com/sun/star/i18n/XCollator.hpp> #include <com/sun/star/awt/XExtendedToolkit.hpp> #include <com/sun/star/accessibility/AccessibleEventObject.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -75,7 +75,7 @@ static VCLRegServiceInfo aVCLComponentsArray[] = {"dtransX11", sal_True}, #endif #endif -#if defined(WNT) || defined(OS2) +#if defined(WNT) {"sysdtrans", sal_False}, #endif {"dtrans", sal_False}, @@ -103,7 +103,7 @@ uno::Reference< lang::XMultiServiceFactory > vcl::unohelper::GetMultiServiceFact { pSVData->maAppData.mxMSF = ::cppu::createRegistryServiceFactory( aTempFileName, rtl::OUString(), sal_False ); uno::Reference < registry::XImplementationRegistration > xReg( - pSVData->maAppData.mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.registry.ImplementationRegistration" )), uno::UNO_QUERY ); + pSVData->maAppData.mxMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration"))), uno::UNO_QUERY ); if( xReg.is() ) { @@ -116,7 +116,7 @@ uno::Reference< lang::XMultiServiceFactory > vcl::unohelper::GetMultiServiceFact try { xReg->registerImplementation( - OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),aComponentPathString, NULL ); + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")),aComponentPathString, NULL ); } catch( ::com::sun::star::uno::Exception & ) { @@ -142,7 +142,7 @@ uno::Reference < i18n::XBreakIterator > vcl::unohelper::CreateBreakIterator() uno::Reference< lang::XMultiServiceFactory > xMSF = GetMultiServiceFactory(); if ( xMSF.is() ) { - uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ); + uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator")) ); if ( xI.is() ) { uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XBreakIterator >*)0) ); @@ -158,7 +158,7 @@ uno::Reference < i18n::XCharacterClassification > vcl::unohelper::CreateCharacte uno::Reference< lang::XMultiServiceFactory > xMSF = GetMultiServiceFactory(); if ( xMSF.is() ) { - uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.i18n.CharacterClassification" ) ); + uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.CharacterClassification")) ); if ( xI.is() ) { uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XCharacterClassification >*)0) ); @@ -168,22 +168,6 @@ uno::Reference < i18n::XCharacterClassification > vcl::unohelper::CreateCharacte return xB; } -uno::Reference < i18n::XCollator > vcl::unohelper::CreateCollator() -{ - uno::Reference < i18n::XCollator > xB; - uno::Reference< lang::XMultiServiceFactory > xMSF = GetMultiServiceFactory(); - if ( xMSF.is() ) - { - uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.i18n.Collator" ) ); - if ( xI.is() ) - { - uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XCollator >*)0) ); - x >>= xB; - } - } - return xB; -} - ::rtl::OUString vcl::unohelper::CreateLibraryName( const sal_Char* pModName, sal_Bool bSUPD ) { // create variable library name suffixes @@ -191,7 +175,7 @@ uno::Reference < i18n::XCollator > vcl::unohelper::CreateCollator() OUString aLibName; -#if defined( WNT) || defined(OS2) +#if defined( WNT) aLibName = OUString::createFromAscii( pModName ); if ( bSUPD ) { @@ -234,3 +218,5 @@ void vcl::unohelper::NotifyAccessibleStateEventGlobally( const ::com::sun::star: } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/unohelp2.cxx b/vcl/source/app/unohelp2.cxx index 514d95032d6f..1fe4158433a0 100644 --- a/vcl/source/app/unohelp2.cxx +++ b/vcl/source/app/unohelp2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -110,3 +111,5 @@ namespace vcl { namespace unohelper { } }} // namespace vcl::unohelper + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx index 33f22a3a50d5..0ce3cc90f633 100644 --- a/vcl/source/app/vclevent.cxx +++ b/vcl/source/app/vclevent.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,8 +59,11 @@ Reference<XAccessible> VclAccessibleEvent::GetAccessible() const void VclEventListeners::Call( VclSimpleEvent* pEvent ) const { + if ( m_aListeners.empty() ) + return; + // Copy the list, because this can be destroyed when calling a Link... - std::list<Link> aCopy( *this ); + std::list<Link> aCopy( m_aListeners ); std::list<Link>::iterator aIter( aCopy.begin() ); if( pEvent->IsA( VclWindowEvent::StaticType() ) ) { @@ -83,9 +87,12 @@ void VclEventListeners::Call( VclSimpleEvent* pEvent ) const sal_Bool VclEventListeners::Process( VclSimpleEvent* pEvent ) const { + if ( m_aListeners.empty() ) + return sal_False; + sal_Bool bProcessed = sal_False; // Copy the list, because this can be destroyed when calling a Link... - std::list<Link> aCopy( *this ); + std::list<Link> aCopy( m_aListeners ); std::list<Link>::iterator aIter( aCopy.begin() ); while ( aIter != aCopy.end() ) { @@ -99,6 +106,16 @@ sal_Bool VclEventListeners::Process( VclSimpleEvent* pEvent ) const return bProcessed; } +void VclEventListeners::addListener( const Link& rListener ) +{ + m_aListeners.push_back( rListener ); +} + +void VclEventListeners::removeListener( const Link& rListener ) +{ + m_aListeners.remove( rListener ); +} + VclEventListeners2::VclEventListeners2() { } @@ -150,3 +167,4 @@ void VclEventListeners2::callListeners( VclSimpleEvent* i_pEvent ) m_aIterators.pop_back(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/components/display.cxx b/vcl/source/components/display.cxx index 6d7653968229..8b6f6bca27aa 100644 --- a/vcl/source/components/display.cxx +++ b/vcl/source/components/display.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -156,8 +157,7 @@ Property SAL_CALL DisplayInfo::getPropertyByName( const OUString& aName ) throw // XServiceInfo OUString SAL_CALL DisplayInfo::getImplementationName( ) throw (RuntimeException) { - static OUString aImplementationName( RTL_CONSTASCII_USTRINGPARAM( "vcl::DisplayInfo" ) ); - return aImplementationName; + return OUString(RTL_CONSTASCII_USTRINGPARAM("vcl::DisplayInfo")); } ::sal_Bool SAL_CALL DisplayInfo::supportsService( const OUString& ServiceName ) throw (RuntimeException) @@ -173,9 +173,8 @@ OUString SAL_CALL DisplayInfo::getImplementationName( ) throw (RuntimeException Sequence< OUString > SAL_CALL DisplayInfo::getSupportedServiceNames( ) throw (RuntimeException) { - static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayInfo" ) ); - static Sequence< OUString > aServiceNames( &aServiceName, 1 ); - return aServiceNames; + OUString aServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DisplayInfo")); + return Sequence< OUString >(&aServiceName, 1); } // ==================================================================== @@ -215,9 +214,8 @@ public: Sequence< OUString > DisplayAccess_getSupportedServiceNames() { - static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ); - static Sequence< OUString > aServiceNames( &aServiceName, 1 ); - return aServiceNames; + OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ); + return Sequence< OUString >( &aServiceName, 1 ); } OUString DisplayAccess_getImplementationName() @@ -343,3 +341,5 @@ Sequence< OUString > SAL_CALL DisplayAccess::getSupportedServiceNames( ) throw } } // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx index f988c58f953e..cfa96a4c7569 100644 --- a/vcl/source/components/dtranscomp.cxx +++ b/vcl/source/components/dtranscomp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include "vos/mutex.hxx" - #include "osl/mutex.hxx" #include "vcl/svapp.hxx" @@ -147,7 +146,7 @@ rtl::OUString GenericClipboard::getImplementationName_static() Sequence< rtl::OUString > GenericClipboard::getSupportedServiceNames_static() { Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard"); + aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard")); return aRet; } @@ -274,7 +273,7 @@ Reference< XInterface > ClipboardFactory::createInstance() throw() Reference< XInterface > ClipboardFactory::createInstanceWithArguments( const Sequence< Any >& arguments ) throw() { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateClipboard( arguments ); return xResult; } @@ -284,7 +283,7 @@ Reference< XInterface > ClipboardFactory::createInstanceWithArguments( const Seq Sequence< OUString > SAL_CALL Clipboard_getSupportedServiceNames() { Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard"); + aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard")); return aRet; } @@ -337,13 +336,13 @@ public: static Sequence< OUString > getSupportedServiceNames_static() { Sequence< OUString > aRet( 1 ); - aRet[0] = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.GenericDragSource" ); + aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.GenericDragSource")); return aRet; } static OUString getImplementationName_static() { - return OUString::createFromAscii( "com.sun.star.datatransfer.dnd.VclGenericDragSource" ); + return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.VclGenericDragSource")); } }; @@ -381,15 +380,14 @@ void GenericDragSource::initialize( const Sequence< Any >& ) throw( Exception ) Sequence< OUString > SAL_CALL DragSource_getSupportedServiceNames() { #if defined UNX - static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( + OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( #if ! defined QUARTZ "com.sun.star.datatransfer.dnd.X11DragSource" #else "com.sun.star.datatransfer.dnd.OleDragSource" #endif ) ); - static Sequence< OUString > aServiceNames( &aServiceName, 1 ); - return aServiceNames; + return Sequence< OUString >(&aServiceName, 1); #else return GenericDragSource::getSupportedServiceNames_static(); #endif @@ -412,7 +410,7 @@ OUString SAL_CALL DragSource_getImplementationName() Reference< XInterface > SAL_CALL DragSource_createInstance( const Reference< XMultiServiceFactory >& ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateDragSource(); return xResult; } @@ -449,13 +447,13 @@ public: static Sequence< OUString > getSupportedServiceNames_static() { Sequence< OUString > aRet( 1 ); - aRet[0] = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.GenericDropTarget" ); + aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.GenericDropTarget")); return aRet; } static OUString getImplementationName_static() { - return OUString::createFromAscii( "com.sun.star.datatransfer.dnd.VclGenericDropTarget" ); + return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.VclGenericDropTarget")); } }; @@ -496,15 +494,14 @@ void GenericDropTarget::setDefaultActions( sal_Int8) throw() Sequence< OUString > SAL_CALL DropTarget_getSupportedServiceNames() { #if defined UNX - static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( + OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( #if ! defined QUARTZ "com.sun.star.datatransfer.dnd.X11DropTarget" #else "com.sun.star.datatransfer.dnd.OleDropTarget" #endif ) ); - static Sequence< OUString > aServiceNames( &aServiceName, 1 ); - return aServiceNames; + return Sequence< OUString >(&aServiceName, 1); #else return GenericDropTarget::getSupportedServiceNames_static(); #endif @@ -527,7 +524,7 @@ OUString SAL_CALL DropTarget_getImplementationName() Reference< XInterface > SAL_CALL DropTarget_createInstance( const Reference< XMultiServiceFactory >& ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateDropTarget(); return xResult; } @@ -553,3 +550,4 @@ Reference< XInterface > SalInstance::CreateDropTarget() return Reference< XInterface >( ( cppu::OWeakObject * )new vcl::GenericDropTarget() ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index 48fb3aac653a..04b0e122cbce 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" #include <tools/debug.hxx> -#ifndef _OSL_MUTEX_HXX #include <osl/mutex.hxx> -#endif -#ifndef _RTL_USTRBUF_HXX #include <rtl/ustrbuf.hxx> -#endif #include <uno/dispatcher.h> // declaration of generic uno interface #include <uno/mapping.hxx> // mapping stuff #include <cppuhelper/factory.hxx> @@ -163,3 +160,5 @@ extern "C" { } } /* extern "C" */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/components/fontident.cxx b/vcl/source/components/fontident.cxx index 2cbea1628f4e..6afadbbe267e 100644 --- a/vcl/source/components/fontident.cxx +++ b/vcl/source/components/fontident.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -209,3 +210,5 @@ Sequence< OUString > SAL_CALL FontIdentificator::getSupportedServiceNames() thro } } // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/components/rasterizer_rsvg.cxx b/vcl/source/components/rasterizer_rsvg.cxx index 5547b179d227..006b30b28e28 100644 --- a/vcl/source/components/rasterizer_rsvg.cxx +++ b/vcl/source/components/rasterizer_rsvg.cxx @@ -48,7 +48,7 @@ #define VCL_RSVG_CAIRO_LIBNAME "libcairo.so" #define VCL_RSVG_LIBRSVG_LIBNAME "librsvg-2.so" #elif defined WNT - #define VCL_RSVG_GOBJECT_LIBNAME "libgobject-2.0-0.dll" + #define VCL_RSVG_GOBJECT_LIBNAME "gobjectlo.dll" #define VCL_RSVG_CAIRO_LIBNAME "cairo.dll" #define VCL_RSVG_LIBRSVG_LIBNAME "librsvg-2-2.dll" #else diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 1a6439a0502e..a4a5081b7d2b 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -78,9 +79,7 @@ public: sal_Bool mbSmallSymbol; Image maImage; - Image maImageHC; BitmapEx* mpBitmapEx; - BitmapEx* mpBitmapExHC; ImageAlign meImageAlign; SymbolAlign meSymbolAlign; @@ -96,7 +95,6 @@ ImplCommonButtonData::ImplCommonButtonData() mbSmallSymbol = sal_False; mpBitmapEx = NULL; - mpBitmapExHC = NULL; meImageAlign = IMAGEALIGN_TOP; meSymbolAlign = SYMBOLALIGN_LEFT; } @@ -105,7 +103,6 @@ ImplCommonButtonData::ImplCommonButtonData() ImplCommonButtonData::~ImplCommonButtonData() { delete mpBitmapEx; - delete mpBitmapExHC; } // ======================================================================= @@ -181,8 +178,16 @@ XubString Button::GetStandardText( StandardButtonType eButton ) ResMgr* pResMgr = ImplGetResMgr(); if( pResMgr ) { - ResId aResId( aResIdAry[(sal_uInt16)eButton].nResId, *pResMgr ); + sal_uInt32 nResId = aResIdAry[(sal_uInt16)eButton].nResId; + ResId aResId( nResId, *pResMgr ); aText = String( aResId ); + + // Windows (apparently) has some magic auto-accelerator evil around + // ok / cancel so add this only for Unix +#ifdef UNX + if( nResId == SV_BUTTONTEXT_OK || nResId == SV_BUTTONTEXT_CANCEL ) + aText.Insert( String::CreateFromAscii("~"), 0 ); +#endif } else { @@ -200,51 +205,24 @@ XubString Button::GetStandardHelpText( StandardButtonType /* eButton */ ) return aHelpText; } // ----------------------------------------------------------------------- -sal_Bool Button::SetModeImage( const Image& rImage, BmpColorMode eMode ) +sal_Bool Button::SetModeImage( const Image& rImage ) { - if( eMode == BMP_COLOR_NORMAL ) + if ( rImage != mpButtonData->maImage ) { - if ( rImage != mpButtonData->maImage ) - { - delete mpButtonData->mpBitmapEx; + delete mpButtonData->mpBitmapEx; - mpButtonData->mpBitmapEx = NULL; - mpButtonData->maImage = rImage; - - StateChanged( STATE_CHANGE_DATA ); - } - } - else if( eMode == BMP_COLOR_HIGHCONTRAST ) - { - if( rImage != mpButtonData->maImageHC ) - { - delete mpButtonData->mpBitmapExHC; + mpButtonData->mpBitmapEx = NULL; + mpButtonData->maImage = rImage; - mpButtonData->mpBitmapExHC = NULL; - mpButtonData->maImageHC = rImage; - - StateChanged( STATE_CHANGE_DATA ); - } + StateChanged( STATE_CHANGE_DATA ); } - else - return sal_False; - return sal_True; } // ----------------------------------------------------------------------- -const Image Button::GetModeImage( BmpColorMode eMode ) const +const Image Button::GetModeImage( ) const { - if( eMode == BMP_COLOR_NORMAL ) - { - return mpButtonData->maImage; - } - else if( eMode == BMP_COLOR_HIGHCONTRAST ) - { - return mpButtonData->maImageHC; - } - else - return Image(); + return mpButtonData->maImage; } // ----------------------------------------------------------------------- @@ -270,43 +248,24 @@ ImageAlign Button::GetImageAlign() const } // ----------------------------------------------------------------------- -sal_Bool Button::SetModeBitmap( const BitmapEx& rBitmap, BmpColorMode eMode ) +sal_Bool Button::SetModeBitmap( const BitmapEx& rBitmap ) { - if ( SetModeImage( rBitmap, eMode ) ) + if ( SetModeImage( rBitmap ) ) { - if( eMode == BMP_COLOR_NORMAL ) - { - if ( !mpButtonData->mpBitmapEx ) - mpButtonData->mpBitmapEx = new BitmapEx( rBitmap ); - } - else if ( eMode == BMP_COLOR_HIGHCONTRAST ) - { - if ( !mpButtonData->mpBitmapExHC ) - mpButtonData->mpBitmapExHC = new BitmapEx( rBitmap ); - } - else - return sal_False; - + if ( !mpButtonData->mpBitmapEx ) + mpButtonData->mpBitmapEx = new BitmapEx( rBitmap ); return sal_True; } return sal_False; } // ----------------------------------------------------------------------- -BitmapEx Button::GetModeBitmap( BmpColorMode eMode ) const +BitmapEx Button::GetModeBitmap( ) const { BitmapEx aBmp; - if ( eMode == BMP_COLOR_NORMAL ) - { - if ( mpButtonData->mpBitmapEx ) - aBmp = *( mpButtonData->mpBitmapEx ); - } - else if ( eMode == BMP_COLOR_HIGHCONTRAST ) - { - if ( mpButtonData->mpBitmapExHC ) - aBmp = *( mpButtonData->mpBitmapExHC ); - } + if ( mpButtonData->mpBitmapEx ) + aBmp = *( mpButtonData->mpBitmapEx ); return aBmp; } @@ -420,15 +379,6 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Image *pImage = &(mpButtonData->maImage); BitmapEx *pBitmapEx = mpButtonData->mpBitmapEx; - if( !!(mpButtonData->maImageHC) ) - { - if( GetSettings().GetStyleSettings().GetHighContrastMode() ) - { - pImage = &(mpButtonData->maImageHC); - pBitmapEx = mpButtonData->mpBitmapExHC; - } - } - if ( pBitmapEx && ( pDev->GetOutDevType() == OUTDEV_PRINTER ) ) { // Die Groesse richtet sich nach dem Bildschirm, soll auf @@ -480,21 +430,21 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, if ( bDrawText ) { - if ( ( eImageAlign == IMAGEALIGN_LEFT_TOP ) || - ( eImageAlign == IMAGEALIGN_LEFT ) || - ( eImageAlign == IMAGEALIGN_LEFT_BOTTOM ) || - ( eImageAlign == IMAGEALIGN_RIGHT_TOP ) || - ( eImageAlign == IMAGEALIGN_RIGHT ) || - ( eImageAlign == IMAGEALIGN_RIGHT_BOTTOM ) ) + if ( ( eImageAlign == IMAGEALIGN_LEFT_TOP ) || + ( eImageAlign == IMAGEALIGN_LEFT ) || + ( eImageAlign == IMAGEALIGN_LEFT_BOTTOM ) || + ( eImageAlign == IMAGEALIGN_RIGHT_TOP ) || + ( eImageAlign == IMAGEALIGN_RIGHT ) || + ( eImageAlign == IMAGEALIGN_RIGHT_BOTTOM ) ) { aRect.Right() -= ( aImageSize.Width() + nImageSep ); } - else if ( ( eImageAlign == IMAGEALIGN_TOP_LEFT ) || - ( eImageAlign == IMAGEALIGN_TOP ) || - ( eImageAlign == IMAGEALIGN_TOP_RIGHT ) || - ( eImageAlign == IMAGEALIGN_BOTTOM_LEFT ) || - ( eImageAlign == IMAGEALIGN_BOTTOM ) || - ( eImageAlign == IMAGEALIGN_BOTTOM_RIGHT ) ) + else if ( ( eImageAlign == IMAGEALIGN_TOP_LEFT ) || + ( eImageAlign == IMAGEALIGN_TOP ) || + ( eImageAlign == IMAGEALIGN_TOP_RIGHT ) || + ( eImageAlign == IMAGEALIGN_BOTTOM_LEFT ) || + ( eImageAlign == IMAGEALIGN_BOTTOM ) || + ( eImageAlign == IMAGEALIGN_BOTTOM_RIGHT ) ) { aRect.Bottom() -= ( aImageSize.Height() + nImageSep ); } @@ -515,7 +465,7 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, } } - aMax.Width() = aTSSize.Width() > aImageSize.Width() ? aTSSize.Width() : aImageSize.Width(); + aMax.Width() = aTSSize.Width() > aImageSize.Width() ? aTSSize.Width() : aImageSize.Width(); aMax.Height() = aTSSize.Height() > aImageSize.Height() ? aTSSize.Height() : aImageSize.Height(); // Now calculate the output area for the image and the text acording to the image align flags @@ -681,9 +631,9 @@ void Button::ImplSetFocusRect( const Rectangle &rFocusRect ) aFocusRect.Bottom()++; } - if ( aFocusRect.Left() < aOutputRect.Left() ) aFocusRect.Left() = aOutputRect.Left(); - if ( aFocusRect.Top() < aOutputRect.Top() ) aFocusRect.Top() = aOutputRect.Top(); - if ( aFocusRect.Right() > aOutputRect.Right() ) aFocusRect.Right() = aOutputRect.Right(); + if ( aFocusRect.Left() < aOutputRect.Left() ) aFocusRect.Left() = aOutputRect.Left(); + if ( aFocusRect.Top() < aOutputRect.Top() ) aFocusRect.Top() = aOutputRect.Top(); + if ( aFocusRect.Right() > aOutputRect.Right() ) aFocusRect.Right() = aOutputRect.Right(); if ( aFocusRect.Bottom() > aOutputRect.Bottom() ) aFocusRect.Bottom() = aOutputRect.Bottom(); mpButtonData->maFocusRect = aFocusRect; @@ -722,6 +672,7 @@ SymbolAlign Button::ImplGetSymbolAlign() const { return mpButtonData->meSymbolAlign; } + // ----------------------------------------------------------------------- void Button::ImplSetSmallSymbol( sal_Bool bSmall ) { @@ -811,10 +762,10 @@ WinBits PushButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ) if ( !(nStyle & WB_NOGROUP) && (!pPrevWindow || - ((pPrevWindow->GetType() != WINDOW_PUSHBUTTON) && - (pPrevWindow->GetType() != WINDOW_OKBUTTON) && + ((pPrevWindow->GetType() != WINDOW_PUSHBUTTON ) && + (pPrevWindow->GetType() != WINDOW_OKBUTTON ) && (pPrevWindow->GetType() != WINDOW_CANCELBUTTON) && - (pPrevWindow->GetType() != WINDOW_HELPBUTTON)) ) ) + (pPrevWindow->GetType() != WINDOW_HELPBUTTON )) ) ) nStyle |= WB_GROUP; return nStyle; } @@ -1569,7 +1520,7 @@ void PushButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, else aStyleSettings.SetFaceColor( GetSettings().GetStyleSettings().GetFaceColor() ); aSettings.SetStyleSettings( aStyleSettings ); - pDev->SetSettings( aSettings ); + pDev->OutputDevice::SetSettings( aSettings ); } pDev->SetTextFillColor(); @@ -2147,9 +2098,6 @@ void RadioButton::ImplInitSettings( sal_Bool bFont, } } -//--------------------------------------------------------------------- -//--- 12.03.2003 18:46:14 --------------------------------------------- - void RadioButton::DrawRadioButtonState( ) { ImplDrawRadioButtonState( ); @@ -2173,7 +2121,6 @@ void RadioButton::ImplInvalidateOrDrawRadioButtonState() void RadioButton::ImplDrawRadioButtonState() { - sal_uInt16 nButtonStyle = 0; sal_Bool bNativeOK = sal_False; // no native drawing for image radio buttons @@ -2221,12 +2168,12 @@ if ( bNativeOK == sal_False ) Rectangle aImageRect = maStateRect; Size aImageSize = maImage.GetSizePixel(); sal_Bool bEnabled = IsEnabled(); + sal_uInt16 nButtonStyle = FRAME_DRAW_DOUBLEIN; aImageSize.Width() = CalcZoom( aImageSize.Width() ); aImageSize.Height() = CalcZoom( aImageSize.Height() ); // Border und Selektionsstatus ausgeben - nButtonStyle = FRAME_DRAW_DOUBLEIN; aImageRect = aDecoView.DrawFrame( aImageRect, nButtonStyle ); if ( (ImplGetButtonState() & BUTTON_DRAW_PRESSED) || !bEnabled ) SetFillColor( rStyleSettings.GetFaceColor() ); @@ -2240,13 +2187,7 @@ if ( bNativeOK == sal_False ) if ( !bEnabled ) nButtonStyle |= IMAGE_DRAW_DISABLE; - // check for HC mode Image *pImage = &maImage; - if( !!maImageHC ) - { - if( rStyleSettings.GetHighContrastMode() ) - pImage = &maImageHC; - } Point aImagePos( aImageRect.TopLeft() ); aImagePos.X() += (aImageRect.GetWidth()-aImageSize.Width())/2; @@ -2804,7 +2745,7 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize } else { - DBG_ERROR( "RadioButton::Draw() - not implemented for RadioButton with Image" ); + OSL_FAIL( "RadioButton::Draw() - not implemented for RadioButton with Image" ); } } @@ -2942,38 +2883,21 @@ void RadioButton::Toggle() // ----------------------------------------------------------------------- -sal_Bool RadioButton::SetModeRadioImage( const Image& rImage, BmpColorMode eMode ) -{ - if( eMode == BMP_COLOR_NORMAL ) +sal_Bool RadioButton::SetModeRadioImage( const Image& rImage ) { if ( rImage != maImage ) { maImage = rImage; StateChanged( STATE_CHANGE_DATA ); } -} - else if( eMode == BMP_COLOR_HIGHCONTRAST ) - { - if( maImageHC != rImage ) - { - maImageHC = rImage; - StateChanged( STATE_CHANGE_DATA ); - } - } - else - return sal_False; - return sal_True; } // ----------------------------------------------------------------------- -const Image& RadioButton::GetModeRadioImage( BmpColorMode eMode ) const +const Image& RadioButton::GetModeRadioImage( ) const { - if( eMode == BMP_COLOR_HIGHCONTRAST ) - return maImageHC; - else - return maImage; + return maImage; } // ----------------------------------------------------------------------- @@ -3126,10 +3050,11 @@ Image RadioButton::GetRadioImage( const AllSettings& rSettings, sal_uInt16 nFlag ResMgr* pResMgr = ImplGetResMgr(); pSVData->maCtrlData.mpRadioImgList = new ImageList(); if( pResMgr ) - LoadThemedImageList( rStyleSettings, + LoadThemedImageList( rStyleSettings, pSVData->maCtrlData.mpRadioImgList, - ResId( SV_RESID_BITMAP_RADIO+nStyle, *pResMgr ), 6 ); - pSVData->maCtrlData.mnRadioStyle = nStyle; + ResId( SV_RESID_BITMAP_RADIO+nStyle, *pResMgr ), 6 + ); + pSVData->maCtrlData.mnRadioStyle = nStyle; } sal_uInt16 nId; @@ -3213,13 +3138,13 @@ Size RadioButton::CalcMinimumSize( long nMaxWidth ) const if ( aSize.Height() < aTextSize.Height() ) aSize.Height() = aTextSize.Height(); } - else if ( !maImage ) - { +// else if ( !maImage ) +// { /* da ansonsten im Writer die Control zu weit oben haengen aSize.Width() += 2; aSize.Height() += 2; */ - } +// } return CalcWindowSize( aSize ); } @@ -4300,18 +4225,11 @@ void DisclosureButton::ImplDrawCheckBoxState() 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; + pImg = IsChecked() ? rCtrlData.mpDisclosureMinus : rCtrlData.mpDisclosurePlus; DBG_ASSERT( pImg, "no disclosure image" ); if( ! pImg ) @@ -4347,4 +4265,4 @@ void DisclosureButton::KeyInput( const KeyEvent& rKEvt ) Button::KeyInput( rKEvt ); } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 2d6cb76b0512..c01092749e73 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,6 @@ #include <tools/table.hxx> #include <tools/debug.hxx> #include <tools/rc.h> - #include <vcl/decoview.hxx> #include <vcl/lstbox.h> #include <vcl/button.hxx> @@ -44,7 +44,7 @@ #include <controldata.hxx> // ======================================================================= - + inline sal_uLong ImplCreateKey( sal_uInt16 nPos ) { // Key = Pos+1, wegen Pos 0 @@ -66,7 +66,7 @@ static void lcl_GetSelectedEntries( Table& rSelectedPos, const XubString& rText, } // ======================================================================= - + ComboBox::ComboBox( WindowType nType ) : Edit( nType ) { @@ -212,7 +212,7 @@ void ComboBox::ImplInit( Window* pParent, WinBits nStyle ) Window* pLBParent = this; if ( mpFloatWin ) pLBParent = mpFloatWin; - mpImplLB = new ImplListBox( pLBParent, nListStyle|WB_SIMPLEMODE ); + mpImplLB = new ImplListBox( pLBParent, nListStyle|WB_SIMPLEMODE|WB_AUTOHSCROLL ); mpImplLB->SetPosPixel( Point() ); mpImplLB->SetSelectHdl( LINK( this, ComboBox, ImplSelectHdl ) ); mpImplLB->SetCancelHdl( LINK( this, ComboBox, ImplCancelHdl ) ); @@ -467,7 +467,10 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG ) mbSyntheticModify = sal_True; Modify(); mbSyntheticModify = sal_False; - Select(); + if (ImplGetWindowImpl() != NULL) //liuchen 2009-7-28, resolve the problem that soffice get crashed if in ComboBox_Change event a Worksheets("SheetX").Activate sentence needs to be executed + { + Select(); + } } return 0; @@ -1587,3 +1590,5 @@ long ComboBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rPos ) const return nIndex; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 26ef9b076d8c..c9497abaef61 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <comphelper/processfactory.hxx> -#include <tools/diagnose_ex.h> #include <tools/rc.h> - #include <vcl/svapp.hxx> #include <vcl/event.hxx> #include <vcl/ctrl.hxx> @@ -586,3 +585,5 @@ void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRec _rTargetDevice.Pop(); #endif } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index cd8d64516919..e36cdaf9a0df 100755..100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,7 +46,7 @@ #include <subedit.hxx> #include <controldata.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <com/sun/star/i18n/XBreakIterator.hpp> @@ -56,15 +57,11 @@ #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#ifndef _COM_SUN_STAR_DATATRANSFER_DND_DNDCONSTANS_HPP_ #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> -#endif #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp> #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> -#ifndef _COM_SUN_STAR_I18N_XEXTENDEDINPUTSEQUENCECHECKER_HDL_ #include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp> -#endif #include <com/sun/star/i18n/InputSequenceCheckMode.hpp> #include <com/sun/star/i18n/ScriptType.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -77,6 +74,7 @@ #include <sot/exchange.hxx> #include <sot/formats.hxx> #include <rtl/memory.h> +#include <sal/macros.h> #include <vcl/unohelp.hxx> #include <vcl/unohelp2.hxx> @@ -514,7 +512,7 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) if( aText.Len() ) { - if( 2*aText.Len() > xub_StrLen(sizeof(nDXBuffer)/sizeof(nDXBuffer[0])) ) + if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) ) { pDXBuffer = new sal_Int32[2*(aText.Len()+1)]; pDX = pDXBuffer; @@ -801,7 +799,7 @@ uno::Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const // if ( !xBI.is() ) { uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - uno::Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ); + uno::Reference < XInterface > xI = xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator")) ); if ( xI.is() ) { Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XBreakIterator >*)0) ); @@ -821,7 +819,7 @@ uno::Reference < i18n::XExtendedInputSequenceChecker > Edit::ImplGetInputSequenc // if ( !xISC.is() ) { uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - uno::Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.InputSequenceChecker" ) ); + uno::Reference < XInterface > xI = xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.InputSequenceChecker")) ); if ( xI.is() ) { Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XExtendedInputSequenceChecker >*)0) ); @@ -883,12 +881,12 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_ // determine if input-sequence-checking should be applied or not // - static OUString sModule( OUString::createFromAscii( "/org.openoffice.Office.Common/I18N" ) ); - static OUString sRelNode( OUString::createFromAscii( "CTL" ) ); - static OUString sCTLSequenceChecking( OUString::createFromAscii( "CTLSequenceChecking" ) ); - static OUString sCTLSequenceCheckingRestricted( OUString::createFromAscii( "CTLSequenceCheckingRestricted" ) ); - static OUString sCTLSequenceCheckingTypeAndReplace( OUString::createFromAscii( "CTLSequenceCheckingTypeAndReplace" ) ); - static OUString sCTLFont( OUString::createFromAscii( "CTLFont" ) ); + static OUString sModule( RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/I18N") ); + static OUString sRelNode( RTL_CONSTASCII_USTRINGPARAM("CTL") ); + static OUString sCTLSequenceChecking( RTL_CONSTASCII_USTRINGPARAM("CTLSequenceChecking") ); + static OUString sCTLSequenceCheckingRestricted( RTL_CONSTASCII_USTRINGPARAM("CTLSequenceCheckingRestricted") ); + static OUString sCTLSequenceCheckingTypeAndReplace( RTL_CONSTASCII_USTRINGPARAM("CTLSequenceCheckingTypeAndReplace") ); + static OUString sCTLFont( RTL_CONSTASCII_USTRINGPARAM("CTLFont") ); // sal_Bool bCTLSequenceChecking = sal_False; sal_Bool bCTLSequenceCheckingRestricted = sal_False; @@ -1178,7 +1176,7 @@ void Edit::ImplShowCursor( sal_Bool bOnlyIfVisible ) if( aText.Len() ) { - if( 2*aText.Len() > xub_StrLen(sizeof(nDXBuffer)/sizeof(nDXBuffer[0])) ) + if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) ) { pDXBuffer = new sal_Int32[2*(aText.Len()+1)]; pDX = pDXBuffer; @@ -1302,7 +1300,7 @@ xub_StrLen Edit::ImplGetCharPos( const Point& rWindowPos ) const sal_Int32 nDXBuffer[256]; sal_Int32* pDXBuffer = NULL; sal_Int32* pDX = nDXBuffer; - if( 2*aText.Len() > xub_StrLen(sizeof(nDXBuffer)/sizeof(nDXBuffer[0])) ) + if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) ) { pDXBuffer = new sal_Int32[2*(aText.Len()+1)]; pDX = pDXBuffer; @@ -2097,9 +2095,6 @@ void Edit::Command( const CommandEvent& rCEvt ) if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) { PopupMenu* pPopup = Edit::CreatePopupMenu(); - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( rStyleSettings.GetOptions() & STYLE_OPTION_HIDEDISABLED ) - pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES ); if ( !maSelection.Len() ) { @@ -2936,13 +2931,21 @@ PopupMenu* Edit::CreatePopupMenu() return new PopupMenu(); PopupMenu* pPopup = new PopupMenu( ResId( SV_RESID_MENU_EDIT, *pResMgr ) ); - pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) ); - pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) ); - pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) ); - pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) ); - pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) ); - pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) ); - pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) ); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + if ( rStyleSettings.GetHideDisabledMenuItems() ) + pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES ); + else + pPopup->SetMenuFlags ( MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES ); + if ( rStyleSettings.GetAcceleratorsInContextMenus() ) + { + pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) ); + pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) ); + pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) ); + pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) ); + pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) ); + pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) ); + pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) ); + } return pPopup; } @@ -2956,7 +2959,7 @@ void Edit::DeletePopupMenu( PopupMenu* pMenu ) // ::com::sun::star::datatransfer::dnd::XDragGestureListener void Edit::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& rDGE ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; if ( !IsTracking() && maSelection.Len() && !(GetStyle() & WB_PASSWORD) && (!mpDDInfo || mpDDInfo->bStarterOfDD == sal_False) ) // Kein Mehrfach D&D @@ -2994,7 +2997,7 @@ void Edit::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::Dra // ::com::sun::star::datatransfer::dnd::XDragSourceListener void Edit::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& rDSDE ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; if ( rDSDE.DropSuccess && ( rDSDE.DropAction & datatransfer::dnd::DNDConstants::ACTION_MOVE ) ) { @@ -3020,7 +3023,7 @@ void Edit::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDro // ::com::sun::star::datatransfer::dnd::XDropTargetListener void Edit::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; sal_Bool bChanges = sal_False; if ( !mbReadOnly && mpDDInfo ) @@ -3089,14 +3092,14 @@ void Edit::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragE void Edit::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; ImplHideDDCursor(); } void Edit::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; Point aMousePos( rDTDE.LocationX, rDTDE.LocationY ); @@ -3158,3 +3161,5 @@ Selection Edit::GetSurroundingTextSelection() const { return GetSelection(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index fd69457c8026..e34aa3752895 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,6 @@ #include "rtl/math.hxx" - #include <unotools/localedatawrapper.hxx> using namespace ::com::sun::star; @@ -699,9 +699,15 @@ sal_Int64 NumericFormatter::Denormalize( sal_Int64 nValue ) const { sal_Int64 nFactor = ImplPower10( GetDecimalDigits() ); if( nValue < 0 ) - return ((nValue-(nFactor/2)) / nFactor ); + { + sal_Int64 nHalf = nValue < ( SAL_MIN_INT64 + nFactor )? 0 : nFactor/2; + return ((nValue-nHalf) / nFactor ); + } else - return ((nValue+(nFactor/2)) / nFactor ); + { + sal_Int64 nHalf = nValue > ( SAL_MAX_INT64 - nFactor )? 0 : nFactor/2; + return ((nValue+nHalf) / nFactor ); + } } // ----------------------------------------------------------------------- @@ -1176,29 +1182,32 @@ static FieldUnit ImplMetricGetUnit( const XubString& rStr ) } #define K *1000L -#define M *1000000L +#define M *1000000LL #define X *5280L -static const sal_Int64 aImplFactor[FUNIT_MILE+1][FUNIT_MILE+1] = +// twip in km = 254 / 14 400 000 000 +// expressions too big for default size 32 bit need LL to avoid overflow + +static const sal_Int64 aImplFactor[FUNIT_LINE+1][FUNIT_LINE+1] = { /* -mm/100 mm cm m km twip point pica inch foot mile */ -{ 1, 100, 1 K, 100 K, 100 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X }, -{ 1, 1, 10, 1 K, 1 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X }, -{ 1, 1, 1, 100, 100 K, 254, 254, 254, 254, 254*12, 254*12 X }, -{ 1, 1, 1, 1, 1 K, 254, 254, 254, 254, 254*12, 254*12 X }, -{ 1, 1, 1, 1, 1, 0, 254, 254, 254, 254*12, 254*12 X }, -{ 1440,144 K,144 K,14400 K, 0, 1, 20, 240, 1440,1440*12,1440*12 X }, -{ 72, 7200, 7200, 720 K, 720 M, 1, 1, 12, 72, 72*12, 72*12 X }, -{ 6, 600, 600, 60 K, 60 M, 1, 1, 1, 6, 6*12, 6*12 X }, -{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 12, 12 X }, -{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 1, 1 X }, -{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 1, 1 } +mm/100 mm cm m km twip point pica inch foot mile char line */ +{ 1, 100, 1 K, 100 K, 100 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X , 53340, 396240}, +{ 1, 1, 10, 1 K, 1 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X , 5334, 396240}, +{ 1, 1, 1, 100, 100 K, 254, 254, 254, 254, 254*12, 254*12 X , 5334, 39624}, +{ 1, 1, 1, 1, 1 K, 254, 254, 254, 254, 254*12, 254*12 X , 533400, 39624}, +{ 1, 1, 1, 1, 1, 254, 254, 254, 254, 254*12, 254*12 X ,533400 K, 39624}, +{ 1440,144 K,144 K,14400 K,14400LL M, 1, 20, 240, 1440,1440*12,1440*12 X , 210, 3120}, +{ 72, 7200, 7200, 720 K, 720 M, 1, 1, 12, 72, 72*12, 72*12 X , 210, 156}, +{ 6, 600, 600, 60 K, 60 M, 1, 1, 1, 6, 6*12, 6*12 X , 210, 10}, +{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 12, 12 X , 210, 45}, +{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 1, 1 X , 210, 45}, +{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 1, 1 , 210, 45}, +{ 144, 1440,14400, 14400, 14400, 1, 20, 240, 1440,1440*12, 1440*12 X, 1, 156 }, +{ 720,72000,72000, 7200 K,7200LL M, 20, 10, 13, 11, 11*12, 11*12 X, 105, 1 } }; - #undef X #undef M #undef K -// twip in km 254/14400 M static FieldUnit eDefaultUnit = FUNIT_NONE; @@ -1235,7 +1244,7 @@ static FieldUnit ImplMap2FieldUnit( MapUnit meUnit, long& nDecDigits ) case MAP_TWIP : return FUNIT_TWIP; default: - DBG_ERROR( "default eInUnit" ); + OSL_FAIL( "default eInUnit" ); break; } return FUNIT_NONE; @@ -1251,13 +1260,18 @@ static double nonValueDoubleToValueDouble( double nValue ) sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit ) { + double nDouble = nonValueDoubleToValueDouble( ConvertDoubleValue( + (double)nValue, mnBaseValue, nDecDigits, eInUnit, eOutUnit ) ); + // caution: precision loss in double cast - return static_cast<sal_Int64>( - // #150733# cast double to sal_Int64 can throw a - // EXCEPTION_FLT_INVALID_OPERATION on Windows - nonValueDoubleToValueDouble( - ConvertDoubleValue( (double)nValue, mnBaseValue, nDecDigits, - eInUnit, eOutUnit ) ) ); + sal_Int64 nLong = static_cast<sal_Int64>( nDouble ); + + if ( nDouble >= (double)SAL_MAX_INT64 ) + nLong = SAL_MAX_INT64; + else if ( nDouble <= (double)SAL_MIN_INT64 ) + nLong = SAL_MIN_INT64; + + return nLong; } // ----------------------------------------------------------------------- @@ -1266,8 +1280,6 @@ sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_uInt16 nDigits, MapUnit eInUnit, FieldUnit eOutUnit ) { return static_cast<sal_Int64>( - // #150733# cast double to sal_Int64 can throw a - // EXCEPTION_FLT_INVALID_OPERATION on Windows nonValueDoubleToValueDouble( ConvertDoubleValue( nValue, nDigits, eInUnit, eOutUnit ) ) ); } @@ -1278,8 +1290,6 @@ sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_uInt16 nDigits, FieldUnit eInUnit, MapUnit eOutUnit ) { return static_cast<sal_Int64>( - // #150733# cast double to sal_Int64 can throw a - // EXCEPTION_FLT_INVALID_OPERATION on Windows nonValueDoubleToValueDouble( ConvertDoubleValue( nValue, nDigits, eInUnit, eOutUnit ) ) ); } @@ -1348,7 +1358,7 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, eInUnit == MAP_APPFONT || eInUnit == MAP_RELATIVE ) { - DBG_ERROR( "invalid parameters" ); + OSL_FAIL( "invalid parameters" ); return nValue; } @@ -1405,7 +1415,7 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, eOutUnit == MAP_APPFONT || eOutUnit == MAP_RELATIVE ) { - DBG_ERROR( "invalid parameters" ); + OSL_FAIL( "invalid parameters" ); return nValue; } @@ -1424,7 +1434,6 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, { while ( nDecDigits ) { - nValue += 5; nValue /= 10; nDecDigits--; } @@ -1775,6 +1784,22 @@ MetricField::~MetricField() { } +void MetricField::SetUnit( FieldUnit nNewUnit ) +{ + sal_Int64 nRawMax = GetMax( nNewUnit ); + sal_Int64 nMax = Denormalize( nRawMax ); + sal_Int64 nMin = Denormalize( GetMin( nNewUnit ) ); + sal_Int64 nFirst = Denormalize( GetFirst( nNewUnit ) ); + sal_Int64 nLast = Denormalize( GetLast( nNewUnit ) ); + + MetricFormatter::SetUnit( nNewUnit ); + + SetMax( Normalize( nMax ), nNewUnit ); + SetMin( Normalize( nMin ), nNewUnit ); + SetFirst( Normalize( nFirst ), nNewUnit ); + SetLast( Normalize( nLast ), nNewUnit ); +} + // ----------------------------------------------------------------------- void MetricField::SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit ) @@ -2508,3 +2533,5 @@ sal_Int64 CurrencyBox::GetValue() const // Implementation not inline, because it is a virtual Function return CurrencyFormatter::GetValue(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 9aac58e1a30a..69a3fdbdce9d 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #include <tools/debug.hxx> #include <tools/rc.h> - #include <vcl/svapp.hxx> #include <vcl/sound.hxx> #include <vcl/event.hxx> @@ -1298,7 +1298,7 @@ static sal_Bool ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFie default: { - DBG_ERROR( "DateFormat???" ); + OSL_FAIL( "DateFormat???" ); } } } @@ -1434,7 +1434,7 @@ XubString DateFormatter::ImplGetDateAsText( const Date& rDate, break; default: { - DBG_ERROR( "DateFormat???" ); + OSL_FAIL( "DateFormat???" ); } } @@ -1607,7 +1607,7 @@ void DateField::ImplDateSpinArea( sal_Bool bUp ) } break; default: - DBG_ERROR( "invalid conversion" ); + OSL_FAIL( "invalid conversion" ); break; } } @@ -3300,7 +3300,7 @@ void TimeField::SetExtFormat( ExtTimeFieldFormat eFormat ) SetFormat( TIMEF_SEC ); } break; - default: DBG_ERROR( "ExtTimeFieldFormat unknown!" ); + default: OSL_FAIL( "ExtTimeFieldFormat unknown!" ); } if ( GetField() && GetField()->GetText().Len() ) @@ -3464,3 +3464,5 @@ sal_uInt16 TimeBox::GetTimePos( const Time& rTime ) const bSec = b100Sec = sal_True; return ComboBox::GetEntryPos( ImplGetLocaleDataWrapper().getTime( rTime, bSec, b100Sec ) ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/fixbrd.cxx b/vcl/source/control/fixbrd.cxx index cc621e16175d..4efbbe2deee1 100644 --- a/vcl/source/control/fixbrd.cxx +++ b/vcl/source/control/fixbrd.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#ifndef _SV_RC_H #include <tools/rc.h> -#endif #include <vcl/event.hxx> #include <vcl/fixbrd.hxx> @@ -234,3 +233,5 @@ void FixedBorder::SetBorderType( sal_uInt16 nType ) Invalidate(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 5455f9410f54..514589d0660b 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -507,17 +508,14 @@ void FixedLine::ImplDraw( bool bLayout ) { if( !pVector ) { - long nX = 0; - long nY = 0; - if ( nWinStyle & WB_VERT ) { - nX = (aOutSize.Width()-1)/2; + long nX = (aOutSize.Width()-1)/2; aDecoView.DrawSeparator( Point( nX, 0 ), Point( nX, aOutSize.Height()-1 ) ); } else { - nY = (aOutSize.Height()-1)/2; + long nY = (aOutSize.Height()-1)/2; aDecoView.DrawSeparator( Point( 0, nY ), Point( aOutSize.Width()-1, nY ), false ); } } @@ -784,11 +782,6 @@ void FixedBitmap::ImplDraw( OutputDevice* pDev, sal_uLong /* nDrawFlags */, sal_uInt16 nStyle = 0; Bitmap* pBitmap = &maBitmap; Color aCol; - if( !!maBitmapHC ) - { - if( GetSettings().GetStyleSettings().GetHighContrastMode() ) - pBitmap = &maBitmapHC; - } if( nStyle & IMAGE_DRAW_COLORTRANSFORM ) { @@ -910,28 +903,17 @@ void FixedBitmap::SetBitmap( const Bitmap& rBitmap ) // ----------------------------------------------------------------------- -sal_Bool FixedBitmap::SetModeBitmap( const Bitmap& rBitmap, BmpColorMode eMode ) +sal_Bool FixedBitmap::SetModeBitmap( const Bitmap& rBitmap ) { - if( eMode == BMP_COLOR_NORMAL ) - SetBitmap( rBitmap ); - else if( eMode == BMP_COLOR_HIGHCONTRAST ) - { - maBitmapHC = rBitmap; - StateChanged( STATE_CHANGE_DATA ); - } - else - return sal_False; + SetBitmap( rBitmap ); return sal_True; } // ----------------------------------------------------------------------- -const Bitmap& FixedBitmap::GetModeBitmap( BmpColorMode eMode) const +const Bitmap& FixedBitmap::GetModeBitmap( ) const { - if( eMode == BMP_COLOR_HIGHCONTRAST ) - return maBitmapHC; - else - return maBitmap; + return maBitmap; } // ======================================================================= @@ -1035,11 +1017,6 @@ void FixedImage::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, Image *pImage = &maImage; Color aCol; - if( !!maImageHC ) - { - if( GetSettings().GetStyleSettings().GetHighContrastMode() ) - pImage = &maImageHC; - } // Haben wir ueberhaupt ein Image if ( !(!(*pImage)) ) @@ -1070,7 +1047,7 @@ void FixedImage::Paint( const Rectangle& ) Size FixedImage::GetOptimalSize( WindowSizeType ) const { - const Image* pImage = GetSettings().GetStyleSettings().GetHighContrastMode() ? &maImageHC : &maImage; + const Image* pImage = &maImage; return pImage->GetSizePixel(); } @@ -1165,31 +1142,17 @@ void FixedImage::SetImage( const Image& rImage ) // ----------------------------------------------------------------------- -sal_Bool FixedImage::SetModeImage( const Image& rImage, BmpColorMode eMode ) +sal_Bool FixedImage::SetModeImage( const Image& rImage ) { - if( eMode == BMP_COLOR_NORMAL ) - SetImage( rImage ); - else if( eMode == BMP_COLOR_HIGHCONTRAST ) - { - if( maImageHC != rImage ) - { - maImageHC = rImage; - StateChanged( STATE_CHANGE_DATA ); - } - } - else - return sal_False; + SetImage( rImage ); return sal_True; } // ----------------------------------------------------------------------- -const Image& FixedImage::GetModeImage( BmpColorMode eMode ) const +const Image& FixedImage::GetModeImage( ) const { - if( eMode == BMP_COLOR_HIGHCONTRAST ) - return maImageHC; - else - return maImage; + return maImage; } // ----------------------------------------------------------------------- @@ -1199,3 +1162,5 @@ Point FixedImage::CalcImagePos( const Point& rPos, { return ImplCalcPos( GetStyle(), rPos, rObjSize, rWinSize ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/group.cxx b/vcl/source/control/group.cxx index 6bf4d519a64b..3de86f5a2cd5 100644 --- a/vcl/source/control/group.cxx +++ b/vcl/source/control/group.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -134,6 +135,7 @@ GroupBox::GroupBox( Window* pParent, const ResId& rResId ) : void GroupBox::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize, bool bLayout ) { + OSL_TRACE("GroupBox::ImplDraw Y %d, X %d", rPos.Y(), rPos.X() ); long nTop; long nTextOff; const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -320,3 +322,4 @@ void GroupBox::DataChanged( const DataChangedEvent& rDCEvt ) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index 016facae8e2c..e558425308e9 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,6 +48,10 @@ #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <rtl/instance.hxx> +#include <comphelper/string.hxx> +#include <comphelper/processfactory.hxx> + #define MULTILINE_ENTRY_DRAW_FLAGS ( TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE | TEXT_DRAW_VCENTER ) using namespace ::com::sun::star; @@ -122,40 +127,50 @@ ImplEntryList::~ImplEntryList() void ImplEntryList::Clear() { mnImages = 0; - for ( sal_uInt16 n = GetEntryCount(); n; ) - { - ImplEntryType* pImplEntry = GetEntry( --n ); - delete pImplEntry; - } - List::Clear(); + maEntries.clear(); } // ----------------------------------------------------------------------- void ImplEntryList::SelectEntry( sal_uInt16 nPos, sal_Bool bSelect ) { - ImplEntryType* pImplEntry = GetEntry( nPos ); - if ( pImplEntry && - ( pImplEntry->mbIsSelected != bSelect ) && - ( (pImplEntry->mnFlags & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION) == 0 ) ) + if (nPos < maEntries.size()) { - pImplEntry->mbIsSelected = bSelect; - if ( mbCallSelectionChangedHdl ) - maSelectionChangedHdl.Call( (void*)sal_IntPtr(nPos) ); + boost::ptr_vector<ImplEntryType>::iterator iter = maEntries.begin()+nPos; + + if ( ( iter->mbIsSelected != bSelect ) && + ( (iter->mnFlags & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION) == 0 ) ) + { + iter->mbIsSelected = bSelect; + if ( mbCallSelectionChangedHdl ) + maSelectionChangedHdl.Call( (void*)sal_IntPtr(nPos) ); + } } } -// ----------------------------------------------------------------------- - -uno::Reference< i18n::XCollator > ImplGetCollator (lang::Locale &rLocale) +namespace { - static uno::Reference< i18n::XCollator > xCollator; - if ( !xCollator.is() ) - xCollator = vcl::unohelper::CreateCollator(); - if( xCollator.is() ) - xCollator->loadDefaultCollator (rLocale, 0); + struct theSorter + : public rtl::StaticWithInit< comphelper::string::NaturalStringSorter, theSorter > + { + comphelper::string::NaturalStringSorter operator () () + { + return comphelper::string::NaturalStringSorter( + ::comphelper::getProcessComponentContext(), + Application::GetSettings().GetLocale()); + } + }; +} - return xCollator; +namespace vcl +{ + namespace unohelper + { + const comphelper::string::NaturalStringSorter& getNaturalStringSorterForAppLocale() + { + return theSorter::get(); + } + } } sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry, sal_Bool bSort ) @@ -163,19 +178,29 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry if ( !!pNewEntry->maImage ) mnImages++; - if ( !bSort || !Count() ) + sal_uInt16 insPos = 0; + + if ( !bSort || maEntries.empty()) { - Insert( pNewEntry, nPos ); + if (nPos < maEntries.size()) + { + insPos = nPos; + maEntries.insert( maEntries.begin() + nPos, pNewEntry ); + } + else + { + insPos = maEntries.size(); + maEntries.push_back(pNewEntry); + } } else { - lang::Locale aLocale = Application::GetSettings().GetLocale(); - uno::Reference< i18n::XCollator > xCollator = ImplGetCollator(aLocale); + const comphelper::string::NaturalStringSorter &rSorter = theSorter::get(); const XubString& rStr = pNewEntry->maStr; sal_uLong nLow, nHigh, nMid; - nHigh = Count(); + nHigh = maEntries.size(); ImplEntryType* pTemp = GetEntry( (sal_uInt16)(nHigh-1) ); @@ -183,24 +208,24 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry { // XXX even though XCollator::compareString returns a sal_Int32 the only // defined values are {-1, 0, 1} which is compatible with StringCompare - StringCompare eComp = xCollator.is() ? - (StringCompare)xCollator->compareString (rStr, pTemp->maStr) - : COMPARE_EQUAL; + StringCompare eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr); // Schnelles Einfuegen bei sortierten Daten if ( eComp != COMPARE_LESS ) { - Insert( pNewEntry, LIST_APPEND ); + insPos = maEntries.size(); + maEntries.push_back(pNewEntry); } else { nLow = mnMRUCount; pTemp = (ImplEntryType*)GetEntry( (sal_uInt16)nLow ); - eComp = (StringCompare)xCollator->compareString (rStr, pTemp->maStr); + eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr); if ( eComp != COMPARE_GREATER ) { - Insert( pNewEntry, (sal_uLong)0 ); + insPos = 0; + maEntries.insert(maEntries.begin(),pNewEntry); } else { @@ -209,9 +234,9 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry do { nMid = (nLow + nHigh) / 2; - pTemp = (ImplEntryType*)GetObject( nMid ); + pTemp = (ImplEntryType*)GetEntry( nMid ); - eComp = (StringCompare)xCollator->compareString (rStr, pTemp->maStr); + eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr); if ( eComp == COMPARE_LESS ) nHigh = nMid-1; @@ -228,35 +253,38 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry if ( eComp != COMPARE_LESS ) nMid++; - Insert( pNewEntry, nMid ); + insPos = nMid; + maEntries.insert(maEntries.begin()+nMid,pNewEntry); } } } catch (uno::RuntimeException& ) { - // XXX this is arguable, if the exception occured because pNewEntry is - // garbage you wouldn't insert it. If the exception occured because the + // XXX this is arguable, if the exception occurred because pNewEntry is + // garbage you wouldn't insert it. If the exception occurred because the // Collator implementation is garbage then give the user a chance to see // his stuff - Insert( pNewEntry, (sal_uLong)0 ); + insPos = 0; + maEntries.insert(maEntries.begin(),pNewEntry); } } - return (sal_uInt16)GetPos( pNewEntry ); + return insPos; } // ----------------------------------------------------------------------- void ImplEntryList::RemoveEntry( sal_uInt16 nPos ) { - ImplEntryType* pImplEntry = (ImplEntryType*)List::Remove( nPos ); - if ( pImplEntry ) + if (nPos < maEntries.size()) { - if ( !!pImplEntry->maImage ) + boost::ptr_vector<ImplEntryType>::iterator iter = maEntries.begin()+ nPos; + + if ( !!iter->maImage ) mnImages--; - delete pImplEntry; + maEntries.erase(iter); } } @@ -264,11 +292,10 @@ void ImplEntryList::RemoveEntry( sal_uInt16 nPos ) sal_uInt16 ImplEntryList::FindEntry( const XubString& rString, sal_Bool bSearchMRUArea ) const { - sal_uInt16 nEntries = GetEntryCount(); + sal_uInt16 nEntries = maEntries.size(); for ( sal_uInt16 n = bSearchMRUArea ? 0 : GetMRUCount(); n < nEntries; n++ ) { - ImplEntryType* pImplEntry = GetEntry( n ); - String aComp( vcl::I18nHelper::filterFormattingChars( pImplEntry->maStr ) ); + String aComp( vcl::I18nHelper::filterFormattingChars( maEntries[n].maStr ) ); if ( aComp == rString ) return n; } @@ -374,7 +401,7 @@ XubString ImplEntryList::GetEntryText( sal_uInt16 nPos ) const sal_Bool ImplEntryList::HasEntryImage( sal_uInt16 nPos ) const { sal_Bool bImage = sal_False; - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); if ( pImplEntry ) bImage = !!pImplEntry->maImage; return bImage; @@ -385,7 +412,7 @@ sal_Bool ImplEntryList::HasEntryImage( sal_uInt16 nPos ) const Image ImplEntryList::GetEntryImage( sal_uInt16 nPos ) const { Image aImage; - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); if ( pImplEntry ) aImage = pImplEntry->maImage; return aImage; @@ -395,7 +422,7 @@ Image ImplEntryList::GetEntryImage( sal_uInt16 nPos ) const void ImplEntryList::SetEntryData( sal_uInt16 nPos, void* pNewData ) { - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); if ( pImplEntry ) pImplEntry->mpUserData = pNewData; } @@ -404,7 +431,7 @@ void ImplEntryList::SetEntryData( sal_uInt16 nPos, void* pNewData ) void* ImplEntryList::GetEntryData( sal_uInt16 nPos ) const { - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); return pImplEntry ? pImplEntry->mpUserData : NULL; } @@ -412,7 +439,7 @@ void* ImplEntryList::GetEntryData( sal_uInt16 nPos ) const void ImplEntryList::SetEntryFlags( sal_uInt16 nPos, long nFlags ) { - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); if ( pImplEntry ) pImplEntry->mnFlags = nFlags; } @@ -421,7 +448,7 @@ void ImplEntryList::SetEntryFlags( sal_uInt16 nPos, long nFlags ) long ImplEntryList::GetEntryFlags( sal_uInt16 nPos ) const { - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); return pImplEntry ? pImplEntry->mnFlags : 0; } @@ -2747,25 +2774,17 @@ ImplWin::ImplWin( Window* pParent, WinBits nWinStyle ) : // ----------------------------------------------------------------------- -sal_Bool ImplWin::SetModeImage( const Image& rImage, BmpColorMode eMode ) +sal_Bool ImplWin::SetModeImage( const Image& rImage ) { - if( eMode == BMP_COLOR_NORMAL ) - SetImage( rImage ); - else if( eMode == BMP_COLOR_HIGHCONTRAST ) - maImageHC = rImage; - else - return sal_False; + SetImage( rImage ); return sal_True; } // ----------------------------------------------------------------------- -const Image& ImplWin::GetModeImage( BmpColorMode eMode ) const +const Image& ImplWin::GetModeImage( ) const { - if( eMode == BMP_COLOR_HIGHCONTRAST ) - return maImageHC; - else - return maImage; + return maImage; } // ----------------------------------------------------------------------- @@ -2782,7 +2801,6 @@ void ImplWin::MouseButtonDown( const MouseEvent& ) { if( IsEnabled() ) { -// Control::MouseButtonDown( rMEvt ); MBDown(); } } @@ -2944,12 +2962,6 @@ void ImplWin::DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDraw // check for HC mode Image *pImage = &maImage; - if( !!maImageHC ) - { - if( GetSettings().GetStyleSettings().GetHighContrastMode() ) - pImage = &maImageHC; - } - if ( !IsZoom() ) { DrawImage( aPtImg, *pImage, nStyle ); @@ -3183,6 +3195,11 @@ Size ImplListBoxFloatingWindow::CalcFloatSize() long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize(); aFloatSz.Width() += nSBWidth; } + + long nDesktopWidth = GetDesktopRectPixel().getWidth(); + if (aFloatSz.Width() > nDesktopWidth) + // Don't exceed the desktop width. + aFloatSz.Width() = nDesktopWidth; } if ( aFloatSz.Height() > nMaxHeight ) @@ -3209,6 +3226,13 @@ Size ImplListBoxFloatingWindow::CalcFloatSize() aFloatSz.Height() = nInnerHeight + nTop + nBottom; } + if (aFloatSz.Width() < aSz.Width()) + { + // The max width of list box entries exceeds the window width. + // Account for the scroll bar height. + long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize(); + aFloatSz.Height() += nSBWidth; + } return aFloatSz; } @@ -3262,3 +3286,5 @@ void ImplListBoxFloatingWindow::StartFloat( sal_Bool bStartTracking ) mpImplLB->GetMainWindow()->ImplClearLayoutData(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx index faeb460c46e4..7f304e335f54 100644 --- a/vcl/source/control/imgctrl.cxx +++ b/vcl/source/control/imgctrl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -104,13 +105,8 @@ void ImageControl::ImplDraw( OutputDevice& rDev, sal_uLong nDrawFlags, const Poi nStyle |= IMAGE_DRAW_DISABLE; } - const Image& rImage( GetModeImage( BMP_COLOR_NORMAL ) ); - const Image& rImageHC( GetModeImage( BMP_COLOR_HIGHCONTRAST ) ); - + const Image& rImage( GetModeImage() ); const Image* pImage = &rImage; - if ( !!rImageHC && GetSettings().GetStyleSettings().GetHighContrastMode() ) - pImage = &rImageHC; - const Rectangle aDrawRect( rPos, rSize ); if ( !*pImage ) { @@ -229,3 +225,4 @@ void ImageControl::LoseFocus() GetWindow( WINDOW_BORDER )->Invalidate(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx index 40b897bbb35c..34048a1c60ce 100644 --- a/vcl/source/control/longcurr.cxx +++ b/vcl/source/control/longcurr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -855,3 +856,5 @@ sal_uInt16 LongCurrencyBox::GetValuePos( BigInt nValue ) const } // ======================================================================= + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 94d865f79bc1..9b31913756e4 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1650,3 +1651,5 @@ MultiListBox::MultiListBox( Window* pParent, const ResId& rResId ) : Show(); EnableMultiSelection( sal_True ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx index 5996a5b2d1b1..13513f62b719 100644 --- a/vcl/source/control/menubtn.cxx +++ b/vcl/source/control/menubtn.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#ifndef _SV_RC_H #include <tools/rc.h> -#endif #include <vcl/decoview.hxx> #include <vcl/event.hxx> #include <vcl/menu.hxx> @@ -238,3 +237,5 @@ void MenuButton::SetPopupMenu( PopupMenu* pNewMenu ) // diese Funktion zur 6.0 inline werden mpMenu = pNewMenu; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx index f03136394512..f40bc376d5e0 100644 --- a/vcl/source/control/morebtn.cxx +++ b/vcl/source/control/morebtn.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,15 +30,12 @@ #include "precompiled_vcl.hxx" #include <vcl/morebtn.hxx> -#ifndef _SV_RD_H #include <tools/rc.h> -#endif - - +#include <vector> // ======================================================================= -DECLARE_LIST( ImplMoreWindowList, Window* ) +typedef ::std::vector< Window* > ImplMoreWindowList; struct ImplMoreButtonData { @@ -150,7 +148,6 @@ void MoreButton::Click() { Window* pParent = GetParent(); Size aSize( pParent->GetSizePixel() ); - Window* pWindow = (mpMBData->mpItemList) ? mpMBData->mpItemList->First() : NULL; long nDeltaPixel = LogicToPixel( Size( 0, mnDelta ), meUnit ).Height(); // Status aendern @@ -165,10 +162,10 @@ void MoreButton::Click() if ( mbState ) { // Fenster anzeigen - while ( pWindow ) - { - pWindow->Show(); - pWindow = mpMBData->mpItemList->Next(); + if ( mpMBData->mpItemList ) { + for ( size_t i = 0, n = mpMBData->mpItemList->size(); i < n; ++i ) { + (*mpMBData->mpItemList)[ i ]->Show(); + } } // Dialogbox anpassen @@ -195,10 +192,10 @@ void MoreButton::Click() pParent->SetSizePixel( aSize ); // Fenster nicht mehr anzeigen - while ( pWindow ) - { - pWindow->Hide(); - pWindow = mpMBData->mpItemList->Next(); + if ( mpMBData->mpItemList ) { + for ( size_t i = 0, n = mpMBData->mpItemList->size(); i < n; ++i ) { + (*mpMBData->mpItemList)[ i ]->Hide(); + } } } } @@ -208,9 +205,9 @@ void MoreButton::Click() void MoreButton::AddWindow( Window* pWindow ) { if ( !mpMBData->mpItemList ) - mpMBData->mpItemList = new ImplMoreWindowList( 1024, 16, 16 ); + mpMBData->mpItemList = new ImplMoreWindowList(); - mpMBData->mpItemList->Insert( pWindow, LIST_APPEND ); + mpMBData->mpItemList->push_back( pWindow ); if ( mbState ) pWindow->Show(); @@ -222,8 +219,17 @@ void MoreButton::AddWindow( Window* pWindow ) void MoreButton::RemoveWindow( Window* pWindow ) { - if ( mpMBData->mpItemList ) - mpMBData->mpItemList->Remove( pWindow ); + if ( mpMBData->mpItemList ) { + for ( ImplMoreWindowList::iterator it = mpMBData->mpItemList->begin(); + it < mpMBData->mpItemList->end(); + ++it + ) { + if ( *it == pWindow ) { + mpMBData->mpItemList->erase( it ); + break; + } + } + } } // ----------------------------------------------------------------------- @@ -278,3 +284,4 @@ XubString MoreButton::GetLessText() const return PushButton::GetText(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 17ecbd4a6ce8..6e87647eb8df 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,10 +40,9 @@ #include "rtl/string.hxx" #include "tools/rc.h" +using ::rtl::OUString; -using namespace rtl; - /* #i77549# HACK: for scrollbars in case of thumb rect, page up and page down rect we abuse the HitTestNativeControl interface. All theming engines but aqua @@ -245,7 +245,6 @@ void ScrollBar::ImplUpdateRects( sal_Bool bUpdate ) } else { - Size aScrBarSize = GetOutputSizePixel(); if ( GetStyle() & WB_HORZ ) { const long nSpace = maTrackRect.Right() - maTrackRect.Left(); @@ -1590,3 +1589,5 @@ void ScrollBarBox::DataChanged( const DataChangedEvent& rDCEvt ) Invalidate(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx index 0058acc005c7..71eeeae665d4 100644 --- a/vcl/source/control/slider.cxx +++ b/vcl/source/control/slider.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#ifndef _SV_RC_H #include <tools/rc.h> -#endif #include <vcl/event.hxx> #include <vcl/decoview.hxx> #include <vcl/slider.hxx> @@ -1080,3 +1079,5 @@ Size Slider::CalcWindowSizePixel() } return aSize; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx index 52b3fdca9730..50265e911f80 100644 --- a/vcl/source/control/spinbtn.cxx +++ b/vcl/source/control/spinbtn.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -322,8 +323,6 @@ void SpinButton::MouseMove( const MouseEvent& rMEvt ) void SpinButton::KeyInput( const KeyEvent& rKEvt ) { - KeyCode aCode = rKEvt.GetKeyCode(); - if ( !rKEvt.GetKeyCode().GetModifier() ) { switch ( rKEvt.GetKeyCode().GetCode() ) @@ -548,3 +547,5 @@ long SpinButton::PreNotify( NotifyEvent& rNEvt ) } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index ed0bb4374c53..adbb2ad0ae0a 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -697,7 +698,6 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec long nBottom1 = aSize.Height()/2; long nBottom2 = aSize.Height()-1; long nTop2 = nBottom1; - long nTop1 = 0; if ( !(aSize.Height() & 0x01) ) nBottom1--; @@ -742,6 +742,7 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec } else { + long nTop1 = 0; aSize.Width() -= CalcZoom( GetDrawPixel( pDev, rStyleSettings.GetSpinSize() ) ); rSpinUpArea = Rectangle( aSize.Width(), nTop1, rOutSz.Width()-aDropDownSize.Width()-1, nBottom1 ); @@ -1092,3 +1093,5 @@ void SpinField::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, pDev->SetSettings( aOldSettings ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 6cc07e85ffb7..765907721ed6 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,7 +47,7 @@ #include "svdata.hxx" #include "window.h" -#include <hash_map> +#include <boost/unordered_map.hpp> #include <vector> // ======================================================================= @@ -76,8 +77,8 @@ struct ImplTabItem struct ImplTabCtrlData { - std::hash_map< int, int > maLayoutPageIdToLine; - std::hash_map< int, int > maLayoutLineToPageId; + boost::unordered_map< int, int > maLayoutPageIdToLine; + boost::unordered_map< int, int > maLayoutLineToPageId; std::vector< Rectangle > maTabRectangles; Point maItemsOffset; // offset of the tabitems std::vector< ImplTabItem > maItemList; @@ -161,6 +162,18 @@ const Color& TabControl::GetCanonicalTextColor( const StyleSettings& _rStyle ) c // ----------------------------------------------------------------------- +WinBits TabControl::ImplInitStyle( WinBits nStyle ) +{ + if ( !(nStyle & WB_NOTABSTOP) ) + nStyle |= WB_TABSTOP; + if ( !(nStyle & WB_NOGROUP) ) + nStyle |= WB_GROUP; + + return nStyle; +} + +// ----------------------------------------------------------------------- + void TabControl::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ) { @@ -215,6 +228,7 @@ TabControl::TabControl( Window* pParent, WinBits nStyle ) : Control( WINDOW_TABCONTROL ) { ImplInit( pParent, nStyle ); + OSL_TRACE("*** TABCONTROL no notabs? %s", ( GetStyle() & WB_NOBORDER ) ? "true" : "false" ); } // ----------------------------------------------------------------------- @@ -607,7 +621,13 @@ void TabControl::ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId ) if ( pPage ) { - pPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() ); + if ( ( GetStyle() & WB_NOBORDER ) ) + { + Rectangle aRectNoTab( (const Point&)Point( 0, 0 ), GetSizePixel() ); + pPage->SetPosSizePixel( aRectNoTab.TopLeft(), aRectNoTab.GetSize() ); + } + else + pPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() ); // activate page here so the conbtrols can be switched // also set the help id of the parent window to that of the tab page @@ -662,6 +682,12 @@ sal_Bool TabControl::ImplPosCurTabPage() ImplTabItem* pItem = ImplGetItem( GetCurPageId() ); if ( pItem && pItem->mpTabPage ) { + if ( ( GetStyle() & WB_NOBORDER ) ) + { + Rectangle aRectNoTab( (const Point&)Point( 0, 0 ), GetSizePixel() ); + pItem->mpTabPage->SetPosSizePixel( aRectNoTab.TopLeft(), aRectNoTab.GetSize() ); + return sal_True; + } Rectangle aRect = ImplGetTabRect( TAB_PAGERECT ); pItem->mpTabPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() ); return sal_True; @@ -1055,7 +1081,8 @@ void TabControl::KeyInput( const KeyEvent& rKEvt ) void TabControl::Paint( const Rectangle& rRect ) { - ImplPaint( rRect, false ); + if ( !( GetStyle() & WB_NOBORDER ) ) + ImplPaint( rRect, false ); } // ----------------------------------------------------------------------- @@ -1083,7 +1110,6 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) // Draw the TabPage border const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); Rectangle aCurRect; - long nTopOff = 1; aRect.Left() -= TAB_OFFSET; aRect.Top() -= TAB_OFFSET; aRect.Right() += TAB_OFFSET; @@ -1125,6 +1151,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) } else { + long nTopOff = 1; if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) SetLineColor( rStyleSettings.GetLightColor() ); else @@ -1487,6 +1514,10 @@ void TabControl::StateChanged( StateChangedType nType ) ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } + else if ( nType == STATE_CHANGE_STYLE ) + { + SetStyle( ImplInitStyle( GetStyle() ) ); + } } // ----------------------------------------------------------------------- @@ -2083,7 +2114,7 @@ Rectangle TabControl::GetCharacterBounds( sal_uInt16 nPageId, long nIndex ) cons if( HasLayoutData() ) { - std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPageId ); + boost::unordered_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPageId ); if( it != mpTabCtrlData->maLayoutPageIdToLine.end() ) { Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( it->second ); @@ -2148,7 +2179,7 @@ Rectangle TabControl::GetTabPageBounds( sal_uInt16 nPage ) const if( HasLayoutData() ) { - std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPage ); + boost::unordered_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPage ); if( it != mpTabCtrlData->maLayoutPageIdToLine.end() ) { if( it->second >= 0 && it->second < static_cast<int>(mpTabCtrlData->maTabRectangles.size()) ) @@ -2214,3 +2245,4 @@ void TabControl::SetMinimumSizePixel( const Size& i_rSize ) // ----------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx index 6ebd02cb5de1..a55fdb3eb379 100644 --- a/vcl/source/control/throbber.cxx +++ b/vcl/source/control/throbber.cxx @@ -300,7 +300,7 @@ void Throbber::setImageList( const Sequence< Reference< XGraphic > >& rImageList //---------------------------------------------------------------------------------------------------------------------- IMPL_LINK( Throbber, TimeOutHdl, void*, EMPTYARG ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( maImageList.empty() ) return 0; diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 45172002bff6..eed5a9e1ac07 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -154,12 +155,6 @@ static const char* pStringIds[] = { // -------------------------------------------------------------------- -#if 0 // TODO: use them -static const char* pStdEncNames[] = { - "ISOAdobe", "Expert", "ExpertSubSet" -}; -#endif - // -------------------------------------------------------------------- // TOP DICT keywords (also covers PRIV DICT keywords) @@ -617,15 +612,19 @@ void CffSubsetterContext::readDictOp( void) const U8 c = *mpReadPtr; if( c <= 21 ) { int nOpId = *(mpReadPtr++); - const char* pCmdName; + const char* pCmdName = 0; if( nOpId != 12) - pCmdName = pDictOps[ nOpId]; + pCmdName = pDictOps[nOpId]; else { const U8 nExtId = *(mpReadPtr++); - pCmdName = pDictEscs[ nExtId]; + if (nExtId < 39) + pCmdName = pDictEscs[nExtId]; nOpId = 900 + nExtId; } + if (!pCmdName) // skip reserved operators + return; + //TODO: if( nStackIdx > 0) switch( *pCmdName) { default: fprintf( stderr, "unsupported DictOp.type=\'%c\'\n", *pCmdName); break; @@ -1244,32 +1243,23 @@ void CffSubsetterContext::convertOneTypeEsc( void) } case TYPE2OP::HFLEX1: { assert( mnStackIdx == 9); -#if 0 // emulate hflex1 as straight line - const ValType* pX = &mnValStack[ mnStackIdx]; - const ValType fDX = pX[-9] + pX[-7] + pX[-5] + pX[-4] + pX[-3] + pX[-1]; - writeType1Val( fDX); - writeTypeOp( TYPE1OP::HLINETO); -#else // emulate hflex1 as two curves + writeCurveTo( mnStackIdx, -9, -8, -7, -6, -5, 0); writeCurveTo( mnStackIdx, -4, 0, -3, -2, -1, 0); // TODO: emulate hflex1 using othersubr call -#endif + mnStackIdx -= 9; } break; case TYPE2OP::HFLEX: { assert( mnStackIdx == 7); ValType* pX = &mnValStack[ mnStackIdx]; -#if 0 // emulate hflex as straight line - const ValType fDX = pX[-7] + pX[-6] + pX[-4] + pX[-3] + pX[-2] + pX[-1]; - writeType1Val( fDX); - writeTypeOp( TYPE1OP::HLINETO); -#else // emulate hflex as two curves + pX[+1] = -pX[-5]; // temp: +dy5==-dy2 writeCurveTo( mnStackIdx, -7, 0, -6, -5, -4, 0); writeCurveTo( mnStackIdx, -3, 0, -2, +1, -1, 0); // TODO: emulate hflex using othersubr call -#endif + mnStackIdx -= 7; } break; @@ -1317,13 +1307,12 @@ void CffSubsetterContext::callType2Subr( bool bGlobal, int nSubrNumber) const U8* const pOldReadPtr = mpReadPtr; const U8* const pOldReadEnd = mpReadEnd; - int nLen = 0; if( bGlobal ) { nSubrNumber += mnGlobalSubrBias; - nLen = seekIndexData( mnGlobalSubrBase, nSubrNumber); + seekIndexData( mnGlobalSubrBase, nSubrNumber); } else { nSubrNumber += mpCffLocal->mnLocalSubrBias; - nLen = seekIndexData( mpCffLocal->mnLocalSubrBase, nSubrNumber); + seekIndexData( mpCffLocal->mnLocalSubrBase, nSubrNumber); } while( mpReadPtr < mpReadEnd) @@ -1391,13 +1380,7 @@ if( mbSawError) { writeType1Val( -350); writeType1Val( 700); writeTypeOp( TYPE1OP::RLINETO); -#if 0 - writeType1Val( -300); - writeType1Val( -800); - writeTypeOp( TYPE1OP::RLINETO); -#else writeTypeOp( TYPE1OP::CLOSEPATH); -#endif writeTypeOp( TYPE1OP::ENDCHAR); } #else // useful for manually encoding charstrings @@ -1771,6 +1754,7 @@ int CffSubsetterContext::getFDSelect( int nGlyphIndex) const assert( nRangeCount <= mnCharStrCount); U16 nPrev = (pReadPtr[2]<<8) + pReadPtr[3]; assert( nPrev == 0); + (void)nPrev; pReadPtr += 4; // TODO? binary search for( int i = 0; i < nRangeCount; ++i) { @@ -1889,12 +1873,12 @@ public: /*virtual*/ ~Type1Emitter( void); void setSubsetName( const char* ); - void emitRawData( const char* pData, int nLength) const; + size_t emitRawData( const char* pData, size_t nLength) const; void emitAllRaw( void); void emitAllHex( void); void emitAllCrypted( void); int tellPos( void) const; - void updateLen( int nTellPos, int nLength); + size_t updateLen( int nTellPos, size_t nLength); void emitValVector( const char* pLineHead, const char* pLineTail, const ValVector&); private: FILE* mpFileOut; @@ -1967,7 +1951,7 @@ int Type1Emitter::tellPos( void) const // -------------------------------------------------------------------- -void Type1Emitter::updateLen( int nTellPos, int nLength) +size_t Type1Emitter::updateLen( int nTellPos, size_t nLength) { // update PFB segment header length U8 cData[4]; @@ -1977,15 +1961,16 @@ void Type1Emitter::updateLen( int nTellPos, int nLength) cData[3] = static_cast<U8>(nLength >> 24); const int nCurrPos = ftell( mpFileOut); fseek( mpFileOut, nTellPos, SEEK_SET); - fwrite( cData, 1, sizeof(cData), mpFileOut); + size_t nWrote = fwrite( cData, 1, sizeof(cData), mpFileOut); fseek( mpFileOut, nCurrPos, SEEK_SET); + return nWrote; } // -------------------------------------------------------------------- -inline void Type1Emitter::emitRawData( const char* pData, int nLength) const +inline size_t Type1Emitter::emitRawData(const char* pData, size_t nLength) const { - fwrite( pData, 1, nLength, mpFileOut); + return fwrite( pData, 1, nLength, mpFileOut); } // -------------------------------------------------------------------- @@ -2065,7 +2050,7 @@ void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail, return; // emit the line head - mpPtr += sprintf( mpPtr, pLineHead); + mpPtr += sprintf( mpPtr, "%s", pLineHead); // emit the vector values ValVector::value_type aVal = 0; for( ValVector::const_iterator it = rVector.begin();;) { @@ -2078,7 +2063,7 @@ void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail, // emit the last value mpPtr += dbl2str( mpPtr, aVal); // emit the line tail - mpPtr += sprintf( mpPtr, pLineTail); + mpPtr += sprintf( mpPtr, "%s", pLineTail); } // -------------------------------------------------------------------- @@ -2128,13 +2113,6 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, pOut += sprintf( pOut, "%%!FontType1-1.0: %s 001.003\n", rEmitter.maSubsetName); // emit TOPDICT -#if 0 // improve PS Type1 caching? - nOfs += sprintf( &aT1Str[nOfs], - "FontDirectory/%s known{/%s findfont dup/UniqueID known{dup\n" - "/UniqueID get %d eq exch/FontType get 1 eq and}{pop false}ifelse\n" - "{save true}{false}ifelse}\n{false}ifelse\n", - pFamilyName, pFamilyName, nUniqueId); -#endif pOut += sprintf( pOut, "11 dict begin\n" // TODO: dynamic entry count for TOPDICT "/FontType 1 def\n" @@ -2158,10 +2136,7 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, " /FamilyName (%s) readonly def\n" "end readonly def\n", pFullName, pFamilyName); -#if 0 // TODO: use an standard Type1 encoding if possible - pOut += sprintf( pOut, - "/Encoding StandardEncoding def\n"); -#else + pOut += sprintf( pOut, "/Encoding 256 array\n" "0 1 255 {1 index exch /.notdef put} for\n"); @@ -2170,7 +2145,6 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, pOut += sprintf( pOut, "dup %d /%s put\n", pReqEncoding[i], pGlyphName); } pOut += sprintf( pOut, "readonly def\n"); -#endif pOut += sprintf( pOut, // TODO: more topdict entries "currentdict end\n" @@ -2416,3 +2390,4 @@ bool FontSubsetInfo::CreateFontSubsetFromCff( GlyphWidth* pOutGlyphWidths ) // ==================================================================== +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/fontsubset.cxx b/vcl/source/fontsubset/fontsubset.cxx index 26382e245996..494d739010da 100644 --- a/vcl/source/fontsubset/fontsubset.cxx +++ b/vcl/source/fontsubset/fontsubset.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -116,7 +117,7 @@ bool FontSubsetInfo::CreateFontSubset( case NO_FONT: // fall trough default: - DBG_ERROR( "unhandled type in CreateFontSubset()"); + OSL_FAIL( "unhandled type in CreateFontSubset()"); break; } @@ -173,14 +174,11 @@ bool FontSubsetInfo::CreateFontSubsetFromSfnt( sal_Int32* pOutGlyphWidths ) // TODO: replace dummy implementation bool FontSubsetInfo::CreateFontSubsetFromType1( sal_Int32* pOutGlyphWidths) { -#if 0 - // TODO: replace dummy implementation when someone needs this -#else (void)pOutGlyphWidths; fprintf(stderr,"CreateFontSubsetFromType1: replace dummy implementation\n"); -#endif return false; } // ==================================================================== +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index 403e64768872..da0d84cec089 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,9 +48,9 @@ typedef sal_uInt8 FT_Byte; typedef std::map<sal_uInt16,sal_uInt16> GlyphSubstitution; -inline long NEXT_Long( const unsigned char* &p ) +inline sal_uInt32 NEXT_Long( const unsigned char* &p ) { - long nVal = (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; + sal_uInt32 nVal = (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; p += 4; return nVal; } @@ -356,3 +357,5 @@ int HasVerticalGSUB( struct _TrueTypeFont* pTTFile ) } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/gsub.h b/vcl/source/fontsubset/gsub.h index 9d552ce45701..bb4543f372da 100644 --- a/vcl/source/fontsubset/gsub.h +++ b/vcl/source/fontsubset/gsub.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,3 +43,5 @@ void ReleaseGSUB( struct vcl::_TrueTypeFont* pTTFile ); } #endif /* _PSP_GSUB_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/list.c b/vcl/source/fontsubset/list.c index 3b55b4dfee15..def5faa7b553 100644 --- a/vcl/source/fontsubset/list.c +++ b/vcl/source/fontsubset/list.c @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,20 +35,12 @@ /*[]---------------------------------------------------[]*/ #include <stdlib.h> - -#if OSL_DEBUG_LEVEL == 0 -# ifndef NDEBUG -# define NDEBUG -# endif -#endif - #include <assert.h> #ifdef MALLOC_TRACE #include <stdio.h> #include </usr/local/include/malloc.h> #endif -/* #define TEST */ #include "list.h" /*- private data types */ @@ -100,31 +93,6 @@ static lnode *appendPrim(list this, void *el) this->aCount++; return ptr; } -#ifdef TEST -static lnode *prependPrim(list this, void *el) -{ - lnode *ptr = newNode(el); - lnode *flink, **blink; - - if (this->head != 0) { - blink = &(this->head->prev); - flink = this->head; - } else { - blink = &this->tail; - flink = 0; - this->cptr = ptr; /*- list was empty - set current to this element */ - } - - *blink = ptr; - this->head = ptr; - - ptr->next = flink; - ptr->prev = 0; - - this->aCount++; - return ptr; -} -#endif /*- public methods */ list listNewEmpty(void) /*- default ctor */ @@ -139,32 +107,6 @@ list listNewEmpty(void) /*- default ctor */ return this; } -#ifdef TEST -list listNewCopy(list l) /*- copy ctor */ -{ - lnode *ptr, *c; - list this; - assert(l != 0); - - this = malloc(sizeof(struct _list)); - assert(this != 0); - - ptr = l->head; - - this->aCount = 0; - this->eDtor = 0; - this->head = this->tail = this->cptr = 0; - - while (ptr) { - c = appendPrim(this, ptr->value); - if (ptr == l->cptr) this->cptr = c; - ptr = ptr->next; - } - - return this; -} -#endif - void listDispose(list this) /*- dtor */ { assert(this != 0); @@ -198,36 +140,6 @@ int listIsEmpty(list this) return this->aCount == 0; } - -#ifdef TEST -int listAtFirst(list this) -{ - assert(this != 0); - return this->cptr == this->head; -} - -int listAtLast(list this) -{ - assert(this != 0); - return this->cptr == this->tail; -} - -int listPosition(list this) -{ - int res = 0; - lnode *ptr; - assert(this != 0); - - ptr = this->head; - - while (ptr != this->cptr) { - ptr = ptr->next; - res++; - } - - return res; -} -#endif int listFind(list this, void *el) { lnode *ptr; @@ -311,59 +223,7 @@ list listAppend(list this, void *el) appendPrim(this, el); return this; } -#ifdef TEST -list listPrepend(list this, void *el) -{ - assert(this != 0); - - prependPrim(this, el); - return this; -} - -list listInsertAfter(list this, void *el) -{ - lnode *ptr; - assert(this != 0); - - if (this->cptr == 0) return listAppend(this, el); - - ptr = newNode(el); - - ptr->prev = this->cptr; - ptr->next = this->cptr->next; - this->cptr->next = ptr; - - if (ptr->next != 0) { - ptr->next->prev = ptr; - } else { - this->tail = ptr; - } - this->aCount++; - return this; -} - -list listInsertBefore(list this, void *el) -{ - lnode *ptr; - assert(this != 0); - - if (this->cptr == 0) return listAppend(this, el); - - ptr = newNode(el); - ptr->prev = this->cptr->prev; - ptr->next = this->cptr; - this->cptr->prev = ptr; - - if (ptr->prev != 0) { - ptr->prev->next = ptr; - } else { - this->head = ptr; - } - this->aCount++; - return this; -} -#endif list listRemove(list this) { lnode *ptr = 0; @@ -408,134 +268,4 @@ list listClear(list this) return this; } -#ifdef TEST - -void listForAll(list this, void (*f)(void *)) -{ - lnode *ptr = this->head; - while (ptr) { - f(ptr->value); - ptr = ptr->next; - } -} - - -#include <stdio.h> - -void printlist(list l) -{ - int saved; - assert(l != 0); - saved = listPosition(l); - - printf("[ "); - - if (!listIsEmpty(l)) { - listToFirst(l); - do { - printf("%d ", (int) listCurrent(l)); - } while (listNext(l)); - } - - printf("]\n"); - - listPositionAt(l, saved); -} - -void printstringlist(list l) -{ - int saved; - assert(l != 0); - saved = listPosition(l); - - printf("[ "); - - if (!listIsEmpty(l)) { - listToFirst(l); - do { - printf("'%s' ", (char *) listCurrent(l)); - } while (listNext(l)); - } - - printf("]\n"); - - listPositionAt(l, saved); -} - -void printstat(list l) -{ - printf("count: %d, position: %d, isEmpty: %d, atFirst: %d, atLast: %d.\n", - listCount(l), listPosition(l), listIsEmpty(l), listAtFirst(l), listAtLast(l)); -} - -void allfunc(void *e) -{ - printf("%d ", e); -} - -void edtor(void *ptr) -{ - printf("element dtor: 0x%08x\n", ptr); - free(ptr); -} - -int main() -{ - list l1, l2; - char *ptr; - int i; - -#ifdef MALLOC_TRACE - mal_leaktrace(1); - mal_debug(2); -#endif - - l1 = listNewEmpty(); - printstat(l1); - - listAppend(l1, 1); - printstat(l1); - - listAppend(l1, 2); - printstat(l1); - - listAppend(l1, 3); - printstat(l1); - - printlist(l1); - - listToFirst(l1); - listInsertBefore(l1, -5); - printlist(l1); - - l2 = listNewCopy(l1); - printlist(l2); - - listForAll(l2, allfunc); - printf("\n"); - - listClear(l1); - listSetElementDtor(l1, edtor); - - for(i=0; i<10; i++) { - ptr = malloc(20); - snprintf(ptr, 20, "element # %d", i); - listAppend(l1, ptr); - } - - printstringlist(l1); - - - listDispose(l1); - listDispose(l2); - -#ifdef MALLOC_TRACE - mal_dumpleaktrace(stdout); -#endif - - - return 0; -} -#endif - - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index c94aad3cbab6..443b93df8086 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,11 +36,6 @@ * */ -#if OSL_DEBUG_LEVEL == 0 -# ifndef NDEBUG -# define NDEBUG -# endif -#endif #include <assert.h> #include <stdlib.h> @@ -64,10 +60,6 @@ #include <osl/endian.h> #include <algorithm> -#ifdef TEST7 -#include <ctype.h> -#endif - namespace vcl { @@ -120,7 +112,7 @@ typedef struct { typedef struct { FILE *o; char buffer[HFORMAT_LINELEN]; - int bufpos; + size_t bufpos; int total; } HexFmt; @@ -443,15 +435,17 @@ static HexFmt *HexFmtNew(FILE *outf) return res; } -static void HexFmtFlush(HexFmt *_this) +static bool HexFmtFlush(HexFmt *_this) { + bool bRet = true; if (_this->bufpos) { - fwrite(_this->buffer, 1, _this->bufpos, _this->o); + size_t nWritten = fwrite(_this->buffer, 1, _this->bufpos, _this->o); + bRet = nWritten == _this->bufpos; _this->bufpos = 0; } + return bRet; } - _inline void HexFmtOpenString(HexFmt *_this) { fputs("<\n", _this->o); @@ -675,10 +669,6 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo glyphlist.push_back( index ); -#ifdef DEBUG2 - fprintf(stderr,"glyphlist: += %d\n", index); -#endif - if ((np = GetTTGlyphOutline(ttf, index, &nextComponent, 0, &glyphlist)) == 0) { /* XXX that probably indicates a corrupted font */ @@ -688,18 +678,6 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo #endif } -#ifdef DEBUG2 - fprintf(stderr,"%d [", (int)glyphlist.size() ); - for( std::vector< sal_uInt32 >::const_iterator it = glyphlist.begin(); - it != glyphlist.end(); ++it ) - { - fprintf( stderr,"%d ", (int) *it ); - } - fprintf(stderr, "]\n"); - if( ! glyphlist.empty() ) - fprintf(stderr, "glyphlist: -= %d\n", (int) glyphlist.back()); - -#endif if( ! glyphlist.empty() ) glyphlist.pop_back(); @@ -729,23 +707,14 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo b = c = 0; if (flags & WE_HAVE_A_SCALE) { -#ifdef DEBUG2 - fprintf(stderr, "WE_HAVE_A_SCALE\n"); -#endif a = GetInt16(ptr, 0, 1) << 2; d = a; ptr += 2; } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { -#ifdef DEBUG2 - fprintf(stderr, "WE_HAVE_AN_X_AND_Y_SCALE\n"); -#endif a = GetInt16(ptr, 0, 1) << 2; d = GetInt16(ptr, 2, 1) << 2; ptr += 4; } else if (flags & WE_HAVE_A_TWO_BY_TWO) { -#ifdef DEBUG2 - fprintf(stderr, "WE_HAVE_A_TWO_BY_TWO\n"); -#endif a = GetInt16(ptr, 0, 1) << 2; b = GetInt16(ptr, 2, 1) << 2; c = GetInt16(ptr, 4, 1) << 2; @@ -771,18 +740,6 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo assert(!"ARGS_ARE_XY_VALUES is not implemented!!!\n"); } -#ifdef DEBUG2 - fprintf(stderr, "a: %f, b: %f, c: %f, d: %f, e: %f, f: %f, m: %f, n: %f\n", - ((double) a) / 65536, - ((double) b) / 65536, - ((double) c) / 65536, - ((double) d) / 65536, - ((double) e) / 65536, - ((double) f) / 65536, - ((double) m) / 65536, - ((double) n) / 65536); -#endif - for (i=0; i<np; i++) { F16Dot16 t; ControlPoint cp; @@ -792,10 +749,6 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo t = fixedMulDiv(b, nextComponent[i].x << 16, n) + fixedMulDiv(d, nextComponent[i].y << 16, n) + (f << 16); cp.y = (sal_Int16)(fixedMul(t, n) >> 16); -#ifdef DEBUG2 - fprintf(stderr, "( %d %d ) -> ( %d %d )\n", nextComponent[i].x, nextComponent[i].y, cp.x, cp.y); -#endif - myPoints.push_back( cp ); } @@ -857,21 +810,6 @@ static int GetTTGlyphOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint res = GetCompoundTTOutline(ttf, glyphID, pointArray, metrics, glyphlist ? *glyphlist : aPrivList ); } -#ifdef DEBUG3 - { - int i; - FILE *out = fopen("points.dat", "a"); - assert(out != 0); - fprintf(out, "Glyph: %d\nPoints: %d\n", glyphID, res); - for (i=0; i<res; i++) { - fprintf(out, "%c ", ((*pointArray)[i].flags & 0x8000) ? 'X' : '.'); - fprintf(out, "%c ", ((*pointArray)[i].flags & 1) ? '+' : '-'); - fprintf(out, "%d %d\n", (*pointArray)[i].x, (*pointArray)[i].y); - } - fclose(out); - } -#endif - return res; } @@ -1332,7 +1270,7 @@ static sal_uInt32 getGlyph4(const sal_uInt8 *cmap, sal_uInt32 c) { sal_uInt16 * idDelta; /* sal_uInt16 * glyphIdArray; */ sal_uInt16 * idRangeOffset; - sal_uInt16 * glyphIndexArray; + /*sal_uInt16 * glyphIndexArray;*/ sal_uInt16 *CMAP4 = (sal_uInt16 *) cmap; /* sal_uInt16 GEbinsearch(sal_uInt16 *ar, sal_uInt16 length, sal_uInt16 toSearch); */ @@ -1350,7 +1288,7 @@ static sal_uInt32 getGlyph4(const sal_uInt8 *cmap, sal_uInt32 c) { } idDelta = startCode + segCount; idRangeOffset = idDelta + segCount; - glyphIndexArray = idRangeOffset + segCount; + /*glyphIndexArray = idRangeOffset + segCount;*/ if(Int16FromMOTA(idRangeOffset[i]) != 0) { c = Int16FromMOTA(*(&(idRangeOffset[i]) + (Int16FromMOTA(idRangeOffset[i])/2 + (c - Int16FromMOTA(startCode[i]))))); @@ -1545,79 +1483,6 @@ static void GetKern(TrueTypeFont *ttf) return; } -#ifdef TEST5 -/* KernGlyphsPrim?() functions expect the caller to ensure the validity of their arguments and - * that x and y elements of the kern array are initialized to zeroes - */ -static void KernGlyphsPrim1(TrueTypeFont *ttf, sal_uInt16 *glyphs, int nglyphs, int wmode, KernData *kern) -{ - (void)ttf; /* avoid warning */ - (void)glyphs; /* avoid warning */ - (void)nglyphs; /* avoid warning */ - (void)wmode; /* avoid warning */ - (void)nglyphs; /* avoid warning */ - (void)kern; /* avoid warning */ - fprintf(stderr, "MacOS kerning tables have not been implemented yet!\n"); -} - -static void KernGlyphsPrim2(TrueTypeFont *ttf, sal_uInt16 *glyphs, int nglyphs, int wmode, KernData *kern) -{ - sal_uInt32 i, j; - sal_uInt32 gpair; - - if( ! nglyphs ) - return; - - for (i = 0; i < (sal_uInt32)nglyphs - 1; i++) { - gpair = (glyphs[i] << 16) | glyphs[i+1]; -#ifdef DEBUG2 - /* All fonts with MS kern table that I've seen so far contain just one kern subtable. - * MS kern documentation is very poor and I doubt that font developers will be using - * several subtables. I expect them to be using OpenType tables instead. - * According to MS documention, format 2 subtables are not supported by Windows and OS/2. - */ - if (ttf->nkern > 1) { - fprintf(stderr, "KernGlyphsPrim2: %d kern tables found.\n", ttf->nkern); - } -#endif - for (j = 0; j < ttf->nkern; j++) { - sal_uInt16 coverage = GetUInt16(ttf->kerntables[j], 4, 1); - sal_uInt8 *ptr; - int npairs; - sal_uInt32 t; - int l, r, k; - - if (! ((coverage & 1) ^ wmode)) continue; - if ((coverage & 0xFFFE) != 0) { -#ifdef DEBUG2 - fprintf(stderr, "KernGlyphsPrim2: coverage flags are not supported: %04X.\n", coverage); -#endif - continue; - } - ptr = ttf->kerntables[j]; - npairs = GetUInt16(ptr, 6, 1); - ptr += 14; - l = 0; - r = npairs; - do { - k = (l + r) >> 1; - t = GetUInt32(ptr, k * 6, 1); - if (gpair >= t) l = k + 1; - if (gpair <= t) r = k - 1; - } while (l <= r); - if (l - r == 2) { - if (!wmode) { - kern[i].x = XUnits(ttf->unitsPerEm, GetInt16(ptr, 4 + (l-1) * 6, 1)); - } else { - kern[i].y = XUnits(ttf->unitsPerEm, GetInt16(ptr, 4 + (l-1) * 6, 1)); - } - /* !wmode ? kern[i].x : kern[i].y = GetInt16(ptr, 4 + (l-1) * 6, 1); */ - } - } - } -} -#endif - /*- Public functions */ /*FOLD00*/ int CountTTCFonts(const char* fname) @@ -1652,7 +1517,7 @@ static void allocTrueTypeFont( TrueTypeFont** ttf ) /* forward declariotn for the two entry points to use*/ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ); -#if !defined(WIN32) && !defined(OS2) +#if !defined(WIN32) int OpenTTFontFile( const char* fname, sal_uInt32 facenum, TrueTypeFont** ttf ) { int ret, fd = -1; @@ -1753,10 +1618,6 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) return SF_TTFORMAT; } -#ifdef DEBUG2 - fprintf(stderr, "tdoffset: %d\n", tdoffset); -#endif - /* magic number */ t->tag = TTFontClassTag; @@ -1841,7 +1702,7 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) { #if OSL_DEBUG_LEVEL > 1 if( t->tables[i] ) - fprintf( stderr, "font file %s has bad table offset %d (tagnum=%d)\n", t->fname, (sal_uInt8*)t->tables[i]-t->ptr, i ); + fprintf( stderr, "font file %s has bad table offset %" SAL_PRI_PTRDIFFT "d (tagnum=%d)\n", t->fname, (sal_uInt8*)t->tables[i]-t->ptr, i ); #endif t->tlens[i] = 0; t->tables[i] = NULL; @@ -1918,9 +1779,7 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) void CloseTTFont(TrueTypeFont *ttf) /*FOLD01*/ { - if (ttf->tag != TTFontClassTag) return; - -#if !defined(WIN32) && !defined(OS2) +#if !defined(WIN32) if( ttf->fname ) munmap((char *) ttf->ptr, ttf->fsize); #endif @@ -2057,7 +1916,7 @@ int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, /*FO fprintf(outf, h02, modname, modver, modextra); fprintf(outf, h09, ttf->psname); - fprintf(outf, h10); + fprintf(outf, "%s", h10); fprintf(outf, h11, fname); /* fprintf(outf, h12, 4000000); */ @@ -2072,17 +1931,17 @@ int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, /*FO */ fprintf(outf, h17, rtl_crc32(0, ttf->ptr, ttf->fsize), nGlyphs, rtl_crc32(0, glyphArray, nGlyphs * 2), rtl_crc32(0, encoding, nGlyphs)); - fprintf(outf, h13); + fprintf(outf, "%s", h13); fprintf(outf, h14, XUnits(UPEm, GetInt16(table, 36, 1)), XUnits(UPEm, GetInt16(table, 38, 1)), XUnits(UPEm, GetInt16(table, 40, 1)), XUnits(UPEm, GetInt16(table, 42, 1))); - fprintf(outf, h15); + fprintf(outf, "%s", h15); for (i = 0; i < nGlyphs; i++) { fprintf(outf, h16, encoding[i], i); } fprintf(outf, h30, nGlyphs+1); - fprintf(outf, h31); - fprintf(outf, h32); + fprintf(outf, "%s", h31); + fprintf(outf, "%s", h32); for (i = 0; i < nGlyphs; i++) { fprintf(outf, h33, i); @@ -2130,14 +1989,14 @@ int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, /*FO } if (n > 0) fprintf(outf, "\tfill\n"); /* if glyph is not a whitespace character */ - fprintf(outf, h34); + fprintf(outf, "%s", h34); free(pa); free(path); } - fprintf(outf, h35); + fprintf(outf, "%s", h35); - fprintf(outf, h40); + fprintf(outf, "%s", h40); fprintf(outf, h41, fname); return SF_OK; @@ -2740,23 +2599,6 @@ void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info) } } -#ifdef TEST5 -void KernGlyphs(TrueTypeFont *ttf, sal_uInt16 *glyphs, int nglyphs, int wmode, KernData *kern) -{ - int i; - - if (!nglyphs || !glyphs || !kern) return; - - for (i = 0; i < nglyphs-1; i++) kern[i].x = kern[i].y = 0; - - switch (ttf->kerntype) { - case KT_APPLE_NEW: KernGlyphsPrim1(ttf, glyphs, nglyphs, wmode, kern); return; - case KT_MICROSOFT: KernGlyphsPrim2(ttf, glyphs, nglyphs, wmode, kern); return; - default: return; - } -} -#endif - GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID) { const sal_uInt8* glyf = getTable(ttf, O_glyf); @@ -2861,10 +2703,6 @@ int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr) } else { -#ifdef DEBUG - fprintf( stderr, "found invalid name record %d with name id %d for file %s\n", - i, rec[i].nameID, ttf->fname ); -#endif rec[i].sptr = 0; rec[i].slen = 0; } @@ -2889,471 +2727,54 @@ void DisposeNameRecords(NameRecord* nr, int n) free(nr); } -} // namespace vcl - - -#ifdef TEST1 -/* This example creates a subset of a TrueType font with two encoded characters */ -int main(int ac, char **av) -{ - TrueTypeFont *fnt; - int r; - - /* Array of Unicode source characters */ - sal_uInt16 chars[2]; - - /* Encoding vector maps character encoding to the ordinal number - * of the glyph in the output file */ - sal_uInt8 encoding[2]; - - /* This array is for glyph IDs that source characters map to */ - sal_uInt16 g[2]; - - - if (ac < 2) return 0; - - if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) { - fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]); - return 0; - } - - - /* We want to create the output file that only contains two Unicode characters: - * L'a' and L'A' */ - - chars[0] = L'a'; - chars[1] = L'A'; - - /* Figure out what glyphs do these characters map in our font */ - MapString(fnt, chars, 2, g); - - /* Encode the characters. Value of encoding[i] is the number 0..255 which maps to glyph i of the - * newly generated font */ - encoding[0] = chars[0]; - encoding[1] = chars[1]; - - - /* Generate a subset */ - CreateT3FromTTGlyphs(fnt, stdout, 0, g, encoding, 2, 0); - - /* Now call the dtor for the font */ - CloseTTFont(fnt); - return 0; -} -#endif - -#ifdef TEST2 -/* This example extracts first 224 glyphs from a TT fonts and encodes them starting at 32 */ -int main(int ac, char **av) +bool getTTCoverage( + boost::dynamic_bitset<sal_uInt32> &rUnicodeRange, + boost::dynamic_bitset<sal_uInt32> &rCodePageRange, + const unsigned char* pTable, size_t nLength) { - TrueTypeFont *fnt; - int i, r; - - /* Array of Unicode source characters */ - sal_uInt16 glyphs[224]; - - /* Encoding vector maps character encoding to the ordinal number - * of the glyph in the output file */ - sal_uInt8 encoding[224]; - - - - for (i=0; i<224; i++) { - glyphs[i] = i; - encoding[i] = 32 + i; - } - - if (ac < 2) return 0; - - if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) { - fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]); - return 0; - } - - - /* Encode the characters. Value of encoding[i] is the number 0..255 which maps to glyph i of the - * newly generated font */ - - /* Generate a subset */ - CreateT3FromTTGlyphs(fnt, stdout, 0, glyphs, encoding, 224, 0); - - /* Now call the dtor for the font */ - CloseTTFont(fnt); - return 0; -} -#endif - -#ifdef TEST3 -/* Glyph metrics example */ -int main(int ac, char **av) -{ - TrueTypeFont *fnt; - int i, r; - sal_uInt16 glyphs[224]; - TTSimpleGlyphMetrics *m; - - for (i=0; i<224; i++) { - glyphs[i] = i; - } - - if (ac < 2) return 0; - - if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) { - fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]); - return 0; - } - - if ((m = GetTTSimpleGlyphMetrics(fnt, glyphs, 224, 0)) == 0) { - printf("Requested metrics is not available\n"); - } else { - for (i=0; i<224; i++) { - printf("%d. advWid: %5d, LSBear: %5d\n", i, m[i].adv, m[i].sb); - } - } - - /* Now call the dtor for the font */ - free(m); - CloseTTFont(fnt); - return 0; -} -#endif - -#ifdef TEST4 -int main(int ac, char **av) -{ - TrueTypeFont *fnt; - TTGlobalFontInfo info; - int i, r; - - - if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) { - fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]); - return 0; - } - - printf("Font file: %s\n", av[1]); - -#ifdef PRINT_KERN - switch (fnt->kerntype) { - case KT_MICROSOFT: - printf("\tkern: MICROSOFT, ntables: %d.", fnt->nkern); - if (fnt->nkern) { - printf(" ["); - for (i=0; i<fnt->nkern; i++) { - printf("%04X ", GetUInt16(fnt->kerntables[i], 4, 1)); - } - printf("]"); - } - printf("\n"); - break; - - case KT_APPLE_NEW: - printf("\tkern: APPLE_NEW, ntables: %d.", fnt->nkern); - if (fnt->nkern) { - printf(" ["); - for (i=0; i<fnt->nkern; i++) { - printf("%04X ", GetUInt16(fnt->kerntables[i], 4, 1)); - } - printf("]"); - } - printf("\n"); - break; - - case KT_NONE: - printf("\tkern: none.\n"); - break; - - default: - printf("\tkern: unrecoginzed.\n"); - break; - } - printf("\n"); -#endif - - GetTTGlobalFontInfo(fnt, &info); - printf("\tfamily name: `%s`\n", info.family); - printf("\tsubfamily name: `%s`\n", info.subfamily); - printf("\tpostscript name: `%s`\n", info.psname); - printf("\tweight: %d\n", info.weight); - printf("\twidth: %d\n", info.width); - printf("\tpitch: %d\n", info.pitch); - printf("\titalic angle: %d\n", info.italicAngle); - printf("\tbouding box: [%d %d %d %d]\n", info.xMin, info.yMin, info.xMax, info.yMax); - printf("\tascender: %d\n", info.ascender); - printf("\tdescender: %d\n", info.descender); - printf("\tlinegap: %d\n", info.linegap); - printf("\tvascent: %d\n", info.vascent); - printf("\tvdescent: %d\n", info.vdescent); - printf("\ttypoAscender: %d\n", info.typoAscender); - printf("\ttypoDescender: %d\n", info.typoDescender); - printf("\ttypoLineGap: %d\n", info.typoLineGap); - printf("\twinAscent: %d\n", info.winAscent); - printf("\twinDescent: %d\n", info.winDescent); - printf("\tUnicode ranges:\n"); - for (i = 0; i < 32; i++) { - if ((info.ur1 >> i) & 1) { - printf("\t\t\t%s\n", UnicodeRangeName(i)); - } - } - for (i = 0; i < 32; i++) { - if ((info.ur2 >> i) & 1) { - printf("\t\t\t%s\n", UnicodeRangeName(i+32)); - } - } - for (i = 0; i < 32; i++) { - if ((info.ur3 >> i) & 1) { - printf("\t\t\t%s\n", UnicodeRangeName(i+64)); - } - } - for (i = 0; i < 32; i++) { - if ((info.ur4 >> i) & 1) { - printf("\t\t\t%s\n", UnicodeRangeName(i+96)); - } - } - - CloseTTFont(fnt); - return 0; -} -#endif - -#ifdef TEST5 -/* Kerning example */ -int main(int ac, char **av) -{ - TrueTypeFont *fnt; - sal_uInt16 g[224]; - KernData d[223]; - int r, i, k = 0; - - g[k++] = 11; - g[k++] = 36; - g[k++] = 11; - g[k++] = 98; - g[k++] = 11; - g[k++] = 144; - g[k++] = 41; - g[k++] = 171; - g[k++] = 51; - g[k++] = 15; - - if (ac < 2) return 0; - - if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) { - fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]); - return 0; - } - - KernGlyphs(fnt, g, k, 0, d); - - for (i = 0; i < k-1; i++) { - printf("%3d %3d: [%3d %3d]\n", g[i], g[i+1], d[i].x, d[i].y); - } - - CloseTTFont(fnt); - return 0; -} -#endif - - - -#ifdef TEST6 -/* This example extracts a single glyph from a font */ -int main(int ac, char **av) -{ - TrueTypeFont *fnt; - int r, i; - - sal_uInt16 glyphs[256]; - sal_uInt8 encoding[256]; - - for (i=0; i<256; i++) { - glyphs[i] = 512 + i; - encoding[i] = i; - } - -#if 0 - i=0; - glyphs[i++] = 2001; - glyphs[i++] = 2002; - glyphs[i++] = 2003; - glyphs[i++] = 2004; - glyphs[i++] = 2005; - glyphs[i++] = 2006; - glyphs[i++] = 2007; - glyphs[i++] = 2008; - glyphs[i++] = 2009; - glyphs[i++] = 2010; - glyphs[i++] = 2011; - glyphs[i++] = 2012; - glyphs[i++] = 2013; - glyphs[i++] = 2014; - glyphs[i++] = 2015; - glyphs[i++] = 2016; - glyphs[i++] = 2017; - glyphs[i++] = 2018; - glyphs[i++] = 2019; - glyphs[i++] = 2020; - - - r = 97; - i = 0; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; - encoding[i++] = r++; -#endif - - if (ac < 2) return 0; - - if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) { - fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]); - return 0; - } - - /* Generate a subset */ - CreateT3FromTTGlyphs(fnt, stdout, 0, glyphs, encoding, 256, 0); - - fprintf(stderr, "UnitsPerEm: %d.\n", fnt->unitsPerEm); - - /* Now call the dtor for the font */ - CloseTTFont(fnt); - return 0; -} -#endif - -#ifdef TEST7 -/* NameRecord extraction example */ -int main(int ac, char **av) -{ - TrueTypeFont *fnt; - int r, i, j, n; - NameRecord *nr; - - if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) { - fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]); - return 0; - } - - if ((n = GetTTNameRecords(fnt, &nr)) == 0) { - fprintf(stderr, "No name records in the font.\n"); - return 0; - } - - printf("Number of name records: %d.\n", n); - for (i = 0; i < n; i++) { - printf("%d %d %04X %d [", nr[i].platformID, nr[i].encodingID, nr[i].languageID, nr[i].nameID); - for (j=0; j<nr[i].slen; j++) { - printf("%c", isprint(nr[i].sptr[j]) ? nr[i].sptr[j] : '.'); + bool bRet = false; + sal_uInt16 nVersion = GetUInt16(pTable, 0, 1); + // parse OS/2 header + if ( nVersion >= 0x0001 && nLength >= 58 ) + { + rUnicodeRange.append(GetUInt32(pTable, 42, 1)); + rUnicodeRange.append(GetUInt32(pTable, 46, 1)); + rUnicodeRange.append(GetUInt32(pTable, 50, 1)); + rUnicodeRange.append(GetUInt32(pTable, 54, 1)); + bRet = true; + if (nLength >= 86) + { + rCodePageRange.append(GetUInt32(pTable, 78, 1)); + rCodePageRange.append(GetUInt32(pTable, 82, 1)); } - printf("]\n"); } - - - DisposeNameRecords(nr, n); - CloseTTFont(fnt); - return 0; + return bRet; } -#endif -#ifdef TEST8 -/* TrueType -> TrueType subsetting */ -int main(int ac, char **av) +void getTTScripts(std::vector< sal_uInt32 > &rScriptTags, const unsigned char* pTable, size_t nLength) { - TrueTypeFont *fnt; - sal_uInt16 glyphArray[] = { 0, 98, 99, 22, 24, 25, 26, 27, 28, 29, 30, 31, 1270, 1289, 34}; - sal_uInt8 encoding[] = {32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46}; - int r; - - if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) { - fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]); - return 0; - } - - CreateTTFromTTGlyphs(fnt, "subfont.ttf", glyphArray, encoding, 15, 0, 0, TTCF_AutoName | TTCF_IncludeOS2); - - - CloseTTFont(fnt); - - return 0; -} -#endif - -#ifdef TEST9 -/* TrueType -> Type42 subsetting */ -int main(int ac, char **av) -{ - TrueTypeFont *fnt; - /* - sal_uInt16 glyphArray[] = { 0, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34}; - sal_uInt8 encoding[] = {32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46}; - */ - sal_uInt16 glyphArray[] = { 0, 6711, 6724, 11133, 11144, 14360, 26, 27, 28, 29, 30, 31, 1270, 1289, 34}; - sal_uInt8 encoding[] = {32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46}; - int r; - - if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) { - fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]); - return 0; - } - - CreateT42FromTTGlyphs(fnt, stdout, "testfont", glyphArray, encoding, 15); - - CloseTTFont(fnt); - - return 0; -} -#endif - -#ifdef TEST10 -/* Component glyph test */ -int main(int ac, char **av) -{ - TrueTypeFont *fnt; - int r, i; - list glyphlist = listNewEmpty(); - + if (nLength < 6) + return; - if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) { - fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]); - return 0; - } + // parse GSUB/GPOS header + const sal_uInt16 nOfsScriptList = GetUInt16(pTable, 4, 1); - for (i = 0; i < fnt->nglyphs; i++) { - r = GetTTGlyphComponents(fnt, i, glyphlist); - if (r > 1) { - printf("%d -> ", i); - listToFirst(glyphlist); - do { - printf("%d ", (int) listCurrent(glyphlist)); - } while (listNext(glyphlist)); - printf("\n"); - } else { - printf("%d: single glyph.\n", i); - } - listClear(glyphlist); + // parse Script Table + const sal_uInt16 nCntScript = GetUInt16(pTable, nOfsScriptList, 1); + sal_uInt32 nCurrentPos = nOfsScriptList+2; + for( sal_uInt16 nScriptIndex = 0; + nScriptIndex < nCntScript && nLength >= 6; ++nScriptIndex, + nLength-=6 ) + { + sal_uInt32 nTag = GetUInt32(pTable, nCurrentPos, 1); + nCurrentPos+=6; + rScriptTags.push_back(nTag); // e.g. hani/arab/kana/hang } - CloseTTFont(fnt); - listDispose(glyphlist); - - return 0; + std::sort(rScriptTags.begin(), rScriptTags.end()); + rScriptTags.erase(std::unique(rScriptTags.begin(), rScriptTags.end()), rScriptTags.end()); } -#endif +} // namespace vcl +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index badf9fb496b0..4356636e90a2 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -398,16 +399,19 @@ int StreamToFile(TrueTypeCreator *_this, const char* fname) FILE* fd; if ((r = StreamToMemory(_this, &ptr, &length)) != SF_OK) return r; - if (!fname) return SF_BADFILE; - if ((fd = fopen(fname, "wb")) == NULL) return SF_BADFILE; - - if (fwrite(ptr, 1, length, fd) != length) { - r = SF_FILEIO; - } else { - r = SF_OK; + if (fname && (fd = fopen(fname, "wb")) != NULL) + { + if (fwrite(ptr, 1, length, fd) != length) { + r = SF_FILEIO; + } else { + r = SF_OK; + } + fclose(fd); + } + else + { + r = SF_BADFILE; } - - fclose(fd); free(ptr); return r; } @@ -1543,19 +1547,6 @@ static void ProcessTables(TrueTypeCreator *tt) PutUInt16(maxCompositePoints, pMaxpData, 10, 1); PutUInt16(maxCompositeContours, pMaxpData, 12, 1); -#if 0 - /* XXX do not overwrite the existing data. Fix: re-calculate these numbers here */ - PutUInt16(2, maxp->data, 14, 1); /* maxZones is always 2 */ - PutUInt16(0, maxp->data, 16, 1); /* maxTwilightPoints */ - PutUInt16(0, maxp->data, 18, 1); /* maxStorage */ - PutUInt16(0, maxp->data, 20, 1); /* maxFunctionDefs */ - PutUint16(0, maxp->data, 22, 1); /* maxInstructionDefs */ - PutUint16(0, maxp->data, 24, 1); /* maxStackElements */ - PutUint16(0, maxp->data, 26, 1); /* maxSizeOfInstructions */ - PutUint16(0, maxp->data, 28, 1); /* maxComponentElements */ - PutUint16(0, maxp->data, 30, 1); /* maxComponentDepth */ -#endif - /* * Generate an htmx table and update hhea table */ @@ -1664,3 +1655,5 @@ int main(void) return 0; } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/ttcr.hxx b/vcl/source/fontsubset/ttcr.hxx index 69583ecdbdda..b2beb0549174 100644 --- a/vcl/source/fontsubset/ttcr.hxx +++ b/vcl/source/fontsubset/ttcr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -259,3 +260,5 @@ extern "C" } #endif /* __TTCR_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/xlat.cxx b/vcl/source/fontsubset/xlat.cxx index 108c69cee8c7..1df7a5a2fdde 100644 --- a/vcl/source/fontsubset/xlat.cxx +++ b/vcl/source/fontsubset/xlat.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -219,3 +220,4 @@ void TranslateString16(sal_uInt16 *src, sal_uInt16 *dst, sal_uInt32 n) } // namespace vcl +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/xlat.hxx b/vcl/source/fontsubset/xlat.hxx index 5960336e13e3..3d8622bf9ae7 100644 --- a/vcl/source/fontsubset/xlat.hxx +++ b/vcl/source/fontsubset/xlat.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,3 +53,4 @@ namespace vcl #endif /* __XLAT_H */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx index 21c3f15f51c0..6107affaf4e9 100644 --- a/vcl/source/gdi/alpha.cxx +++ b/vcl/source/gdi/alpha.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -432,3 +433,5 @@ void AlphaMask::ReleaseAccess( BitmapReadAccess* pAccess ) Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index 9fc45f2f61d6..63d0010bd5d2 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -937,3 +938,5 @@ SvStream& operator>>( SvStream& rIStm, Animation& rAnimation ) return rIStm; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/base14.cxx b/vcl/source/gdi/base14.cxx index 83820bc654bf..9912b3e91509 100644 --- a/vcl/source/gdi/base14.cxx +++ b/vcl/source/gdi/base14.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,9 @@ #include <rtl/strbuf.hxx> using namespace vcl; -using namespace rtl; + +using ::rtl::OString; +using ::rtl::OStringBuffer; OString PDFWriterImpl::BuiltinFont::getNameObject() const { @@ -685,3 +688,4 @@ const PDFWriterImpl::BuiltinFont PDFWriterImpl::m_aBuiltinFonts[ 14 ] = { }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index bcf141a8e005..e2ab338e66b0 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,6 @@ #include <tools/stream.hxx> #include <tools/poly.hxx> #include <tools/rc.h> - #include <vcl/salbtype.hxx> #include <vcl/bmpacc.hxx> #include <vcl/outdev.hxx> @@ -223,7 +223,7 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries ) } else { - DBG_ERROR( "Bitmap::GetGreyPalette: invalid entry count (2/4/16/256 allowed)" ); + OSL_FAIL( "Bitmap::GetGreyPalette: invalid entry count (2/4/16/256 allowed)" ); return aGreyPalette2; } } @@ -1745,38 +1745,6 @@ Bitmap Bitmap::CreateDisplayBitmap( OutputDevice* pDisplay ) // ------------------------------------------------------------------ -Bitmap Bitmap::GetColorTransformedBitmap( BmpColorMode eColorMode ) const -{ - Bitmap aRet; - - if( BMP_COLOR_HIGHCONTRAST == eColorMode ) - { - Color* pSrcColors = NULL; - Color* pDstColors = NULL; - sal_uLong nColorCount = 0; - - aRet = *this; - - Image::GetColorTransformArrays( (ImageColorTransform) eColorMode, pSrcColors, pDstColors, nColorCount ); - - if( nColorCount && pSrcColors && pDstColors ) - aRet.Replace( pSrcColors, pDstColors, nColorCount ); - - delete[] pSrcColors; - delete[] pDstColors; - } - else if( BMP_COLOR_MONOCHROME_BLACK == eColorMode || - BMP_COLOR_MONOCHROME_WHITE == eColorMode ) - { - aRet = *this; - aRet.MakeMono( BMP_COLOR_MONOCHROME_THRESHOLD ); - } - - return aRet; -} - -// ------------------------------------------------------------------ - sal_Bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine ) { BitmapReadAccess* pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess(); @@ -1971,3 +1939,5 @@ bool Bitmap::GetSystemData( BitmapSystemData& rData ) const return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx index 8dffa7d59a2c..9db334395e23 100644 --- a/vcl/source/gdi/bitmap2.cxx +++ b/vcl/source/gdi/bitmap2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,9 +30,7 @@ #include "precompiled_vcl.hxx" #include <tools/zcodec.hxx> -#ifndef _TOOLS_STREAM_HXX #include <tools/stream.hxx> -#endif #include <vcl/salbtype.hxx> #include <vcl/bmpacc.hxx> #include <vcl/outdev.hxx> @@ -46,6 +45,8 @@ #define DIBCOREHEADERSIZE ( 12UL ) #define DIBINFOHEADERSIZE ( sizeof( DIBInfoHeader ) ) +#define BITMAPINFOHEADER 0x28 + #define SETPIXEL4( pBuf, nX, cChar )( (pBuf)[ (nX) >> 1 ] |= ( (nX) & 1 ) ? ( cChar ): (cChar) << 4 ); // ---------------------- @@ -129,7 +130,7 @@ SvStream& operator<<( SvStream& rOStm, const Bitmap& rBitmap ) // ------------------------------------------------------------------ -sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader ) +sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader, sal_Bool bIsMSOFormat ) { const sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt(); const sal_uLong nOldPos = rIStm.Tell(); @@ -144,7 +145,7 @@ sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader ) bRet = ImplReadDIB( rIStm, *this, nOffset ); } else - bRet = ImplReadDIB( rIStm, *this, nOffset ); + bRet = ImplReadDIB( rIStm, *this, nOffset, bIsMSOFormat ); if( !bRet ) { @@ -161,18 +162,18 @@ sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader ) // ------------------------------------------------------------------ -sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset ) +sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset, sal_Bool bIsMSOFormat ) { DIBInfoHeader aHeader; const sal_uLong nStmPos = rIStm.Tell(); sal_Bool bRet = sal_False; sal_Bool bTopDown = sal_False; - if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount ) + if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown, bIsMSOFormat ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount ) { const sal_uInt16 nBitCount( discretizeBitcount(aHeader.nBitCount) ); - const Size aSizePixel( aHeader.nWidth, aHeader.nHeight ); + const Size aSizePixel( aHeader.nWidth, abs(aHeader.nHeight) ); BitmapPalette aDummyPal; Bitmap aNewBmp( aSizePixel, nBitCount, &aDummyPal ); BitmapWriteAccess* pAcc = aNewBmp.AcquireWriteAccess(); @@ -215,7 +216,8 @@ sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset ) // set decoded bytes to memory stream, // from which we will read the bitmap data - pIStm = pMemStm = new SvMemoryStream; + pMemStm = new SvMemoryStream; + pIStm = pMemStm; pMemStm->SetBuffer( (char*) pData, nUncodedSize, sal_False, nUncodedSize ); nOffset = 0; } @@ -244,7 +246,7 @@ sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset ) Fraction( 1000, aHeader.nYPelsPerMeter ) ); aNewBmp.SetPrefMapMode( aMapMode ); - aNewBmp.SetPrefSize( Size( aHeader.nWidth, aHeader.nHeight ) ); + aNewBmp.SetPrefSize( Size( aHeader.nWidth, abs(aHeader.nHeight) ) ); } } @@ -299,21 +301,37 @@ sal_Bool Bitmap::ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset ) // ------------------------------------------------------------------ -sal_Bool Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown ) +sal_Bool Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, sal_Bool bIsMSOFormat ) { // BITMAPINFOHEADER or BITMAPCOREHEADER rIStm >> rHeader.nSize; // BITMAPCOREHEADER + sal_Int16 nTmp16 = 0; if ( rHeader.nSize == DIBCOREHEADERSIZE ) { - sal_Int16 nTmp16; rIStm >> nTmp16; rHeader.nWidth = nTmp16; rIStm >> nTmp16; rHeader.nHeight = nTmp16; rIStm >> rHeader.nPlanes; rIStm >> rHeader.nBitCount; } + else if ( bIsMSOFormat && ( rHeader.nSize == BITMAPINFOHEADER ) ) + { + sal_uInt8 nTmp8 = 0; + rIStm >> nTmp16; rHeader.nWidth = nTmp16; + rIStm >> nTmp16; rHeader.nHeight = nTmp16; + rIStm >> nTmp8; rHeader.nPlanes = nTmp8; + rIStm >> nTmp8; rHeader.nBitCount = nTmp8; + rIStm >> nTmp16; rHeader.nSizeImage = nTmp16; + rIStm >> nTmp16; rHeader.nCompression = nTmp16; + if ( !rHeader.nSizeImage ) // uncompressed? + rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight; + rIStm >> rHeader.nXPelsPerMeter; + rIStm >> rHeader.nYPelsPerMeter; + rIStm >> rHeader.nColsUsed; + rIStm >> rHeader.nColsImportant; + } else { // unknown Header @@ -365,7 +383,7 @@ sal_Bool Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, else { rIStm >> rHeader.nWidth; - rIStm >> rHeader.nHeight; + rIStm >> rHeader.nHeight; //rHeader.nHeight=abs(rHeader.nHeight); rIStm >> rHeader.nPlanes; rIStm >> rHeader.nBitCount; rIStm >> rHeader.nCompression; @@ -461,7 +479,13 @@ sal_Bool Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, Bitma if( rHeader.nColsUsed && rHeader.nBitCount > 8 ) rIStm.SeekRel( rHeader.nColsUsed * ( ( rHeader.nSize != DIBCOREHEADERSIZE ) ? 4 : 3 ) ); - rIStm.Read( rAcc.GetBuffer(), rHeader.nHeight * nAlignedWidth ); + if ( rHeader.nHeight > 0 ) + rIStm.Read( rAcc.GetBuffer(), rHeader.nHeight * nAlignedWidth ); + else + { + for( int i = abs(rHeader.nHeight)-1; i >= 0; i-- ) + rIStm.Read( ((char*)rAcc.GetBuffer()) + (nAlignedWidth*i), nAlignedWidth ); + } } else { @@ -504,7 +528,7 @@ sal_Bool Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, Bitma else { const long nWidth = rHeader.nWidth; - const long nHeight = rHeader.nHeight; + const long nHeight = abs(rHeader.nHeight); sal_uInt8* pBuf = new sal_uInt8[ nAlignedWidth ]; // true color DIB's can have a (optimization) palette @@ -1061,7 +1085,7 @@ void Bitmap::ImplDecodeRLE( sal_uInt8* pBuffer, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc, sal_Bool bRLE4 ) { Scanline pRLE = pBuffer; - long nY = rHeader.nHeight - 1L; + long nY = abs(rHeader.nHeight) - 1L; const sal_uLong nWidth = rAcc.Width(); sal_uLong nCountByte; sal_uLong nRunByte; @@ -1275,3 +1299,5 @@ sal_Bool Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool return( rOStm.GetError() == 0UL ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index d39b0f7169d0..0ae8e63d2519 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -355,7 +356,7 @@ sal_Bool Bitmap::Convert( BmpConversion eConversion ) break; default: - DBG_ERROR( "Bitmap::Convert(): Unsupported conversion" ); + OSL_FAIL( "Bitmap::Convert(): Unsupported conversion" ); break; } @@ -967,10 +968,11 @@ sal_Bool Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY ) const long nHeight = pReadAcc->Height(); long* pLutX = new long[ nNewWidth ]; long* pLutY = new long[ nNewHeight ]; - long nX, nY, nMapY, nActY = 0L; if( nNewWidth1 && nNewHeight1 ) { + long nX, nY, nMapY, nActY = 0L; + for( nX = 0L; nX < nNewWidth; nX++ ) pLutX[ nX ] = nX * nWidth / nNewWidth; @@ -1841,7 +1843,7 @@ sal_Bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount ) nBitCount = 8; else { - DBG_ERROR( "Bitmap::ImplReduceMedian(): invalid color count!" ); + OSL_FAIL( "Bitmap::ImplReduceMedian(): invalid color count!" ); nBitCount = 8; nColCount = 256; } @@ -2203,3 +2205,5 @@ sal_Bool Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index 5fe9139ea35e..1166f6cc0931 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,6 @@ #include "precompiled_vcl.hxx" #include <stdlib.h> -#include <vos/macros.hxx> #include <vcl/bmpacc.hxx> #include <vcl/bitmap.hxx> @@ -98,7 +98,7 @@ sal_Bool Bitmap::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, break; default: - DBG_ERROR( "Bitmap::Convert(): Unsupported filter" ); + OSL_FAIL( "Bitmap::Convert(): Unsupported filter" ); break; } @@ -474,7 +474,7 @@ sal_Bool Bitmap::ImplSobelGrey( const BmpFilterParam* /*pFilterParam*/, const Li nSum2 += nMask332 * nGrey33; nSum1 = (long) sqrt( (double)( nSum1 * nSum1 + nSum2 * nSum2 ) ); - aGrey.SetIndex( ~(sal_uInt8) VOS_BOUND( nSum1, 0, 255 ) ); + aGrey.SetIndex( ~(sal_uInt8) SAL_BOUND( nSum1, 0, 255 ) ); pWriteAcc->SetPixel( nY, nX, aGrey ); if( nX < ( nWidth - 1 ) ) @@ -549,7 +549,7 @@ sal_Bool Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* const long nLz = FRound( sin( fElev ) * 255.0 ); const long nZ2 = ( ( 6 * 255 ) / 4 ) * ( ( 6 * 255 ) / 4 ); const long nNzLz = ( ( 6 * 255 ) / 4 ) * nLz; - const sal_uInt8 cLz = (sal_uInt8) VOS_BOUND( nLz, 0, 255 ); + const sal_uInt8 cLz = (sal_uInt8) SAL_BOUND( nLz, 0, 255 ); // fill mapping tables pHMap[ 0 ] = 0; @@ -586,7 +586,7 @@ sal_Bool Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* else { const double fGrey = nDotL / sqrt( (double)(nNx * nNx + nNy * nNy + nZ2) ); - aGrey.SetIndex( (sal_uInt8) VOS_BOUND( fGrey, 0, 255 ) ); + aGrey.SetIndex( (sal_uInt8) SAL_BOUND( fGrey, 0, 255 ) ); } pWriteAcc->SetPixel( nY, nX, aGrey ); @@ -687,7 +687,7 @@ sal_Bool Bitmap::ImplSepia( const BmpFilterParam* pFilterParam, const Link* /*pP { long nSepiaPercent = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_SEPIA ) ? pFilterParam->mcSolarGreyThreshold : 10; - const long nSepia = 10000 - 100 * VOS_BOUND( nSepiaPercent, 0, 100 ); + const long nSepia = 10000 - 100 * SAL_BOUND( nSepiaPercent, 0, 100 ); BitmapPalette aSepiaPal( 256 ); DBG_ASSERT( nSepiaPercent <= 100, "Bitmap::ImplSepia(): sepia value out of range; defaulting to 100%" ); @@ -1007,3 +1007,5 @@ sal_Bool Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link* return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 743326df04d5..2e77b666f8c8 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,6 +44,7 @@ #include <vcl/pngread.hxx> #include <vcl/svapp.hxx> #include <vcl/bmpacc.hxx> +#include <vcl/virdev.hxx> #include <image.h> #include <impimagetree.hxx> @@ -107,11 +109,11 @@ BitmapEx::BitmapEx( const ResId& rResId ) : const String aFileName( pResMgr->ReadString() ); ::rtl::OUString aCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName(); - if( !aImageTree->loadImage( aFileName, aCurrentSymbolsStyle, *this ) ) + if( !aImageTree->loadImage( aFileName, aCurrentSymbolsStyle, *this, true ) ) { #ifdef DBG_UTIL ByteString aErrorStr( "BitmapEx::BitmapEx( const ResId& rResId ): could not load image <" ); - DBG_ERROR( ( ( aErrorStr += ByteString( aFileName, RTL_TEXTENCODING_ASCII_US ) ) += '>' ).GetBuffer() ); + OSL_FAIL( ( ( aErrorStr += ByteString( aFileName, RTL_TEXTENCODING_ASCII_US ) ) += '>' ).GetBuffer() ); #endif } } @@ -301,36 +303,6 @@ Bitmap BitmapEx::GetBitmap( const Color* pTransReplaceColor ) const // ------------------------------------------------------------------ -BitmapEx BitmapEx::GetColorTransformedBitmapEx( BmpColorMode eColorMode ) const -{ - BitmapEx aRet; - - if( BMP_COLOR_HIGHCONTRAST == eColorMode ) - { - aRet = *this; - aRet.aBitmap = aBitmap.GetColorTransformedBitmap( eColorMode ); - } - else if( BMP_COLOR_MONOCHROME_BLACK == eColorMode || - BMP_COLOR_MONOCHROME_WHITE == eColorMode ) - { - aRet = *this; - aRet.aBitmap = aRet.aBitmap.GetColorTransformedBitmap( eColorMode ); - - if( !aRet.aMask.IsEmpty() ) - { - aRet.aMask.CombineSimple( aRet.aBitmap, BMP_COMBINE_OR ); - aRet.aBitmap.Erase( ( BMP_COLOR_MONOCHROME_BLACK == eColorMode ) ? COL_BLACK : COL_WHITE ); - - DBG_ASSERT( aRet.aBitmap.GetSizePixel() == aRet.aMask.GetSizePixel(), - "BitmapEx::GetColorTransformedBitmapEx(): size mismatch for bitmap and alpha mask." ); - } - } - - return aRet; -} - -// ------------------------------------------------------------------ - Bitmap BitmapEx::GetMask() const { Bitmap aRet( aMask ); @@ -758,6 +730,60 @@ void BitmapEx::Draw( OutputDevice* pOutDev, pOutDev->DrawBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, *this ); } +BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize) +{ + Point aEmptyPoint(0,0); + sal_Int32 imgNewWidth = 0; + sal_Int32 imgNewHeight = 0; + double imgposX = 0; + double imgposY = 0; + BitmapEx aRet = aBitmap; + double imgOldWidth = aRet.GetSizePixel().Width(); + double imgOldHeight =aRet.GetSizePixel().Height(); + + Size aScaledSize; + if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize) + { + if (imgOldWidth >= imgOldHeight) + { + imgNewWidth = aStandardSize; + imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5); + imgposX = 0; + imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5; + } + else + { + imgNewHeight = aStandardSize; + imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5); + imgposY = 0; + imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5; + } + + aScaledSize = Size( imgNewWidth, imgNewHeight ); + aRet.Scale( aScaledSize, BMP_SCALE_INTERPOLATE ); + } + else + { + imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5; + imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5; + } + + Size aStdSize( aStandardSize, aStandardSize ); + Rectangle aRect(aEmptyPoint, aStdSize ); + + VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 ); + aVirDevice.SetOutputSizePixel( aStdSize ); + aVirDevice.SetFillColor( COL_TRANSPARENT ); + aVirDevice.SetLineColor( COL_TRANSPARENT ); + + //draw a rect into virDevice + aVirDevice.DrawRect( aRect ); + Point aPointPixel( (long)imgposX, (long)imgposY ); + aVirDevice.DrawBitmapEx( aPointPixel, aRet ); + aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize ); + + return aRet; +} // ------------------------------------------------------------------ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const @@ -913,3 +939,5 @@ SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx ) return rIStm; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx index ed0dc6225a0f..03b29fcbc965 100644 --- a/vcl/source/gdi/bmpacc.cxx +++ b/vcl/source/gdi/bmpacc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -252,7 +253,7 @@ void BitmapReadAccess::ImplZeroInitUnusedBits() default: { - DBG_ERROR( "BitmapWriteAccess::ZeroInitUnusedBits: Unsupported pixel format"); + OSL_FAIL( "BitmapWriteAccess::ZeroInitUnusedBits: Unsupported pixel format"); nBits = 0; bMsb = true; } @@ -448,3 +449,5 @@ void BitmapWriteAccess::CopyBuffer( const BitmapReadAccess& rReadAcc ) for( long nY = 0L, nHeight = Min( mpBuffer->mnHeight, rReadAcc.Height() ); nY < nHeight; nY++ ) CopyScanline( nY, rReadAcc ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx index ae0eade2381b..718bd56cdb0c 100644 --- a/vcl/source/gdi/bmpacc2.cxx +++ b/vcl/source/gdi/bmpacc2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -329,3 +330,5 @@ IMPL_FORMAT_SETPIXEL( _32BIT_TC_MASK ) { rMask.SetColorFor32Bit( rBitmapColor, pScanline + ( nX << 2UL ) ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bmpacc3.cxx b/vcl/source/gdi/bmpacc3.cxx index fc3e031f260e..39d57a05cb84 100644 --- a/vcl/source/gdi/bmpacc3.cxx +++ b/vcl/source/gdi/bmpacc3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -411,3 +412,5 @@ void BitmapWriteAccess::DrawPolyPolygon( const PolyPolygon& rPolyPoly ) } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bmpconv.cxx b/vcl/source/gdi/bmpconv.cxx index 789c8377318d..886055817312 100644 --- a/vcl/source/gdi/bmpconv.cxx +++ b/vcl/source/gdi/bmpconv.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #include "vcl/bitmap.hxx" #include "vcl/svapp.hxx" #include "vcl/salctype.hxx" -#include "vos/mutex.hxx" +#include <osl/mutex.hxx> #include "tools/stream.hxx" #include "com/sun/star/script/XInvocation.hpp" #include "com/sun/star/awt/XBitmap.hpp" @@ -43,7 +44,8 @@ using namespace com::sun::star::script; using namespace com::sun::star::beans; using namespace com::sun::star::reflection; using namespace com::sun::star::awt; -using namespace rtl; + +using ::rtl::OUString; namespace vcl { @@ -118,7 +120,7 @@ Any SAL_CALL BmpConverter::getValue( const OUString& ) throw( UnknownPropertyExc sal_Bool SAL_CALL BmpConverter::hasMethod( const OUString& rName ) throw() { - return rName.equalsIgnoreAsciiCase( OUString::createFromAscii( "convert-bitmap-depth" ) ); + return rName.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("convert-bitmap-depth")) ); } sal_Bool SAL_CALL BmpConverter::hasProperty( const OUString& ) throw() @@ -135,7 +137,7 @@ Any SAL_CALL BmpConverter::invoke( { Any aRet; - if( rFunction.equalsIgnoreAsciiCase( OUString::createFromAscii( "convert-bitmap-depth" ) ) ) + if( rFunction.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("convert-bitmap-depth")) ) ) { Reference< XBitmap > xBM; sal_uInt16 nTargetDepth = 0; @@ -149,7 +151,7 @@ Any SAL_CALL BmpConverter::invoke( Sequence< sal_Int8 > aDIB = xBM->getDIB(); // call into vcl not thread safe - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvMemoryStream aStream( aDIB.getArray(), aDIB.getLength(), STREAM_READ | STREAM_WRITE ); Bitmap aBM; @@ -211,3 +213,5 @@ Sequence< sal_Int8 > SAL_CALL BmpTransporter::getMaskDIB() throw() { return Sequence< sal_Int8 >(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx index a3b729e69244..e410e0ee25e8 100644 --- a/vcl/source/gdi/bmpfast.cxx +++ b/vcl/source/gdi/bmpfast.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -251,63 +252,6 @@ class TrueColorPixelPtr<BMP_FORMAT_8BIT_PAL> : public TrueColorPixelPtr<BMP_FORMAT_8BIT_TC_MASK> {}; -#if 0 -template <> -class TrueColorPixelPtr<BMP_FORMAT_24BIT_TC_MASK> : public BasePixelPtr -{ -public: - void operator++() { mpPixel += 3; } - - unsigned GetAlpha() const - { - unsigned nAlpha = mpPixel[0]; - nAlpha |= mpPixel[1] << 8U; - nAlpha |= mpPixel[2] << 16U; - return nAlpha; - } - - void SetAlpha( unsigned nAlpha ) const - { - mpPixel[0] = nAlpha; - mpPixel[1] = nAlpha >> 8U; - mpPixel[2] = nAlpha >> 16U; - } -}; - -template <> -class TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_MASK> : public BasePixelPtr -{ -public: - void operator++() { mpPixel += 4; } - - unsigned GetAlpha() const - { -#ifdef OSL_BIGENDIAN - unsigned nAlpha = *reinterpret_cast<unsigned*>( mpPixel ); -#else - unsigned nAlpha = mpPixel[0]; - nAlpha |= mpPixel[1] << 8U; - nAlpha |= mpPixel[2] << 16U; - nAlpha |= mpPixel[3] << 24U; -#endif - return nAlpha; - } - - void SetAlpha( unsigned nAlpha ) const - { -#ifdef OSL_BIGENDIAN - *reinterpret_cast<unsigned*>( mpPixel ) = nAlpha; -#else - mpPixel[0] = nAlpha; - mpPixel[1] = nAlpha >> 8U; - mpPixel[2] = nAlpha >> 16U; - mpPixel[3] = nAlpha >> 24U; -#endif - } -}; - -#endif - // ======================================================================= // converting truecolor formats @@ -1038,3 +982,5 @@ bool ImplFastEraseBitmap( BitmapBuffer&, const BitmapColor& ) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx index ce39c70e243f..1ddc801c8329 100644 --- a/vcl/source/gdi/configsettings.cxx +++ b/vcl/source/gdi/configsettings.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,7 +37,6 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> -using namespace rtl; using namespace utl; using namespace vcl; using namespace com::sun::star::uno; @@ -44,6 +44,8 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; +using ::rtl::OUString; + #define SETTINGS_CONFIGNODE "VCL/Settings" /* @@ -90,7 +92,7 @@ void SettingsConfigItem::Commit() if( ! IsValidConfigMgr() ) return; - std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group; + boost::unordered_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group; for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group ) { @@ -135,12 +137,11 @@ void SettingsConfigItem::getValues() m_aSettings.clear(); Sequence< OUString > aNames( GetNodeNames( OUString() ) ); - m_aSettings.resize( aNames.getLength() ); for( int j = 0; j < aNames.getLength(); j++ ) { #if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, "found settings data for \"%s\"\n", + OSL_TRACE( "found settings data for \"%s\"\n", OUStringToOString( aNames.getConstArray()[j], RTL_TEXTENCODING_ASCII_US ).getStr() ); #endif @@ -166,7 +167,7 @@ void SettingsConfigItem::getValues() if( pLine->getLength() ) m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine; #if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, " \"%s\"=\"%.30s\"\n", + OSL_TRACE( " \"%s\"=\"%.30s\"\n", OUStringToOString( aKeys.getConstArray()[i], RTL_TEXTENCODING_ASCII_US ).getStr(), OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() ); @@ -182,7 +183,7 @@ void SettingsConfigItem::getValues() const OUString& SettingsConfigItem::getValue( const OUString& rGroup, const OUString& rKey ) const { - ::std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup ); + ::boost::unordered_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup ); if( group == m_aSettings.end() || group->second.find( rKey ) == group->second.end() ) { static OUString aEmpty; @@ -205,3 +206,4 @@ void SettingsConfigItem::setValue( const OUString& rGroup, const OUString& rKey, } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/cvtgrf.cxx b/vcl/source/gdi/cvtgrf.cxx index 61a08df4ddc0..6d3b60777120 100644 --- a/vcl/source/gdi/cvtgrf.cxx +++ b/vcl/source/gdi/cvtgrf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -171,3 +172,5 @@ sal_uLong GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, sa return nRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 7a6dd74db2c5..21f977a45396 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -561,7 +562,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.SetPrefSize( aPrefSz ); rMtf.SetPrefMapMode( aMapMode ); - sal_uInt32 nLastPolygonAction(0); + size_t nLastPolygonAction(0); for( sal_Int32 i = 0L; i < nActions; i++ ) { @@ -630,7 +631,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) ImplReadExtendedPolyPolygonAction(rIStm, aInputPolyPolygon); // now check if it can be set somewhere - if(nLastPolygonAction < rMtf.GetActionCount()) + if(nLastPolygonAction < rMtf.GetActionSize()) { MetaPolyLineAction* pPolyLineAction = dynamic_cast< MetaPolyLineAction* >(rMtf.GetAction(nLastPolygonAction)); @@ -778,7 +779,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_POLYLINE_ACTION ): { ImplReadPoly( rIStm, aActionPoly ); - nLastPolygonAction = rMtf.GetActionCount(); + nLastPolygonAction = rMtf.GetActionSize(); if( bFatLine ) rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) ); @@ -801,7 +802,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } else { - nLastPolygonAction = rMtf.GetActionCount(); + nLastPolygonAction = rMtf.GetActionSize(); rMtf.AddAction( new MetaPolygonAction( aActionPoly ) ); } } @@ -825,7 +826,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } else { - nLastPolygonAction = rMtf.GetActionCount(); + nLastPolygonAction = rMtf.GetActionSize(); rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) ); } } @@ -942,7 +943,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } #ifdef DBG_UTIL else - DBG_ERROR("More than one DX array element missing on SVM import"); + OSL_FAIL("More than one DX array element missing on SVM import"); #endif } } @@ -1379,7 +1380,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf ) { - sal_uLong nPos; sal_uLong nCountPos; Font aSaveFont; const sal_uInt16 nOldFormat = rOStm.GetNumberFormatInt(); @@ -1394,7 +1394,6 @@ void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf ) //MagicCode schreiben rOStm << "SVGDI"; // Kennung - nPos = rOStm.Tell(); rOStm << (sal_Int16) 42; // HeaderSize rOStm << (sal_Int16) 200; // VERSION rOStm << (sal_Int32) aPrefSize.Width(); @@ -1426,7 +1425,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rtl_TextEncoding& rActualCharSet ) { sal_uLong nCount = 0; - for( sal_uLong i = 0, nActionCount = rMtf.GetActionCount(); i < nActionCount; i++ ) + for( size_t i = 0, nActionCount = rMtf.GetActionSize(); i < nActionCount; i++ ) { const MetaAction* pAction = rMtf.GetAction( i ); @@ -2363,11 +2362,6 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, } break; -#if 0 - case( META_OVERLINECOLOR_ACTION ): - break; -#endif - case( META_TEXTLINE_ACTION ): { const MetaTextLineAction* pA = (MetaTextLineAction*) pAction; @@ -2440,7 +2434,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, ByteString aStr( "Missing implementation for Action#: " ); aStr += ByteString::CreateFromInt32( pAction->GetType() ); aStr += '!'; - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } break; #endif @@ -2514,3 +2508,5 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, return nCount; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/extoutdevdata.cxx b/vcl/source/gdi/extoutdevdata.cxx index eebd6b35765b..2b8ad0fb9ae6 100644 --- a/vcl/source/gdi/extoutdevdata.cxx +++ b/vcl/source/gdi/extoutdevdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,5 @@ ExtOutDevData::~ExtOutDevData() } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx index 4f1aad4d36cb..8ed39ea10fed 100644 --- a/vcl/source/gdi/font.cxx +++ b/vcl/source/gdi/font.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,6 +41,7 @@ #include "outfont.hxx" #include "sft.hxx" +#include <sal/macros.h> #include <algorithm> @@ -169,7 +171,7 @@ void Impl_Font::AskConfig() mbConfigLookup = true; // prepare the FontSubst configuration lookup - const utl::FontSubstConfiguration* pFontSubst = utl::FontSubstConfiguration::get(); + const utl::FontSubstConfiguration& rFontSubst = utl::FontSubstConfiguration::get(); String aShortName; String aFamilyName; @@ -182,11 +184,11 @@ void Impl_Font::AskConfig() aShortName, aFamilyName, eWeight, eWidthType, nType ); // lookup the font name in the configuration - const utl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName ); + const utl::FontNameAttr* pFontAttr = rFontSubst.getSubstInfo( aMapName ); // if the direct lookup failed try again with an alias name if ( !pFontAttr && (aShortName != aMapName) ) - pFontAttr = pFontSubst->getSubstInfo( aShortName ); + pFontAttr = rFontSubst.getSubstInfo( aShortName ); if( pFontAttr ) { @@ -1032,7 +1034,7 @@ namespace aEnt.string = pOpen+1; aEnt.string_len = (pClose-pOpen)-1; aEnt.weight = WEIGHT_NORMAL; - const int nEnt = sizeof( weight_table ) / sizeof( weight_table[0] ); + const int nEnt = SAL_N_ELEMENTS( weight_table ); WeightSearchEntry* pFound = std::lower_bound( weight_table, weight_table+nEnt, aEnt ); if( pFound != (weight_table+nEnt) ) o_rResult.SetWeight( pFound->weight ); @@ -1113,3 +1115,5 @@ FontStrikeout Font::GetStrikeout() const { return mpImplFont->meStrikeout; } FontEmphasisMark Font::GetEmphasisMark() const { return mpImplFont->meEmphasisMark; } sal_Bool Font::IsWordLineMode() const { return mpImplFont->mbWordLine; } sal_Bool Font::IsSameInstance( const Font& rFont ) const { return (mpImplFont == rFont.mpImplFont); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 1e99c5c3c04f..984386028cdc 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <vos/macros.hxx> #include <rtl/crc.h> #include <tools/stream.hxx> #include <tools/vcompat.hxx> @@ -35,12 +35,30 @@ #include <vcl/salbtype.hxx> #include <vcl/outdev.hxx> #include <vcl/window.hxx> -#ifndef _SV_CVTSVM_HXX #include <vcl/cvtsvm.hxx> -#endif #include <vcl/virdev.hxx> +#include <vcl/svapp.hxx> #include <vcl/gdimtf.hxx> #include <vcl/graphictools.hxx> +#include <vcl/canvastools.hxx> +#include <vcl/unohelp.hxx> + +#include <salbmp.hxx> +#include <salinst.hxx> +#include <svdata.hxx> + +#include <com/sun/star/beans/XFastPropertySet.hpp> +#include <com/sun/star/rendering/MtfRenderer.hpp> +#include <com/sun/star/rendering/XBitmapCanvas.hpp> +#include <com/sun/star/rendering/XCanvas.hpp> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/awt/XGraphics.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/graphic/XGraphicRenderer.hpp> + +using namespace com::sun::star; // ----------- // - Defines - @@ -135,52 +153,95 @@ struct ImpLabel // - LabelList - // ------------- -class ImpLabelList : private List +typedef ::std::vector< ImpLabel* > ImpLabelVector; + +class ImpLabelList { +private: + ImpLabelVector aList; + size_t nListPos; + public: - ImpLabelList() : List( 8, 4, 4 ) {} - ImpLabelList( const ImpLabelList& rList ); - ~ImpLabelList(); - - void ImplInsert( ImpLabel* p ) { Insert( p, LIST_APPEND ); } - ImpLabel* ImplRemove( sal_uLong nPos ) { return (ImpLabel*) Remove( nPos ); } - void ImplReplace( ImpLabel* p ) { Replace( (void*)p ); } - ImpLabel* ImplFirst() { return (ImpLabel*) First(); } - ImpLabel* ImplNext() { return (ImpLabel*) Next(); } - ImpLabel* ImplGetLabel( sal_uLong nPos ) const { return (ImpLabel*) GetObject( nPos ); } - sal_uLong ImplGetLabelPos( const String& rLabelName ); - sal_uLong ImplCount() const { return Count(); } + ImpLabelList() {} + ImpLabelList( const ImpLabelList& rList ); + ~ImpLabelList(); + + void ImplInsert( ImpLabel* p ) { aList.push_back( p ); } + + ImpLabel* ImplFirst(); + ImpLabel* ImplNext(); + ImpLabel* ImplGetLabel( size_t nPos ) const; + ImpLabel* ImplRemove( size_t nPos ); + + size_t ImplGetLabelPos( const String& rLabelName ); + size_t ImplCount() const { return aList.size(); } }; // ------------------------------------------------------------------------ -ImpLabelList::ImpLabelList( const ImpLabelList& rList ) : - List( rList ) +ImpLabelList::ImpLabelList( const ImpLabelList& rList ) { - for( ImpLabel* pLabel = ImplFirst(); pLabel; pLabel = ImplNext() ) - ImplReplace( new ImpLabel( *pLabel ) ); + for( size_t i = 0, n = rList.ImplCount(); i < n; ++i ) + aList.push_back( new ImpLabel( *rList.ImplGetLabel( i ) ) ); + nListPos = 0; } // ------------------------------------------------------------------------ ImpLabelList::~ImpLabelList() { - for( ImpLabel* pLabel = ImplFirst(); pLabel; pLabel = ImplNext() ) - delete pLabel; + for( size_t i = 0, n = aList.size(); i < n; ++i ) + delete aList[ i ]; + aList.clear(); +} + +// ------------------------------------------------------------------------ +ImpLabel* ImpLabelList::ImplFirst() +{ + nListPos = 0; + return ( aList.empty() ) ? NULL : aList[ nListPos ]; +} + +// ------------------------------------------------------------------------ +ImpLabel* ImpLabelList::ImplNext() +{ + return ( nListPos + 1 < aList.size() ) ? aList[ ++nListPos ] : NULL; +} + +// ------------------------------------------------------------------------ + +ImpLabel* ImpLabelList::ImplGetLabel( size_t nPos ) const +{ + return ( nPos < aList.size() ) ? aList[ nPos ] : NULL; +} + +// ------------------------------------------------------------------------ + +ImpLabel* ImpLabelList::ImplRemove( size_t nPos ) +{ + ImpLabel* return_value = NULL; + if ( nPos < aList.size() ) + { + ImpLabelVector::iterator it = aList.begin(); + ::std::advance( it, nPos ); + return_value = *it; + aList.erase( it ); + } + return return_value; } // ------------------------------------------------------------------------ -sal_uLong ImpLabelList::ImplGetLabelPos( const String& rLabelName ) +size_t ImpLabelList::ImplGetLabelPos( const String& rLabelName ) { - sal_uLong nLabelPos = METAFILE_LABEL_NOTFOUND; + size_t nLabelPos = METAFILE_LABEL_NOTFOUND; - for( ImpLabel* pLabel = ImplFirst(); pLabel; pLabel = ImplNext() ) + for ( size_t i = 0, n = aList.size(); i < n; ++i ) { - if ( rLabelName == pLabel->aLabelName ) + if ( rLabelName == aList[ i ]->aLabelName ) { - nLabelPos = GetCurPos(); + nLabelPos = i; break; } } @@ -193,21 +254,20 @@ sal_uLong ImpLabelList::ImplGetLabelPos( const String& rLabelName ) // --------------- GDIMetaFile::GDIMetaFile() : - List ( 0x3EFF, 64, 64 ), aPrefSize ( 1, 1 ), pPrev ( NULL ), pNext ( NULL ), pOutDev ( NULL ), pLabelList ( NULL ), bPause ( sal_False ), - bRecord ( sal_False ) + bRecord ( sal_False ), + bUseCanvas ( sal_False ) { } // ------------------------------------------------------------------------ GDIMetaFile::GDIMetaFile( const GDIMetaFile& rMtf ) : - List ( rMtf ), aPrefMapMode ( rMtf.aPrefMapMode ), aPrefSize ( rMtf.aPrefSize ), aHookHdlLink ( rMtf.aHookHdlLink ), @@ -215,11 +275,15 @@ GDIMetaFile::GDIMetaFile( const GDIMetaFile& rMtf ) : pNext ( rMtf.pNext ), pOutDev ( NULL ), bPause ( sal_False ), - bRecord ( sal_False ) + bRecord ( sal_False ), + bUseCanvas ( rMtf.bUseCanvas ) { // RefCount der MetaActions erhoehen - for( void* pAct = First(); pAct; pAct = Next() ) - ( (MetaAction*) pAct )->Duplicate(); + for( size_t i = 0, n = rMtf.GetActionSize(); i < n; ++i ) + { + rMtf.GetAction( i )->Duplicate(); + aList.push_back( rMtf.GetAction( i ) ); + } if( rMtf.pLabelList ) pLabelList = new ImpLabelList( *rMtf.pLabelList ); @@ -244,17 +308,62 @@ GDIMetaFile::~GDIMetaFile() // ------------------------------------------------------------------------ +size_t GDIMetaFile::GetActionSize() const +{ + return aList.size(); +} + +// ------------------------------------------------------------------------ + +MetaAction* GDIMetaFile::GetAction( size_t nAction ) const +{ + return (nAction < aList.size()) ? aList[ nAction ] : NULL; +} + +// ------------------------------------------------------------------------ + +MetaAction* GDIMetaFile::FirstAction() +{ + nCurrentActionElement = 0; + return aList.empty() ? NULL : aList[ 0 ]; +} + +// ------------------------------------------------------------------------ + +MetaAction* GDIMetaFile::NextAction() +{ + return ( nCurrentActionElement + 1 < aList.size() ) ? aList[ ++nCurrentActionElement ] : NULL; +} + +// ------------------------------------------------------------------------ + +MetaAction* GDIMetaFile::ReplaceAction( MetaAction* pAction, size_t nAction ) +{ + if ( nAction < aList.size() ) + { + ::std::vector< MetaAction* >::iterator it = aList.begin(); + ::std::advance( it, nAction ); + (*it)->Delete(); + *it = pAction; + } + return pAction; +} + + +// ------------------------------------------------------------------------ + GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf ) { if( this != &rMtf ) { Clear(); - List::operator=( rMtf ); - // RefCount der MetaActions erhoehen - for( void* pAct = First(); pAct; pAct = Next() ) - ( (MetaAction*) pAct )->Duplicate(); + for( size_t i = 0, n = rMtf.GetActionSize(); i < n; ++i ) + { + rMtf.GetAction( i )->Duplicate(); + aList.push_back( rMtf.GetAction( i ) ); + } if( rMtf.pLabelList ) pLabelList = new ImpLabelList( *rMtf.pLabelList ); @@ -269,6 +378,7 @@ GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf ) pOutDev = NULL; bPause = sal_False; bRecord = sal_False; + bUseCanvas = rMtf.bUseCanvas; if( rMtf.bRecord ) { @@ -286,20 +396,20 @@ GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf ) sal_Bool GDIMetaFile::operator==( const GDIMetaFile& rMtf ) const { - const sal_uLong nObjCount = Count(); + const size_t nObjCount = aList.size(); sal_Bool bRet = sal_False; if( this == &rMtf ) bRet = sal_True; - else if( rMtf.GetActionCount() == nObjCount && - rMtf.GetPrefSize() == aPrefSize && + else if( rMtf.GetActionSize() == nObjCount && + rMtf.GetPrefSize() == aPrefSize && rMtf.GetPrefMapMode() == aPrefMapMode ) { bRet = sal_True; - for( sal_uLong n = 0UL; n < nObjCount; n++ ) + for( size_t n = 0; n < nObjCount; n++ ) { - if( GetObject( n ) != rMtf.GetObject( n ) ) + if( aList[ n ] != rMtf.GetAction( n ) ) { bRet = sal_False; break; @@ -314,20 +424,20 @@ sal_Bool GDIMetaFile::operator==( const GDIMetaFile& rMtf ) const sal_Bool GDIMetaFile::IsEqual( const GDIMetaFile& rMtf ) const { - const sal_uLong nObjCount = Count(); + const size_t nObjCount = aList.size(); sal_Bool bRet = sal_False; if( this == &rMtf ) bRet = sal_True; - else if( rMtf.GetActionCount() == nObjCount && - rMtf.GetPrefSize() == aPrefSize && + else if( rMtf.GetActionSize() == nObjCount && + rMtf.GetPrefSize() == aPrefSize && rMtf.GetPrefMapMode() == aPrefMapMode ) { bRet = sal_True; - for( sal_uLong n = 0UL; n < nObjCount; n++ ) + for( size_t n = 0; n < nObjCount; n++ ) { - if(!((MetaAction*)GetObject( n ))->IsEqual(*((MetaAction*)rMtf.GetObject( n )))) + if( !aList[ n ]->IsEqual( *(rMtf.GetAction( n )) ) ) { bRet = sal_False; break; @@ -345,10 +455,9 @@ void GDIMetaFile::Clear() if( bRecord ) Stop(); - for( void* pAct = First(); pAct; pAct = Next() ) - ( (MetaAction*) pAct )->Delete(); - - List::Clear(); + for( size_t i = 0, n = aList.size(); i < n; ++i ) + aList[ i ]->Delete(); + aList.clear(); delete pLabelList; pLabelList = NULL; @@ -403,7 +512,7 @@ void GDIMetaFile::Record( OutputDevice* pOut ) if( bRecord ) Stop(); - Last(); + nCurrentActionElement = aList.empty() ? 0 : (aList.size() - 1); pOutDev = pOut; bRecord = sal_True; Linker( pOut, sal_True ); @@ -411,17 +520,19 @@ void GDIMetaFile::Record( OutputDevice* pOut ) // ------------------------------------------------------------------------ -void GDIMetaFile::Play( GDIMetaFile& rMtf, sal_uLong nPos ) +void GDIMetaFile::Play( GDIMetaFile& rMtf, size_t nPos ) { if ( !bRecord && !rMtf.bRecord ) { MetaAction* pAction = GetCurAction(); - const sal_uLong nObjCount = Count(); + const size_t nObjCount = aList.size(); + + rMtf.UseCanvas( rMtf.GetUseCanvas() || bUseCanvas ); if( nPos > nObjCount ) nPos = nObjCount; - for( sal_uLong nCurPos = GetCurPos(); nCurPos < nPos; nCurPos++ ) + for( size_t nCurPos = nCurrentActionElement; nCurPos < nPos; nCurPos++ ) { if( !Hook() ) { @@ -429,20 +540,21 @@ void GDIMetaFile::Play( GDIMetaFile& rMtf, sal_uLong nPos ) rMtf.AddAction( pAction ); } - pAction = (MetaAction*) Next(); + pAction = NextAction(); } } } // ------------------------------------------------------------------------ -void GDIMetaFile::Play( OutputDevice* pOut, sal_uLong nPos ) +void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos ) { if( !bRecord ) { MetaAction* pAction = GetCurAction(); - const sal_uLong nObjCount = Count(); - sal_uLong i = 0, nSyncCount = ( pOut->GetOutDevType() == OUTDEV_WINDOW ) ? 0x000000ff : 0xffffffff; + const size_t nObjCount = aList.size(); + size_t i = 0; + size_t nSyncCount = ( pOut->GetOutDevType() == OUTDEV_WINDOW ) ? 0x000000ff : 0xffffffff; if( nPos > nObjCount ) nPos = nObjCount; @@ -455,18 +567,27 @@ void GDIMetaFile::Play( OutputDevice* pOut, sal_uLong nPos ) pOut->SetLayoutMode( 0 ); pOut->SetDigitLanguage( 0 ); - for( sal_uLong nCurPos = GetCurPos(); nCurPos < nPos; nCurPos++ ) + for( size_t nCurPos = nCurrentActionElement; nCurPos < nPos; nCurPos++ ) { if( !Hook() ) { - pAction->Execute( pOut ); + MetaCommentAction* pCommentAct = static_cast<MetaCommentAction*>(pAction); + if( pAction->GetType() == META_COMMENT_ACTION && + pCommentAct->GetComment().Equals("DELEGATE_PLUGGABLE_RENDERER") ) + { + ImplDelegate2PluggableRenderer(pCommentAct, pOut); + } + else + { + pAction->Execute( pOut ); + } // flush output from time to time if( i++ > nSyncCount ) ( (Window*) pOut )->Flush(), i = 0; } - pAction = (MetaAction*) Next(); + pAction = NextAction(); } pOut->Pop(); @@ -475,8 +596,156 @@ void GDIMetaFile::Play( OutputDevice* pOut, sal_uLong nPos ) // ------------------------------------------------------------------------ +bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize ) +{ + const Window* win = dynamic_cast <Window*> ( pOut ); + + if (!win) + win = Application::GetActiveTopWindow(); + if (!win) + win = Application::GetFirstTopLevelWindow(); + + if (!win) + return false; + + try { + const uno::Reference<rendering::XCanvas>& xCanvas = win->GetCanvas (); + Size aSize (rDestSize.Width () + 1, rDestSize.Height () + 1); + const uno::Reference<rendering::XBitmap>& xBitmap = xCanvas->getDevice ()->createCompatibleAlphaBitmap (vcl::unotools::integerSize2DFromSize( aSize)); + uno::Reference< lang::XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); + if( xFactory.is() && xBitmap.is () ) { + uno::Reference< rendering::XMtfRenderer > xMtfRenderer; + uno::Sequence< uno::Any > args (1); + uno::Reference< rendering::XBitmapCanvas > xBitmapCanvas( xBitmap, uno::UNO_QUERY ); + if( xBitmapCanvas.is() ) { + args[0] = uno::Any( xBitmapCanvas ); + xMtfRenderer.set( xFactory->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.rendering.MtfRenderer")), + args ), uno::UNO_QUERY ); + + if( xMtfRenderer.is() ) { + xBitmapCanvas->clear(); + uno::Reference< beans::XFastPropertySet > xMtfFastPropertySet( xMtfRenderer, uno::UNO_QUERY ); + if( xMtfFastPropertySet.is() ) + // set this metafile to the renderer to + // speedup things (instead of copying data to + // sequence of bytes passed to renderer) + xMtfFastPropertySet->setFastPropertyValue( 0, uno::Any( reinterpret_cast<sal_Int64>( this ) ) ); + + xMtfRenderer->draw( rDestSize.Width(), rDestSize.Height() ); + + uno::Reference< beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, uno::UNO_QUERY ); + if( xFastPropertySet.get() ) { + // 0 means get BitmapEx + uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 ); + BitmapEx* pBitmapEx = (BitmapEx*) *reinterpret_cast<const sal_Int64*>(aAny.getValue()); + if( pBitmapEx ) { + pOut->DrawBitmapEx( rPos, *pBitmapEx ); + delete pBitmapEx; + return true; + } + } + + SalBitmap* pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap(); + SalBitmap* pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap(); + + if( pSalBmp->Create( xBitmapCanvas, aSize ) && pSalMask->Create( xBitmapCanvas, aSize, true ) ) { + Bitmap aBitmap( pSalBmp ); + Bitmap aMask( pSalMask ); + AlphaMask aAlphaMask( aMask ); + BitmapEx aBitmapEx( aBitmap, aAlphaMask ); + pOut->DrawBitmapEx( rPos, aBitmapEx ); + return true; + } + + delete pSalBmp; + delete pSalMask; + } + } + } + } catch( uno::RuntimeException& ) { + throw; // runtime errors are fatal + } catch( uno::Exception& ) { + // ignore errors, no way of reporting them here + } + + return false; +} + +// ------------------------------------------------------------------------ + +void GDIMetaFile::ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, OutputDevice* pOut ) +{ + OSL_ASSERT( pAct->GetComment().Equals("DELEGATE_PLUGGABLE_RENDERER") ); + + // read payload - string of service name, followed by raw render input + const sal_uInt8* pData = pAct->GetData(); + const sal_uInt8* const pEndData = pData + pAct->GetDataSize(); + if( !pData ) + return; + + ::rtl::OUStringBuffer aBuffer; + while( pData<pEndData && *pData ) + aBuffer.append(static_cast<sal_Unicode>(*pData++)); + const ::rtl::OUString aRendererServiceName=aBuffer.makeStringAndClear(); + ++pData; + + while( pData<pEndData && *pData ) + aBuffer.append(static_cast<sal_Unicode>(*pData++)); + const ::rtl::OUString aGraphicServiceName=aBuffer.makeStringAndClear(); + ++pData; + + uno::Reference< lang::XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); + if( pData<pEndData && xFactory.is() ) + { + try + { + // instantiate render service + uno::Sequence<uno::Any> aRendererArgs(1); + aRendererArgs[0] = makeAny(uno::Reference<awt::XGraphics>(pOut->CreateUnoGraphics())); + uno::Reference<graphic::XGraphicRenderer> xRenderer( + xFactory->createInstanceWithArguments( + aRendererServiceName, + aRendererArgs), + uno::UNO_QUERY ); + + // instantiate graphic service + uno::Reference<graphic::XGraphic> xGraphic( + xFactory->createInstance( + aGraphicServiceName), + uno::UNO_QUERY ); + + uno::Reference<lang::XInitialization> xInit( + xGraphic, uno::UNO_QUERY); + + if(xGraphic.is() && xRenderer.is() && xInit.is()) + { + // delay intialization of XGraphic, to only expose + // XGraphic-generating services to arbitrary binary data + uno::Sequence< sal_Int8 > aSeq( + (sal_Int8*)&pData, pEndData-pData ); + uno::Sequence<uno::Any> aGraphicsArgs(1); + aGraphicsArgs[0] = makeAny(aSeq); + xInit->initialize(aGraphicsArgs); + + xRenderer->render(xGraphic); + } + } + catch( uno::RuntimeException& ) + { + // runtime errors are fatal + throw; + } + catch( uno::Exception& ) + { + // ignore errors, no way of reporting them here + } + } +} + +// ------------------------------------------------------------------------ + void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos, - const Size& rSize, sal_uLong nPos ) + const Size& rSize, size_t nPos ) { Region aDrawClipRegion; MapMode aDrawMap( GetPrefMapMode() ); @@ -484,9 +753,13 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos, if( aDestSize.Width() && aDestSize.Height() ) { - Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) ); GDIMetaFile* pMtf = pOut->GetConnectMetaFile(); + if( bUseCanvas && !pMtf && ImplPlayWithRenderer( pOut, rPos, aDestSize ) ) + return; + + Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) ); + if( !aTmpPrefSize.Width() ) aTmpPrefSize.Width() = aDestSize.Width(); @@ -576,7 +849,7 @@ void GDIMetaFile::Stop() void GDIMetaFile::WindStart() { if( !bRecord ) - First(); + nCurrentActionElement = 0; } // ------------------------------------------------------------------------ @@ -584,15 +857,15 @@ void GDIMetaFile::WindStart() void GDIMetaFile::WindEnd() { if( !bRecord ) - Last(); + nCurrentActionElement = aList.empty() ? 0 : (aList.size() - 1); } // ------------------------------------------------------------------------ -void GDIMetaFile::Wind( sal_uLong nActionPos ) +void GDIMetaFile::Wind( size_t nActionPos ) { if( !bRecord ) - Seek( nActionPos ); + nCurrentActionElement = nActionPos < aList.size() ? nActionPos : nCurrentActionElement; } // ------------------------------------------------------------------------ @@ -600,7 +873,8 @@ void GDIMetaFile::Wind( sal_uLong nActionPos ) void GDIMetaFile::WindPrev() { if( !bRecord ) - Prev(); + if ( nCurrentActionElement > 0 ) + --nCurrentActionElement; } // ------------------------------------------------------------------------ @@ -608,14 +882,15 @@ void GDIMetaFile::WindPrev() void GDIMetaFile::WindNext() { if( !bRecord ) - Next(); + if ( nCurrentActionElement + 1 < aList.size() ) + ++nCurrentActionElement; } // ------------------------------------------------------------------------ void GDIMetaFile::AddAction( MetaAction* pAction ) { - Insert( pAction, LIST_APPEND ); + aList.push_back( pAction ); if( pPrev ) { @@ -626,9 +901,18 @@ void GDIMetaFile::AddAction( MetaAction* pAction ) // ------------------------------------------------------------------------ -void GDIMetaFile::AddAction( MetaAction* pAction, sal_uLong nPos ) +void GDIMetaFile::AddAction( MetaAction* pAction, size_t nPos ) { - Insert( pAction, nPos ); + if ( nPos < aList.size() ) + { + ::std::vector< MetaAction* >::iterator it = aList.begin(); + ::std::advance( it, nPos ); + aList.insert( it, pAction ); + } + else + { + aList.push_back( pAction ); + } if( pPrev ) { @@ -639,10 +923,24 @@ void GDIMetaFile::AddAction( MetaAction* pAction, sal_uLong nPos ) // ------------------------------------------------------------------------ +void GDIMetaFile::push_back( MetaAction* pAction ) +{ + aList.push_back( pAction ); +} + +// ------------------------------------------------------------------------ + // @since #110496# -void GDIMetaFile::RemoveAction( sal_uLong nPos ) +void GDIMetaFile::RemoveAction( size_t nPos ) { - Remove( nPos ); + if ( nPos < aList.size() ) + { + ::std::vector< MetaAction* >::iterator it = aList.begin(); + ::std::advance( it, nPos ); + (*it)->Delete(); + aList.erase( it ); + + } if( pPrev ) pPrev->RemoveAction( nPos ); @@ -650,14 +948,14 @@ void GDIMetaFile::RemoveAction( sal_uLong nPos ) // ------------------------------------------------------------------------ -MetaAction* GDIMetaFile::CopyAction( sal_uLong nPos ) const +MetaAction* GDIMetaFile::CopyAction( size_t nPos ) const { - return ( (MetaAction*) GetObject( nPos ) )->Clone(); + return ( nPos < aList.size() ) ? aList[ nPos ]->Clone() : NULL; } // ------------------------------------------------------------------------ -sal_uLong GDIMetaFile::GetActionPos( const String& rLabel ) +size_t GDIMetaFile::GetActionPos( const String& rLabel ) { ImpLabel* pLabel = NULL; @@ -671,7 +969,7 @@ sal_uLong GDIMetaFile::GetActionPos( const String& rLabel ) // ------------------------------------------------------------------------ -sal_Bool GDIMetaFile::InsertLabel( const String& rLabel, sal_uLong nActionPos ) +sal_Bool GDIMetaFile::InsertLabel( const String& rLabel, size_t nActionPos ) { sal_Bool bRet = sal_False; @@ -715,14 +1013,14 @@ void GDIMetaFile::RenameLabel( const String& rLabel, const String& rNewLabel ) // ------------------------------------------------------------------------ -sal_uLong GDIMetaFile::GetLabelCount() const +size_t GDIMetaFile::GetLabelCount() const { return( pLabelList ? pLabelList->ImplCount() : 0UL ); } // ------------------------------------------------------------------------ -String GDIMetaFile::GetLabel( sal_uLong nLabel ) +String GDIMetaFile::GetLabel( size_t nLabel ) { String aString; @@ -783,12 +1081,12 @@ sal_Bool GDIMetaFile::Mirror( sal_uLong nMirrorFlags ) sal_Bool bRet; if( nMirrorFlags & MTF_MIRROR_HORZ ) - nMoveX = VOS_ABS( aOldPrefSize.Width() ) - 1, fScaleX = -1.0; + nMoveX = SAL_ABS( aOldPrefSize.Width() ) - 1, fScaleX = -1.0; else nMoveX = 0, fScaleX = 1.0; if( nMirrorFlags & MTF_MIRROR_VERT ) - nMoveY = VOS_ABS( aOldPrefSize.Height() ) - 1, fScaleY = -1.0; + nMoveY = SAL_ABS( aOldPrefSize.Height() ) - 1, fScaleY = -1.0; else nMoveY = 0, fScaleY = 1.0; @@ -816,14 +1114,14 @@ void GDIMetaFile::Move( long nX, long nY ) aMapVDev.EnableOutput( sal_False ); aMapVDev.SetMapMode( GetPrefMapMode() ); - for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { const long nType = pAct->GetType(); MetaAction* pModAct; if( pAct->GetRefCount() > 1 ) { - Replace( pModAct = pAct->Clone(), GetCurPos() ); + aList[ nCurrentActionElement ] = pModAct = pAct->Clone(); pAct->Delete(); } else @@ -851,14 +1149,14 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY ) aMapVDev.SetReferenceDevice( nDPIX, nDPIY ); aMapVDev.SetMapMode( GetPrefMapMode() ); - for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { const long nType = pAct->GetType(); MetaAction* pModAct; if( pAct->GetRefCount() > 1 ) { - Replace( pModAct = pAct->Clone(), GetCurPos() ); + aList[ nCurrentActionElement ] = pModAct = pAct->Clone(); pAct->Delete(); } else @@ -888,13 +1186,13 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY ) void GDIMetaFile::Scale( double fScaleX, double fScaleY ) { - for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { MetaAction* pModAct; if( pAct->GetRefCount() > 1 ) { - Replace( pModAct = pAct->Clone(), GetCurPos() ); + aList[ nCurrentActionElement ] = pModAct = pAct->Clone(); pAct->Delete(); } else @@ -924,7 +1222,7 @@ void GDIMetaFile::Clip( const Rectangle& i_rClipRect ) aMapVDev.EnableOutput( sal_False ); aMapVDev.SetMapMode( GetPrefMapMode() ); - for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { const long nType = pAct->GetType(); @@ -942,7 +1240,7 @@ void GDIMetaFile::Clip( const Rectangle& i_rClipRect ) if( pOldAct->IsClipping() ) aNewReg.Intersect( pOldAct->GetRegion() ); MetaClipRegionAction* pNewAct = new MetaClipRegionAction( aNewReg, sal_True ); - Replace( pNewAct, GetCurPos() ); + aList[ nCurrentActionElement ] = pNewAct; pOldAct->Delete(); } } @@ -1003,10 +1301,10 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile& rMtf, aVDev.DrawGradient( rPolyPoly, rGrad ); aGradMtf.Stop(); - int i, nAct( aGradMtf.GetActionCount() ); - for( i=0; i<nAct; ++i ) + size_t i, nAct( aGradMtf.GetActionSize() ); + for( i=0; i < nAct; ++i ) { - MetaAction* pMetaAct = aGradMtf.GetAction(i); + MetaAction* pMetaAct = aGradMtf.GetAction( i ); pMetaAct->Duplicate(); rMtf.AddAction( pMetaAct ); } @@ -1042,7 +1340,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) Point aRotAnchor( aOrigin ); Size aRotOffset( aOffset ); - for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() ) + for( MetaAction* pAction = FirstAction(); pAction; pAction = NextAction() ) { const sal_uInt16 nActionType = pAction->GetType(); @@ -1256,7 +1554,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) if( pCommentAct->GetComment().Equals( "XGRAD_SEQ_BEGIN" ) ) { int nBeginComments( 1 ); - pAction = (MetaAction*) Next(); + pAction = NextAction(); // skip everything, except gradientex action while( pAction ) @@ -1291,7 +1589,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) } - pAction = (MetaAction*) Next(); + pAction =NextAction(); } } else @@ -1445,7 +1743,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) case( META_TEXTRECT_ACTION ): case( META_MOVECLIPREGION_ACTION ): { - DBG_ERROR( "GDIMetaFile::Rotate(): unsupported action" ); + OSL_FAIL( "GDIMetaFile::Rotate(): unsupported action" ); } break; @@ -1515,7 +1813,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference ) Rectangle aBound; - for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() ) + for( MetaAction* pAction = FirstAction(); pAction; pAction = NextAction() ) { const sal_uInt16 nActionType = pAction->GetType(); @@ -2042,7 +2340,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol aMtf.aPrefSize = aPrefSize; aMtf.aPrefMapMode = aPrefMapMode; - for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() ) + for( MetaAction* pAction = FirstAction(); pAction; pAction = NextAction() ) { const sal_uInt16 nType = pAction->GetType(); @@ -2051,7 +2349,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol case( META_PIXEL_ACTION ): { MetaPixelAction* pAct = (MetaPixelAction*) pAction; - aMtf.Insert( new MetaPixelAction( pAct->GetPoint(), pFncCol( pAct->GetColor(), pColParam ) ), LIST_APPEND ); + aMtf.push_back( new MetaPixelAction( pAct->GetPoint(), pFncCol( pAct->GetColor(), pColParam ) ) ); } break; @@ -2064,7 +2362,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol else pAct = new MetaLineColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); - aMtf.Insert( pAct, LIST_APPEND ); + aMtf.push_back( pAct ); } break; @@ -2077,14 +2375,14 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol else pAct = new MetaFillColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); - aMtf.Insert( pAct, LIST_APPEND ); + aMtf.push_back( pAct ); } break; case( META_TEXTCOLOR_ACTION ): { MetaTextColorAction* pAct = (MetaTextColorAction*) pAction; - aMtf.Insert( new MetaTextColorAction( pFncCol( pAct->GetColor(), pColParam ) ), LIST_APPEND ); + aMtf.push_back( new MetaTextColorAction( pFncCol( pAct->GetColor(), pColParam ) ) ); } break; @@ -2097,7 +2395,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol else pAct = new MetaTextFillColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); - aMtf.Insert( pAct, LIST_APPEND ); + aMtf.push_back( pAct ); } break; @@ -2110,7 +2408,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol else pAct = new MetaTextLineColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); - aMtf.Insert( pAct, LIST_APPEND ); + aMtf.push_back( pAct ); } break; @@ -2123,7 +2421,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol else pAct = new MetaOverlineColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); - aMtf.Insert( pAct, LIST_APPEND ); + aMtf.push_back( pAct ); } break; @@ -2134,7 +2432,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol aFont.SetColor( pFncCol( aFont.GetColor(), pColParam ) ); aFont.SetFillColor( pFncCol( aFont.GetFillColor(), pColParam ) ); - aMtf.Insert( new MetaFontAction( aFont ), LIST_APPEND ); + aMtf.push_back( new MetaFontAction( aFont ) ); } break; @@ -2158,7 +2456,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol aWall.SetGradient( aGradient ); } - aMtf.Insert( new MetaWallpaperAction( rRect, aWall ), LIST_APPEND ); + aMtf.push_back( new MetaWallpaperAction( rRect, aWall ) ); } break; @@ -2166,66 +2464,65 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol case( META_BMPEX_ACTION ): case( META_MASK_ACTION ): { - DBG_ERROR( "Don't use bitmap actions of this type in metafiles!" ); + OSL_FAIL( "Don't use bitmap actions of this type in metafiles!" ); } break; case( META_BMPSCALE_ACTION ): { MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction; - aMtf.Insert( new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(), - pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() ), - LIST_APPEND ); + aMtf.push_back( new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(), + pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() ) ); } break; case( META_BMPSCALEPART_ACTION ): { MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction; - aMtf.Insert( new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), - pAct->GetSrcPoint(), pAct->GetSrcSize(), - pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() ), - LIST_APPEND ); + aMtf.push_back( new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), + pAct->GetSrcPoint(), pAct->GetSrcSize(), + pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() ) + ); } break; case( META_BMPEXSCALE_ACTION ): { MetaBmpExScaleAction* pAct = (MetaBmpExScaleAction*) pAction; - aMtf.Insert( new MetaBmpExScaleAction( pAct->GetPoint(), pAct->GetSize(), - pFncBmp( pAct->GetBitmapEx(), pBmpParam ) ), - LIST_APPEND ); + aMtf.push_back( new MetaBmpExScaleAction( pAct->GetPoint(), pAct->GetSize(), + pFncBmp( pAct->GetBitmapEx(), pBmpParam ) ) + ); } break; case( META_BMPEXSCALEPART_ACTION ): { MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction; - aMtf.Insert( new MetaBmpExScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), - pAct->GetSrcPoint(), pAct->GetSrcSize(), - pFncBmp( pAct->GetBitmapEx(), pBmpParam ) ), - LIST_APPEND ); + aMtf.push_back( new MetaBmpExScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), + pAct->GetSrcPoint(), pAct->GetSrcSize(), + pFncBmp( pAct->GetBitmapEx(), pBmpParam ) ) + ); } break; case( META_MASKSCALE_ACTION ): { MetaMaskScaleAction* pAct = (MetaMaskScaleAction*) pAction; - aMtf.Insert( new MetaMaskScaleAction( pAct->GetPoint(), pAct->GetSize(), - pAct->GetBitmap(), - pFncCol( pAct->GetColor(), pColParam ) ), - LIST_APPEND ); + aMtf.push_back( new MetaMaskScaleAction( pAct->GetPoint(), pAct->GetSize(), + pAct->GetBitmap(), + pFncCol( pAct->GetColor(), pColParam ) ) + ); } break; case( META_MASKSCALEPART_ACTION ): { MetaMaskScalePartAction* pAct = (MetaMaskScalePartAction*) pAction; - aMtf.Insert( new MetaMaskScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), - pAct->GetSrcPoint(), pAct->GetSrcSize(), - pAct->GetBitmap(), - pFncCol( pAct->GetColor(), pColParam ) ), - LIST_APPEND ); + aMtf.push_back( new MetaMaskScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), + pAct->GetSrcPoint(), pAct->GetSrcSize(), + pAct->GetBitmap(), + pFncCol( pAct->GetColor(), pColParam ) ) + ); } break; @@ -2236,7 +2533,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol aGradient.SetStartColor( pFncCol( aGradient.GetStartColor(), pColParam ) ); aGradient.SetEndColor( pFncCol( aGradient.GetEndColor(), pColParam ) ); - aMtf.Insert( new MetaGradientAction( pAct->GetRect(), aGradient ), LIST_APPEND ); + aMtf.push_back( new MetaGradientAction( pAct->GetRect(), aGradient ) ); } break; @@ -2247,7 +2544,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol aGradient.SetStartColor( pFncCol( aGradient.GetStartColor(), pColParam ) ); aGradient.SetEndColor( pFncCol( aGradient.GetEndColor(), pColParam ) ); - aMtf.Insert( new MetaGradientExAction( pAct->GetPolyPolygon(), aGradient ), LIST_APPEND ); + aMtf.push_back( new MetaGradientExAction( pAct->GetPolyPolygon(), aGradient ) ); } break; @@ -2257,7 +2554,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol Hatch aHatch( pAct->GetHatch() ); aHatch.SetColor( pFncCol( aHatch.GetColor(), pColParam ) ); - aMtf.Insert( new MetaHatchAction( pAct->GetPolyPolygon(), aHatch ), LIST_APPEND ); + aMtf.push_back( new MetaHatchAction( pAct->GetPolyPolygon(), aHatch ) ); } break; @@ -2267,10 +2564,10 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol GDIMetaFile aTransMtf( pAct->GetGDIMetaFile() ); aTransMtf.ImplExchangeColors( pFncCol, pColParam, pFncBmp, pBmpParam ); - aMtf.Insert( new MetaFloatTransparentAction( aTransMtf, - pAct->GetPoint(), pAct->GetSize(), - pAct->GetGradient() ), - LIST_APPEND ); + aMtf.push_back( new MetaFloatTransparentAction( aTransMtf, + pAct->GetPoint(), pAct->GetSize(), + pAct->GetGradient() ) + ); } break; @@ -2280,9 +2577,9 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol GDIMetaFile aSubst( pAct->GetSubstitute() ); aSubst.ImplExchangeColors( pFncCol, pColParam, pFncBmp, pBmpParam ); - aMtf.Insert( new MetaEPSAction( pAct->GetPoint(), pAct->GetSize(), - pAct->GetLink(), aSubst ), - LIST_APPEND ); + aMtf.push_back( new MetaEPSAction( pAct->GetPoint(), pAct->GetSize(), + pAct->GetLink(), aSubst ) + ); } break; @@ -2291,14 +2588,14 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol OSL_TRACE( "ExchangeColors not supported for RenderGraphic MetaActions yet" ); pAction->Duplicate(); - aMtf.Insert( pAction, LIST_APPEND ); + aMtf.push_back( pAction ); } break; default: { pAction->Duplicate(); - aMtf.Insert( pAction, LIST_APPEND ); + aMtf.push_back( pAction ); } break; } @@ -2486,8 +2783,7 @@ sal_uLong GDIMetaFile::GetChecksum() const sal_uLong nCrc = 0; aWriteData.meActualCharSet = aMemStm.GetStreamCharSet(); - - for( sal_uLong i = 0, nObjCount = GetActionCount(); i < nObjCount; i++ ) + for( size_t i = 0, nObjCount = GetActionSize(); i < nObjCount; i++ ) { MetaAction* pAction = GetAction( i ); @@ -2786,7 +3082,7 @@ sal_uLong GDIMetaFile::GetSizeBytes() const { sal_uLong nSizeBytes = 0; - for( sal_uLong i = 0, nObjCount = GetActionCount(); i < nObjCount; ++i ) + for( size_t i = 0, nObjCount = GetActionSize(); i < nObjCount; ++i ) { MetaAction* pAction = GetAction( i ); @@ -3026,7 +3322,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm, GDIMetaFileWriteFlags nWriteFlags // additional RenderGraphic replacement actions, if the // GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC is set // and META_RENDERGRAPHIC_ACTION are encountered (KA 01/2011) - for( MetaAction* pAct = static_cast< MetaAction* >( First() ); pAct; pAct = static_cast< MetaAction* >( Next() ) ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { nActionCount += ( bRenderGraphicReplacements && ( META_RENDERGRAPHIC_ACTION == pAct->GetType() ) ? 2 : 1 ); } @@ -3051,7 +3347,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm, GDIMetaFileWriteFlags nWriteFlags aWriteData.meActualCharSet = rOStm.GetStreamCharSet(); aWriteData.mnWriteFlags = nWriteFlags; - for( MetaAction* pAct = static_cast< MetaAction* >( First() ); pAct; pAct = static_cast< MetaAction* >( Next() ) ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { pAct->Write( rOStm, &aWriteData ); @@ -3193,3 +3489,53 @@ sal_Bool GDIMetaFile::CreateThumbnail( sal_uInt32 nMaximumExtent, return !rBmpEx.IsEmpty(); } + +void GDIMetaFile::UseCanvas( sal_Bool _bUseCanvas ) +{ + bUseCanvas = _bUseCanvas; +} + +// ------------------------------------------------------------------------ + +MetaCommentAction* makePluggableRendererAction( const rtl::OUString& rRendererServiceName, + const rtl::OUString& rGraphicServiceName, + const void* _pData, + sal_uInt32 nDataSize ) +{ + const sal_uInt8* pData=(sal_uInt8*)_pData; + + // data gets copied twice, unfortunately + rtl::OString aRendererServiceName( + rRendererServiceName.getStr(), + rRendererServiceName.getLength(), + RTL_TEXTENCODING_ASCII_US); + rtl::OString aGraphicServiceName( + rGraphicServiceName.getStr(), + rGraphicServiceName.getLength(), + RTL_TEXTENCODING_ASCII_US); + + std::vector<sal_uInt8> aMem( + aRendererServiceName.getLength()+ + aGraphicServiceName.getLength()+2+nDataSize); + sal_uInt8* pMem=&aMem[0]; + + std::copy(aRendererServiceName.getStr(), + aRendererServiceName.getStr()+aRendererServiceName.getLength()+1, + pMem); + pMem+=aRendererServiceName.getLength()+1; + std::copy(aGraphicServiceName.getStr(), + aGraphicServiceName.getStr()+aGraphicServiceName.getLength()+1, + pMem); + pMem+=aGraphicServiceName.getLength()+1; + + std::copy(pData,pData+nDataSize, + pMem); + + return new MetaCommentAction( + "DELEGATE_PLUGGABLE_RENDERER", + 0, + &aMem[0], + aMem.size()); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx index c9c997b568e2..745c4f765398 100644 --- a/vcl/source/gdi/gfxlink.cxx +++ b/vcl/source/gdi/gfxlink.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -468,3 +469,5 @@ void ImpSwap::WriteTo( SvStream& rOStm ) const delete[] pData; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx index 9f4f91c38e60..38d8ba4567a2 100644 --- a/vcl/source/gdi/gradient.cxx +++ b/vcl/source/gdi/gradient.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -244,6 +245,99 @@ void Gradient::SetSteps( sal_uInt16 nSteps ) // ----------------------------------------------------------------------- +void Gradient::GetBoundRect( const Rectangle& rRect, Rectangle& rBoundRect, Point& rCenter ) const +{ + Rectangle aRect( rRect ); + sal_uInt16 nAngle = GetAngle() % 3600; + + if( GetStyle() == GRADIENT_LINEAR || GetStyle() == GRADIENT_AXIAL ) + { + aRect.Left()--; + aRect.Top()--; + aRect.Right()++; + aRect.Bottom()++; + + const double fAngle = nAngle * F_PI1800; + const double fWidth = aRect.GetWidth(); + const double fHeight = aRect.GetHeight(); + double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) ); + double fDY = fHeight * fabs( cos( fAngle ) ) + fWidth * fabs( sin( fAngle ) ); + + fDX = ( fDX - fWidth ) * 0.5 + 0.5; + fDY = ( fDY - fHeight ) * 0.5 + 0.5; + + aRect.Left() -= (long) fDX; + aRect.Right() += (long) fDX; + aRect.Top() -= (long) fDY; + aRect.Bottom() += (long) fDY; + + rBoundRect = aRect; + rCenter = rRect.Center(); + } + else + { + + if( GetStyle() == GRADIENT_SQUARE || GetStyle() == GRADIENT_RECT ) + { + const double fAngle = nAngle * F_PI1800; + const double fWidth = aRect.GetWidth(); + const double fHeight = aRect.GetHeight(); + double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) ); + double fDY = fHeight * fabs( cos( fAngle ) ) + fWidth * fabs( sin( fAngle ) ); + + fDX = ( fDX - fWidth ) * 0.5 + 0.5; + fDY = ( fDY - fHeight ) * 0.5 + 0.5; + + aRect.Left() -= (long) fDX; + aRect.Right() += (long) fDX; + aRect.Top() -= (long) fDY; + aRect.Bottom() += (long) fDY; + } + + Size aSize( aRect.GetSize() ); + + if( GetStyle() == GRADIENT_RADIAL ) + { + // Radien-Berechnung fuer Kreis + aSize.Width() = (long)(0.5 + sqrt((double)aSize.Width()*(double)aSize.Width() + (double)aSize.Height()*(double)aSize.Height())); + aSize.Height() = aSize.Width(); + } + else if( GetStyle() == GRADIENT_ELLIPTICAL ) + { + // Radien-Berechnung fuer Ellipse + aSize.Width() = (long)( 0.5 + (double) aSize.Width() * 1.4142 ); + aSize.Height() = (long)( 0.5 + (double) aSize.Height() * 1.4142 ); + } + else if( GetStyle() == GRADIENT_SQUARE ) + { + if ( aSize.Width() > aSize.Height() ) + aSize.Height() = aSize.Width(); + else + aSize.Width() = aSize.Height(); + } + + // neue Mittelpunkte berechnen + long nZWidth = aRect.GetWidth() * (long) GetOfsX() / 100; + long nZHeight = aRect.GetHeight() * (long) GetOfsY() / 100; + long nBorderX = (long) GetBorder() * aSize.Width() / 100; + long nBorderY = (long) GetBorder() * aSize.Height() / 100; + rCenter = Point( aRect.Left() + nZWidth, aRect.Top() + nZHeight ); + + // Rand beruecksichtigen + aSize.Width() -= nBorderX; + aSize.Height() -= nBorderY; + + // Ausgaberechteck neu setzen + aRect.Left() = rCenter.X() - ( aSize.Width() >> 1 ); + aRect.Top() = rCenter.Y() - ( aSize.Height() >> 1 ); + + aRect.SetSize( aSize ); + rBoundRect = rRect; + } +} + +// ----------------------------------------------------------------------- + Gradient& Gradient::operator=( const Gradient& rGradient ) { DBG_CHKTHIS( Gradient, NULL ); @@ -342,3 +436,5 @@ SvStream& operator<<( SvStream& rOStm, const Gradient& rGradient ) { return( rOStm << *rGradient.mpImplGradient ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 65555a441a1a..eb22d31937df 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -844,3 +845,5 @@ SvStream& operator<<( SvStream& rOStream, const Graphic& rGraphic ) { return rOStream << *rGraphic.mpImpGraphic; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/graphictools.cxx b/vcl/source/gdi/graphictools.cxx index 5ef9ed038163..2e20a3639790 100644 --- a/vcl/source/gdi/graphictools.cxx +++ b/vcl/source/gdi/graphictools.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,7 +52,7 @@ static ::rtl::OString polyToString( const Polygon& rPoly ) break; default: - DBG_ERROR( "SvtGraphicStroke::polyToString invalid flag"); + OSL_FAIL( "SvtGraphicStroke::polyToString invalid flag"); break; } aStr += ::rtl::OString::valueOf( static_cast< double >( rPoly[nVertex].getX() ) ); @@ -226,7 +227,7 @@ void SvtGraphicStroke::getDashArray( DashArray& rDashArray ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing cap type"); + OSL_FAIL( "SvtGraphicStroke::toString missing cap type"); break; } aStr += " join: "; @@ -249,7 +250,7 @@ void SvtGraphicStroke::getDashArray( DashArray& rDashArray ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing join type"); + OSL_FAIL( "SvtGraphicStroke::toString missing join type"); break; } aStr += " "; @@ -514,7 +515,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const break; default: - DBG_ERROR( "SvtGraphicFill::toString missing fill rule"); + OSL_FAIL( "SvtGraphicFill::toString missing fill rule"); break; } aStr += " type: "; @@ -537,7 +538,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing fill type"); + OSL_FAIL( "SvtGraphicStroke::toString missing fill type"); break; } @@ -563,7 +564,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing hatch type"); + OSL_FAIL( "SvtGraphicStroke::toString missing hatch type"); break; } @@ -586,7 +587,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing gradient type"); + OSL_FAIL( "SvtGraphicStroke::toString missing gradient type"); break; } @@ -617,7 +618,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const break; default: - DBG_ERROR( "SvtGraphicStroke::toString missing graphic type"); + OSL_FAIL( "SvtGraphicStroke::toString missing graphic type"); break; } @@ -757,3 +758,5 @@ SvStream& operator>>( SvStream& rIStm, SvtGraphicFill& rClass ) return rIStm; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/hatch.cxx b/vcl/source/gdi/hatch.cxx index b226c0f06936..9836b2e6e4b4 100644 --- a/vcl/source/gdi/hatch.cxx +++ b/vcl/source/gdi/hatch.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <tools/stream.hxx> #include <tools/vcompat.hxx> #include <tools/debug.hxx> -#ifndef _SV_HATCX_HXX #include <vcl/hatch.hxx> -#endif DBG_NAME( Hatch ) @@ -220,3 +219,5 @@ SvStream& operator<<( SvStream& rOStm, const Hatch& rHatch ) { return( rOStm << *rHatch.mpImplHatch ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index d33709787d2d..18f927e5b0ff 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,13 +38,12 @@ #include <tools/rc.h> #include <tools/rc.hxx> #include <tools/resmgr.hxx> - #include <vcl/settings.hxx> #include <vcl/outdev.hxx> #include <vcl/graph.hxx> #include <vcl/svapp.hxx> #include <vcl/image.hxx> - +#include <vcl/imagerepository.hxx> #include <impimagetree.hxx> #include <image.h> @@ -276,51 +276,6 @@ uno::Reference< graphic::XGraphic > Image::GetXGraphic() const // ----------------------------------------------------------------------- -Image Image::GetColorTransformedImage( ImageColorTransform eColorTransform ) const -{ - DBG_CHKTHIS( Image, NULL ); - - Image aRet; - - if( IMAGECOLORTRANSFORM_HIGHCONTRAST == eColorTransform ) - { - BitmapEx aBmpEx( GetBitmapEx() ); - - if( !aBmpEx.IsEmpty() ) - { - Color* pSrcColors = NULL; - Color* pDstColors = NULL; - sal_uLong nColorCount = 0; - - Image::GetColorTransformArrays( eColorTransform, pSrcColors, pDstColors, nColorCount ); - - if( nColorCount && pSrcColors && pDstColors ) - { - aBmpEx.Replace( pSrcColors, pDstColors, nColorCount ); - aRet = Image( aBmpEx ); - } - - delete[] pSrcColors; - delete[] pDstColors; - } - } - else if( IMAGECOLORTRANSFORM_MONOCHROME_BLACK == eColorTransform || - IMAGECOLORTRANSFORM_MONOCHROME_WHITE == eColorTransform ) - { - BitmapEx aBmpEx( GetBitmapEx() ); - - if( !aBmpEx.IsEmpty() ) - aRet = Image( aBmpEx.GetColorTransformedBitmapEx( ( BmpColorMode )( eColorTransform ) ) ); - } - - if( !aRet ) - aRet = *this; - - return aRet; -} - -// ----------------------------------------------------------------------- - void Image::Invert() { BitmapEx aInvertedBmp( GetBitmapEx() ); @@ -492,8 +447,6 @@ ImageList::ImageList( const ::std::vector< ::rtl::OUString >& rNameVector, mpImplData->maPrefix = rPrefix; for( sal_uInt32 i = 0; i < rNameVector.size(); ++i ) { -// fprintf (stderr, "List %p [%d]: '%s'\n", -// this, i, rtl::OUStringToOString( rNameVector[i], RTL_TEXTENCODING_UTF8 ).getStr() ); mpImplData->AddImage( rNameVector[ i ], static_cast< sal_uInt16 >( i ) + 1, BitmapEx() ); } } @@ -539,9 +492,6 @@ void ImageAryData::Load(const rtl::OUString &rPrefix) BitmapEx aBmpEx; -// fprintf (stderr, "Attempt load of '%s'\n", -// rtl::OUStringToOString( maName, RTL_TEXTENCODING_UTF8 ).getStr() ); - rtl::OUString aFileName = rPrefix; aFileName += maName; #if OSL_DEBUG_LEVEL > 0 @@ -555,7 +505,7 @@ void ImageAryData::Load(const rtl::OUString &rPrefix) aMessage.append( "ImageAryData::Load: failed to load image '" ); aMessage.append( ::rtl::OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ).getStr() ); aMessage.append( "'" ); - OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); + OSL_FAIL( aMessage.makeStringAndClear().getStr() ); } #endif } @@ -618,8 +568,6 @@ void ImageList::InsertFromHorizontalStrip( const BitmapEx &rBitmapEx, { sal_uInt16 nItems = sal::static_int_cast< sal_uInt16 >( rNameVector.size() ); -// fprintf (stderr, "InsertFromHorizontalStrip (1) [%d items]\n", nItems); - if (!nItems) return; @@ -791,15 +739,13 @@ Image ImageList::GetImage( sal_uInt16 nId ) const { DBG_CHKTHIS( ImageList, NULL ); -// fprintf (stderr, "GetImage %d\n", nId); - Image aRet; if( mpImplData ) { std::vector<ImageAryData *>::iterator aIter; for( aIter = mpImplData->maImages.begin(); - aIter != mpImplData->maImages.end(); aIter++) + aIter != mpImplData->maImages.end(); ++aIter) { if ((*aIter)->mnId == nId) { @@ -811,6 +757,14 @@ Image ImageList::GetImage( sal_uInt16 nId ) const } } + if (!aRet) + { + BitmapEx rBitmap; + bool res = ::vcl::ImageRepository::loadDefaultImage(rBitmap); + if (res) + aRet = Image(rBitmap); + } + return aRet; } @@ -818,9 +772,6 @@ Image ImageList::GetImage( sal_uInt16 nId ) const Image ImageList::GetImage( const ::rtl::OUString& rImageName ) const { -// fprintf (stderr, "GetImage '%s'\n", -// rtl::OUStringToOString( rImageName, RTL_TEXTENCODING_UTF8 ).getStr() ); - if( mpImplData ) { ImageAryData *pImg = mpImplData->maNameHash[ rImageName ]; @@ -832,7 +783,6 @@ Image ImageList::GetImage( const ::rtl::OUString& rImageName ) const return Image( pImg->maBitmapEx ); } } -// fprintf (stderr, "no such image\n"); return Image(); } @@ -981,9 +931,6 @@ Size ImageList::GetImageSize() const aRet = mpImplData->maImageSize = aTmp.GetSizePixel(); } } -// fprintf (stderr, "GetImageSize returns %d, %d\n", -// aRet.Width(), aRet.Height()); - return aRet; } @@ -1024,3 +971,5 @@ sal_Bool ImageList::operator==( const ImageList& rImageList ) const return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/imagerepository.cxx b/vcl/source/gdi/imagerepository.cxx index 0118acc13146..6fda85735b01 100644 --- a/vcl/source/gdi/imagerepository.cxx +++ b/vcl/source/gdi/imagerepository.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,6 @@ #include <vcl/bitmapex.hxx> #include <vcl/imagerepository.hxx> #include <vcl/svapp.hxx> - #include "impimagetree.hxx" //........................................................................ @@ -43,15 +43,23 @@ namespace vcl //= ImageRepository //==================================================================== //-------------------------------------------------------------------- - bool ImageRepository::loadImage( const ::rtl::OUString& _rName, BitmapEx& _out_rImage, bool _bSearchLanguageDependent ) + bool ImageRepository::loadImage( const ::rtl::OUString& _rName, BitmapEx& _out_rImage, bool _bSearchLanguageDependent, bool loadMissing ) { ::rtl::OUString sCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName(); ImplImageTreeSingletonRef aImplImageTree; - return aImplImageTree->loadImage( _rName, sCurrentSymbolsStyle, _out_rImage, _bSearchLanguageDependent ); + return aImplImageTree->loadImage( _rName, sCurrentSymbolsStyle, _out_rImage, _bSearchLanguageDependent, loadMissing ); + } + + bool ImageRepository::loadDefaultImage( BitmapEx& _out_rImage) + { + ::rtl::OUString sCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName(); + ImplImageTreeSingletonRef aImplImageTree; + return aImplImageTree->loadDefaultImage( sCurrentSymbolsStyle,_out_rImage); } //........................................................................ } // namespace vcl //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index aaaca451ebe3..59ee15fa558a 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -353,3 +354,5 @@ AInfo* ImplAnimView::ImplCreateAInfo() const return pAInfo; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impanmvw.hxx b/vcl/source/gdi/impanmvw.hxx index 69ae35fe1c6e..4e96ecbd9b64 100644 --- a/vcl/source/gdi/impanmvw.hxx +++ b/vcl/source/gdi/impanmvw.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,3 +95,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx index f8d71112d3a1..579515f67e9c 100644 --- a/vcl/source/gdi/impbmp.cxx +++ b/vcl/source/gdi/impbmp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -131,3 +132,5 @@ void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, sal_Bool bReadOnly ) if( !bReadOnly ) mnChecksum = 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 62b1976015ce..9d995f361329 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,6 @@ #include <unotools/ucbstreamhelper.hxx> #include <unotools/tempfile.hxx> - #include <vcl/outdev.hxx> #include <vcl/virdev.hxx> #include <vcl/gfxlink.hxx> @@ -392,7 +392,7 @@ void ImpGraphic::ImplClear() ::ucbhelper::Content aCnt( mpSwapFile->aSwapURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), + aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) ); } catch( const ::com::sun::star::ucb::ContentCreationException& ) @@ -486,7 +486,7 @@ sal_Bool ImpGraphic::ImplIsAnimated() const sal_Bool ImpGraphic::ImplIsEPS() const { return( ( meType == GRAPHIC_GDIMETAFILE ) && - ( maMetaFile.GetActionCount() > 0 ) && + ( maMetaFile.GetActionSize() > 0 ) && ( maMetaFile.GetAction( 0 )->GetType() == META_EPS_ACTION ) ); } @@ -495,7 +495,7 @@ sal_Bool ImpGraphic::ImplIsEPS() const sal_Bool ImpGraphic::ImplIsRenderGraphic() const { return( ( GRAPHIC_GDIMETAFILE == meType ) && - ( 1 == maMetaFile.GetActionCount() ) && + ( 1 == maMetaFile.GetActionSize() ) && ( META_RENDERGRAPHIC_ACTION == maMetaFile.GetAction( 0 )->GetType() ) ); } @@ -1127,7 +1127,7 @@ sal_Bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm, sal_Bool bSwap ) ::ucbhelper::Content aCnt( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), + aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) ); } catch( const ::com::sun::star::ucb::ContentCreationException& ) @@ -1311,7 +1311,7 @@ sal_Bool ImpGraphic::ImplSwapOut() ::ucbhelper::Content aCnt( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), + aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) ); } catch( const ::com::sun::star::ucb::ContentCreationException& ) @@ -1413,7 +1413,7 @@ sal_Bool ImpGraphic::ImplSwapIn() ::ucbhelper::Content aCnt( aSwapURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), + aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) ); } catch( const ::com::sun::star::ucb::ContentCreationException& ) @@ -1732,3 +1732,5 @@ SvStream& operator<<( SvStream& rOStm, const ImpGraphic& rImpGraphic ) return rOStm; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impimage.cxx b/vcl/source/gdi/impimage.cxx index 735f912f0782..2246058fb10f 100644 --- a/vcl/source/gdi/impimage.cxx +++ b/vcl/source/gdi/impimage.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -348,15 +349,6 @@ void ImplImageBmp::ReplaceColors( const Color* pSrcColors, const Color* pDstColo // ----------------------------------------------------------------------- -void ImplImageBmp::ColorTransform( BmpColorMode eColorMode ) -{ - maBmpEx = maBmpEx.GetColorTransformedBitmapEx( eColorMode ); - delete mpDisplayBmp; - mpDisplayBmp = NULL; -} - -// ----------------------------------------------------------------------- - BitmapEx ImplImageBmp::GetBitmapEx( sal_uInt16 nPosCount, sal_uInt16* pPosAry ) const { const Bitmap aNewBmp( Size( nPosCount * maSize.Width(), maSize.Height() ), maBmpEx.GetBitmap().GetBitCount() ); @@ -406,7 +398,6 @@ void ImplImageBmp::Draw( sal_uInt16 nPos, OutputDevice* pOutDev, else { if( nStyle & ( IMAGE_DRAW_COLORTRANSFORM | - IMAGE_DRAW_MONOCHROME_BLACK | IMAGE_DRAW_MONOCHROME_WHITE | IMAGE_DRAW_HIGHLIGHT | IMAGE_DRAW_DEACTIVE | IMAGE_DRAW_SEMITRANSPARENT ) ) { BitmapEx aTmpBmpEx; @@ -419,14 +410,6 @@ void ImplImageBmp::Draw( sal_uInt16 nPos, OutputDevice* pOutDev, aTmpBmpEx.Crop( aCropRect ); - if( nStyle & ( IMAGE_DRAW_COLORTRANSFORM | IMAGE_DRAW_MONOCHROME_BLACK | IMAGE_DRAW_MONOCHROME_WHITE ) ) - { - const BmpColorMode eMode = ( nStyle & IMAGE_DRAW_COLORTRANSFORM ) ? BMP_COLOR_HIGHCONTRAST : - ( ( nStyle & IMAGE_DRAW_MONOCHROME_BLACK ) ? BMP_COLOR_MONOCHROME_BLACK : BMP_COLOR_MONOCHROME_WHITE ); - - aTmpBmpEx = aTmpBmpEx.GetColorTransformedBitmapEx( eMode ); - } - Bitmap aTmpBmp( aTmpBmpEx.GetBitmap() ); if( nStyle & ( IMAGE_DRAW_HIGHLIGHT | IMAGE_DRAW_DEACTIVE ) ) @@ -634,3 +617,5 @@ void ImplImageBmp::ImplUpdateDisabledBmpEx( int nPos ) maDisabledBmpEx = BitmapEx( aGrey, aGreyAlphaMask ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx index 19947679567c..b43611e34b04 100644 --- a/vcl/source/gdi/impimagetree.cxx +++ b/vcl/source/gdi/impimagetree.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,7 @@ #include <memory> #include <utility> #include <vector> -#include <hash_map> +#include <boost/unordered_map.hpp> #include "com/sun/star/container/XNameAccess.hpp" #include "com/sun/star/io/XInputStream.hpp" @@ -91,8 +92,8 @@ std::auto_ptr< SvStream > wrapStream( OSL_ASSERT(stream.is()); std::auto_ptr< SvStream > s(new SvMemoryStream); for (;;) { - css::uno::Sequence< sal_Int8 > data; - sal_Int32 const size = 30000; + sal_Int32 const size = 2048; + css::uno::Sequence< sal_Int8 > data(size); sal_Int32 n = stream->readBytes(data, size); s->Write(data.getConstArray(), n); if (n < size) { @@ -144,7 +145,7 @@ bool ImplImageTree::checkStyle(rtl::OUString const & style) // skip brand-specific icon themes; they are incomplete and thus not useful for this check if (nFromIndex < 0 || !aZipURL.match(sBrandURLSuffix, nFromIndex)) { osl::File aZip(aZipURL); - if (aZip.open(OpenFlag_Read) == ::osl::FileBase::E_None) { + if (aZip.open(osl_File_OpenFlag_Read) == ::osl::FileBase::E_None) { aZip.close(); exists = true; } @@ -157,6 +158,41 @@ bool ImplImageTree::checkStyle(rtl::OUString const & style) bool ImplImageTree::loadImage( rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap, + bool localized, bool loadMissing ) +{ + bool found = false; + try { + found = doLoadImage(name, style, bitmap, localized); + } catch (css::uno::RuntimeException &) { + if (!loadMissing) + throw; + } + if (found || !loadMissing) + return found; + + try { + OSL_TRACE( + "ImplImageTree::loadImage exception couldn't load \"%s\", fetching missing_icon.png", + rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr()); + found = loadDefaultImage(style, bitmap); + } catch (css::uno::RuntimeException &) { + throw; + } + return found; +} + +bool ImplImageTree::loadDefaultImage( + rtl::OUString const & style, + BitmapEx& bitmap) +{ + return doLoadImage( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("res/grafikde.png")), + style, bitmap, false); +} + + +bool ImplImageTree::doLoadImage( + rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap, bool localized) { setStyle(style); @@ -279,7 +315,7 @@ void ImplImageTree::resetZips() { u.GetMainURL(INetURLObject::NO_DECODE), css::uno::Reference< css::container::XNameAccess >())); } - if ( m_style.equals(::rtl::OUString::createFromAscii("default")) ) + if ( m_style.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default"))) ) { rtl::OUString url( RTL_CONSTASCII_USTRINGPARAM( @@ -357,3 +393,5 @@ bool ImplImageTree::find( } return false; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index f405c3e4b602..19dc306ca4d6 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,9 +37,7 @@ #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <vcl/virdev.hxx> -#ifndef _SV_VECTORIZ_HXX #include <impvect.hxx> -#endif // ----------- // - Defines - @@ -364,7 +363,7 @@ public: inline void ImplAdd( sal_uInt8 nCode ); void ImplEndAdd( sal_uLong nTypeFlag ); - const Polygon& ImplGetPoly() { return maPoly; } + const Polygon& ImplGetPoly() const { return maPoly; } }; // ----------------------------------------------------------------------------- @@ -821,7 +820,7 @@ sal_Bool ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rM delete[] (sal_uInt8*) pColorSet; - if( rMtf.GetActionCount() ) + if( rMtf.GetActionSize() ) { MapMode aMap( MAP_100TH_MM ); VirtualDevice aVDev; @@ -1202,3 +1201,5 @@ sal_Bool ImplVectorizer::ImplIsUp( ImplVectMap* pMap, long nY, long nX ) const else return sal_False; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impvect.hxx b/vcl/source/gdi/impvect.hxx index 86fef6a04083..56591e969b8b 100644 --- a/vcl/source/gdi/impvect.hxx +++ b/vcl/source/gdi/impvect.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,3 +62,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index b44a99b2789d..d06e16dcf0cb 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <tools/debug.hxx> #include <tools/stream.hxx> - #include <rtl/alloc.h> - #include <vcl/jobset.hxx> #include <jobset.h> @@ -215,7 +214,7 @@ String JobSetup::GetValue( const String& rKey ) const { if( mpData ) { - ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it; + ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it; it = mpData->maValueMap.find( rKey ); return it != mpData->maValueMap.end() ? String( it->second ) : String(); } @@ -298,8 +297,6 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup ) { DBG_ASSERTWARNING( rIStream.GetVersion(), "JobSetup::>> - Solar-Version not set on rOStream" ); - // Zur Zeit haben wir noch kein neues FileFormat -// if ( rIStream.GetVersion() < JOBSET_FILEFORMAT2 ) { sal_Size nFirstPos = rIStream.Tell(); @@ -383,11 +380,6 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup ) } delete[] pTempBuf; } -/* - else - { - } -*/ return rIStream; } @@ -433,7 +425,7 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup ) rOStream.Write( (char*)&aOldData, sizeof( aOldData ) ); rOStream.Write( (char*)&aOldJobData, nOldJobDataSize ); rOStream.Write( (char*)pJobData->mpDriverData, pJobData->mnDriverDataLen ); - ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it; + ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it; for( it = pJobData->maValueMap.begin(); it != pJobData->maValueMap.end(); ++it ) { rOStream.WriteByteString( it->first, RTL_TEXTENCODING_UTF8 ); @@ -461,3 +453,5 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup ) return rOStream; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx index ebd55a48f593..542c3103eb27 100644 --- a/vcl/source/gdi/lineinfo.cxx +++ b/vcl/source/gdi/lineinfo.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -367,3 +368,5 @@ void LineInfo::applyToB2DPolyPolygon( } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index ec664cf648a6..e124dc343eba 100755 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -43,81 +43,84 @@ CDEFS+=-D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE .ENDIF .IF "$(ENABLE_GRAPHITE)" == "TRUE" CDEFS+=-DENABLE_GRAPHITE +.IF "$(SYSTEM_GRAPHITE)" != "YES" +CDEFS+=-DGR2_STATIC +.ENDIF .ENDIF # --- Files -------------------------------------------------------- EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ - $(SLO)$/outdev.obj \ - $(SLO)$/outdev3.obj \ - $(SLO)$/outdevnative.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 \ - $(SLO)$/impimage.obj \ - $(SLO)$/impgraph.obj \ - $(SLO)$/metric.obj \ - $(SLO)$/pdfwriter_impl.obj \ - $(SLO)$/pdfwriter_impl2.obj \ - $(SLO)$/pdffontcache.obj \ - $(SLO)$/bmpconv.obj \ - $(SLO)$/pdfextoutdevdata.obj \ - $(SLO)$/jobset.obj \ - $(SLO)$/impimagetree.obj \ - $(SLO)$/pngread.obj \ - $(SLO)$/pngwrite.obj \ - $(SLO)$/virdev.obj \ - $(SLO)$/gdimtf.obj \ - $(SLO)$/graphictools.obj \ - $(SLO)$/textlayout.obj \ - $(SLO)$/lineinfo.obj \ - $(SLO)$/svgread.obj \ - $(SLO)$/rendergraphic.obj \ - $(SLO)$/rendergraphicrasterizer.obj + $(SLO)$/animate.obj \ + $(SLO)$/base14.obj \ + $(SLO)$/bitmap.obj \ + $(SLO)$/bitmap2.obj \ + $(SLO)$/bitmapex.obj \ + $(SLO)$/bmpconv.obj \ + $(SLO)$/configsettings.obj \ + $(SLO)$/cvtgrf.obj \ + $(SLO)$/cvtsvm.obj \ + $(SLO)$/gdimtf.obj \ + $(SLO)$/gfxlink.obj \ + $(SLO)$/graph.obj \ + $(SLO)$/graphictools.obj \ + $(SLO)$/image.obj \ + $(SLO)$/imagerepository.obj \ + $(SLO)$/impanmvw.obj \ + $(SLO)$/impgraph.obj \ + $(SLO)$/impimage.obj \ + $(SLO)$/impimagetree.obj \ + $(SLO)$/impvect.obj \ + $(SLO)$/jobset.obj \ + $(SLO)$/lineinfo.obj \ + $(SLO)$/metaact.obj \ + $(SLO)$/metric.obj \ + $(SLO)$/oldprintadaptor.obj \ + $(SLO)$/outdev.obj \ + $(SLO)$/outdev2.obj \ + $(SLO)$/outdev3.obj \ + $(SLO)$/outdev4.obj \ + $(SLO)$/outdev5.obj \ + $(SLO)$/outdev6.obj \ + $(SLO)$/outdevnative.obj \ + $(SLO)$/outmap.obj \ + $(SLO)$/pdfextoutdevdata.obj \ + $(SLO)$/pdffontcache.obj\ + $(SLO)$/pdfwriter.obj \ + $(SLO)$/pdfwriter_impl.obj \ + $(SLO)$/pdfwriter_impl2.obj \ + $(SLO)$/pngread.obj \ + $(SLO)$/pngwrite.obj \ + $(SLO)$/print.obj \ + $(SLO)$/print2.obj \ + $(SLO)$/print3.obj \ + $(SLO)$/rendergraphic.obj \ + $(SLO)$/rendergraphicrasterizer.obj \ + $(SLO)$/salgdilayout.obj \ + $(SLO)$/sallayout.obj \ + $(SLO)$/salnativewidgets-none.obj \ + $(SLO)$/svgread.obj \ + $(SLO)$/textlayout.obj \ + $(SLO)$/virdev.obj \ + $(SLO)$/wall.obj SLOFILES= $(EXCEPTIONSFILES) \ - $(SLO)$/animate.obj \ - $(SLO)$/impanmvw.obj \ - $(SLO)$/bitmap.obj \ - $(SLO)$/bitmap2.obj \ $(SLO)$/bitmap3.obj \ $(SLO)$/bitmap4.obj \ $(SLO)$/alpha.obj \ - $(SLO)$/bitmapex.obj \ $(SLO)$/bmpacc.obj \ $(SLO)$/bmpacc2.obj \ $(SLO)$/bmpacc3.obj \ $(SLO)$/bmpfast.obj \ - $(SLO)$/cvtsvm.obj \ - $(SLO)$/cvtgrf.obj \ $(SLO)$/font.obj \ $(SLO)$/gradient.obj \ $(SLO)$/hatch.obj \ - $(SLO)$/graph.obj \ $(SLO)$/impbmp.obj \ - $(SLO)$/imagerepository.obj \ - $(SLO)$/impvect.obj \ $(SLO)$/mapmod.obj \ - $(SLO)$/metaact.obj \ $(SLO)$/octree.obj \ - $(SLO)$/outmap.obj \ - $(SLO)$/outdev2.obj \ - $(SLO)$/outdev4.obj \ - $(SLO)$/outdev5.obj \ - $(SLO)$/outdev6.obj \ $(SLO)$/regband.obj \ $(SLO)$/region.obj \ - $(SLO)$/wall.obj \ - $(SLO)$/base14.obj \ - $(SLO)$/pdfwriter.obj \ - $(SLO)$/salgdilayout.obj \ - $(SLO)$/extoutdevdata.obj \ - $(SLO)$/salnativewidgets-none.obj + $(SLO)$/extoutdevdata.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx index 5eff28d559a7..ae7b13ca25b7 100644 --- a/vcl/source/gdi/mapmod.cxx +++ b/vcl/source/gdi/mapmod.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -309,3 +310,5 @@ SvStream& operator<<( SvStream& rOStm, const MapMode& rMapMode ) { return (rOStm << *rMapMode.mpImplMapMode); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index ad0c9c9d5f95..2ffa3c68e4f7 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -4121,6 +4122,7 @@ void MetaCommentAction::Move( long nXMove, long nYMove ) // SJ: 25.07.06 #i56656# we are not able to mirrorcertain kind of // comments properly, especially the XPATHSTROKE and XPATHFILL lead to // problems, so it is better to remove these comments when mirroring +// FIXME: fake comment to apply the next hunk in the right location void MetaCommentAction::Scale( double fXScale, double fYScale ) { if ( ( fXScale != 1.0 ) || ( fYScale != 1.0 ) ) @@ -4154,6 +4156,32 @@ void MetaCommentAction::Scale( double fXScale, double fYScale ) } delete[] mpData; ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() ); + } else if( maComment.Equals( "EMF_PLUS_HEADER_INFO" ) ) { + SvMemoryStream aMemStm( (void*)mpData, mnDataSize, STREAM_READ ); + SvMemoryStream aDest; + + sal_Int32 nLeft, nRight, nTop, nBottom; + sal_Int32 nPixX, nPixY, nMillX, nMillY; + float m11, m12, m21, m22, mdx, mdy; + + // read data + aMemStm >> nLeft >> nTop >> nRight >> nBottom; + aMemStm >> nPixX >> nPixY >> nMillX >> nMillY; + aMemStm >> m11 >> m12 >> m21 >> m22 >> mdx >> mdy; + + // add scale to the transformation + m11 *= fXScale; + m12 *= fXScale; + m22 *= fYScale; + m21 *= fYScale; + + // prepare new data + aDest << nLeft << nTop << nRight << nBottom; + aDest << nPixX << nPixY << nMillX << nMillY; + aDest << m11 << m12 << m21 << m22 << mdx << mdy; + + // save them + ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() ); } } } @@ -4380,3 +4408,5 @@ void MetaRenderGraphicAction::Read( SvStream& rIStm, ImplMetaReadData* ) COMPAT( rIStm ); rIStm >> maRenderGraphic >> maPoint >> maSize >> mfRotateAngle >> mfShearAngleX >> mfShearAngleY; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index b05ae27a8f5f..e8a8a2cb3a63 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -685,15 +686,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) sal_uInt32 cMaxChar = GetUInt( pGroup + 4 ); int nGlyphId = GetUInt( pGroup + 8 ); pGroup += 12; -#if 0 // TODO: remove unicode baseplane clipping for UCS-4 support - if( cMinChar > 0xFFFF ) - continue; - if( cMaxChar > 0xFFFF ) - cMaxChar = 0xFFFF; -#else if( cMinChar > cMaxChar ) // no sane font should trigger this break; -#endif *(pCP++) = cMinChar; *(pCP++) = cMaxChar + 1; pStartGlyphs[i] = nGlyphId; @@ -932,3 +926,4 @@ sal_uInt32 FontCharMap::GetCharFromIndex( int nIndex ) const // ======================================================================= +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx index be69d34bff7e..56c46f421695 100644 --- a/vcl/source/gdi/octree.cxx +++ b/vcl/source/gdi/octree.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -370,3 +371,5 @@ void InverseColorMap::ImplCreateBuffers( const sal_uLong nMax ) pBuffer = (sal_uInt8*) rtl_allocateMemory( nSize ); memset( pBuffer, 0xff, nSize ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx index ce3ece7e1e5b..ecba7a97880b 100644 --- a/vcl/source/gdi/oldprintadaptor.cxx +++ b/vcl/source/gdi/oldprintadaptor.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,6 +63,7 @@ OldStylePrintAdaptor::OldStylePrintAdaptor( const boost::shared_ptr< Printer >& OldStylePrintAdaptor::~OldStylePrintAdaptor() { + delete mpData; } void OldStylePrintAdaptor::StartPage() @@ -115,3 +117,4 @@ void OldStylePrintAdaptor::printPage( int i_nPage ) const } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index dcad34c363ad..3e5e05904e57 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -994,7 +995,7 @@ void OutputDevice::ImplInitClipRegion() && GetOutDevType() != OUTDEV_PRINTER ); if( bClipDeviceBounds ) { - // #b6520266# Perform actual rect clip against outdev + // Perform actual rect clip against outdev // dimensions, to generate empty clips whenever one of the // values is completely off the device. Rectangle aDeviceBounds( mnOutOffX, mnOutOffY, @@ -1049,7 +1050,7 @@ void OutputDevice::ImplSetClipRegion( const Region* pRegion ) void OutputDevice::SetClipRegion() { - DBG_TRACE( "OutputDevice::SetClipRegion()" ); + OSL_TRACE( "OutputDevice::SetClipRegion()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1065,7 +1066,7 @@ void OutputDevice::SetClipRegion() void OutputDevice::SetClipRegion( const Region& rRegion ) { - DBG_TRACE( "OutputDevice::SetClipRegion( rRegion )" ); + OSL_TRACE( "OutputDevice::SetClipRegion( rRegion )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion ); @@ -1120,7 +1121,7 @@ Region OutputDevice::GetActiveClipRegion() const void OutputDevice::MoveClipRegion( long nHorzMove, long nVertMove ) { - DBG_TRACE( "OutputDevice::MoveClipRegion()" ); + OSL_TRACE( "OutputDevice::MoveClipRegion()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mbClipRegion ) @@ -1141,7 +1142,7 @@ void OutputDevice::MoveClipRegion( long nHorzMove, long nVertMove ) void OutputDevice::IntersectClipRegion( const Rectangle& rRect ) { - DBG_TRACE( "OutputDevice::IntersectClipRegion( rRect )" ); + OSL_TRACE( "OutputDevice::IntersectClipRegion( rRect )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1160,7 +1161,7 @@ void OutputDevice::IntersectClipRegion( const Rectangle& rRect ) void OutputDevice::IntersectClipRegion( const Region& rRegion ) { - DBG_TRACE( "OutputDevice::IntersectClipRegion( rRegion )" ); + OSL_TRACE( "OutputDevice::IntersectClipRegion( rRegion )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion ); @@ -1185,7 +1186,7 @@ void OutputDevice::IntersectClipRegion( const Region& rRegion ) void OutputDevice::SetDrawMode( sal_uLong nDrawMode ) { - DBG_TRACE1( "OutputDevice::SetDrawMode( %lx )", nDrawMode ); + OSL_TRACE( "OutputDevice::SetDrawMode( %lx )", nDrawMode ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); mnDrawMode = nDrawMode; @@ -1198,7 +1199,7 @@ void OutputDevice::SetDrawMode( sal_uLong nDrawMode ) void OutputDevice::SetRasterOp( RasterOp eRasterOp ) { - DBG_TRACE1( "OutputDevice::SetRasterOp( %d )", (int)eRasterOp ); + OSL_TRACE( "OutputDevice::SetRasterOp( %d )", (int)eRasterOp ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1221,7 +1222,7 @@ void OutputDevice::SetRasterOp( RasterOp eRasterOp ) void OutputDevice::SetLineColor() { - DBG_TRACE( "OutputDevice::SetLineColor()" ); + OSL_TRACE( "OutputDevice::SetLineColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1242,7 +1243,7 @@ void OutputDevice::SetLineColor() void OutputDevice::SetLineColor( const Color& rColor ) { - DBG_TRACE1( "OutputDevice::SetLineColor( %lx )", rColor.GetColor() ); + OSL_TRACE( "OutputDevice::SetLineColor( %lx )", rColor.GetColor() ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -1310,7 +1311,7 @@ void OutputDevice::SetLineColor( const Color& rColor ) void OutputDevice::SetFillColor() { - DBG_TRACE( "OutputDevice::SetFillColor()" ); + OSL_TRACE( "OutputDevice::SetFillColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1331,7 +1332,7 @@ void OutputDevice::SetFillColor() void OutputDevice::SetFillColor( const Color& rColor ) { - DBG_TRACE1( "OutputDevice::SetFillColor( %lx )", rColor.GetColor() ); + OSL_TRACE( "OutputDevice::SetFillColor( %lx )", rColor.GetColor() ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -1403,7 +1404,7 @@ void OutputDevice::SetFillColor( const Color& rColor ) void OutputDevice::SetBackground() { - DBG_TRACE( "OutputDevice::SetBackground()" ); + OSL_TRACE( "OutputDevice::SetBackground()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); maBackground = Wallpaper(); @@ -1417,7 +1418,7 @@ void OutputDevice::SetBackground() void OutputDevice::SetBackground( const Wallpaper& rBackground ) { - DBG_TRACE( "OutputDevice::SetBackground( rBackground )" ); + OSL_TRACE( "OutputDevice::SetBackground( rBackground )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); maBackground = rBackground; @@ -1435,7 +1436,7 @@ void OutputDevice::SetBackground( const Wallpaper& rBackground ) void OutputDevice::SetRefPoint() { - DBG_TRACE( "OutputDevice::SetRefPoint()" ); + OSL_TRACE( "OutputDevice::SetRefPoint()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1452,7 +1453,7 @@ void OutputDevice::SetRefPoint() void OutputDevice::SetRefPoint( const Point& rRefPoint ) { - DBG_TRACE( "OutputDevice::SetRefPoint( rRefPoint )" ); + OSL_TRACE( "OutputDevice::SetRefPoint( rRefPoint )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1469,7 +1470,7 @@ void OutputDevice::SetRefPoint( const Point& rRefPoint ) void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt ) { - DBG_TRACE( "OutputDevice::DrawLine()" ); + OSL_TRACE( "OutputDevice::DrawLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1667,7 +1668,7 @@ void OutputDevice::impPaintLineGeometryWithEvtlExpand( void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, const LineInfo& rLineInfo ) { - DBG_TRACE( "OutputDevice::DrawLine()" ); + OSL_TRACE( "OutputDevice::DrawLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( rLineInfo.IsDefault() ) @@ -1721,7 +1722,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, void OutputDevice::DrawRect( const Rectangle& rRect ) { - DBG_TRACE( "OutputDevice::DrawRect()" ); + OSL_TRACE( "OutputDevice::DrawRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1762,7 +1763,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect ) void OutputDevice::DrawPolyLine( const Polygon& rPoly ) { - DBG_TRACE( "OutputDevice::DrawPolyLine()" ); + OSL_TRACE( "OutputDevice::DrawPolyLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rPoly, Polygon, NULL ); @@ -1840,7 +1841,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo ) { - DBG_TRACE( "OutputDevice::DrawPolyLine()" ); + OSL_TRACE( "OutputDevice::DrawPolyLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rPoly, Polygon, NULL ); @@ -1932,7 +1933,7 @@ void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineI void OutputDevice::DrawPolygon( const Polygon& rPoly ) { - DBG_TRACE( "OutputDevice::DrawPolygon()" ); + OSL_TRACE( "OutputDevice::DrawPolygon()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rPoly, Polygon, NULL ); @@ -2022,7 +2023,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly ) void OutputDevice::DrawPolyPolygon( const PolyPolygon& rPolyPoly ) { - DBG_TRACE( "OutputDevice::DrawPolyPolygon()" ); + OSL_TRACE( "OutputDevice::DrawPolyPolygon()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rPolyPoly, PolyPolygon, NULL ); @@ -2133,20 +2134,12 @@ void OutputDevice::DrawPolygon( const ::basegfx::B2DPolygon& rB2DPolygon) void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly ) { - DBG_TRACE( "OutputDevice::DrawPolyPolygon(B2D&)" ); + OSL_TRACE( "OutputDevice::DrawPolyPolygon(B2D&)" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); -#if 0 - // MetaB2DPolyPolygonAction is not implemented yet: - // according to AW adding it is very dangerous since there is a lot - // of code that uses the metafile actions directly and unless every - // place that does this knows about the new action we need to fallback - if( mpMetaFile ) - mpMetaFile->AddAction( new MetaB2DPolyPolygonAction( rB2DPolyPoly ) ); -#else + if( mpMetaFile ) mpMetaFile->AddAction( new MetaPolyPolygonAction( PolyPolygon( rB2DPolyPoly ) ) ); -#endif // call helper ImpDrawPolyPolygonWithB2DPolyPolygon(rB2DPolyPoly); @@ -2257,17 +2250,10 @@ void OutputDevice::DrawPolyLine( double fLineWidth, basegfx::B2DLineJoin eLineJoin) { - DBG_TRACE( "OutputDevice::DrawPolyLine(B2D&)" ); + OSL_TRACE( "OutputDevice::DrawPolyLine(B2D&)" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); (void)eLineJoin; // ATM used in UNX, but not in WNT, access it for warning-free -#if 0 // MetaB2DPolyLineAction is not implemented yet: - // according to AW adding it is very dangerous since there is a lot - // of code that uses the metafile actions directly and unless every - // place that does this knows about the new action we need to fallback - if( mpMetaFile ) - mpMetaFile->AddAction( new MetaB2DPolyLineAction( rB2DPolygon ) ); -#else if( mpMetaFile ) { LineInfo aLineInfo; @@ -2276,7 +2262,7 @@ void OutputDevice::DrawPolyLine( const Polygon aToolsPolygon( rB2DPolygon ); mpMetaFile->AddAction( new MetaPolyLineAction( aToolsPolygon, aLineInfo ) ); } -#endif + // AW: Do NOT paint empty PolyPolygons if(!rB2DPolygon.count()) @@ -2377,7 +2363,7 @@ sal_uInt32 OutputDevice::GetGCStackDepth() const void OutputDevice::Push( sal_uInt16 nFlags ) { - DBG_TRACE( "OutputDevice::Push()" ); + OSL_TRACE( "OutputDevice::Push()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -2466,7 +2452,7 @@ void OutputDevice::Push( sal_uInt16 nFlags ) void OutputDevice::Pop() { - DBG_TRACE( "OutputDevice::Pop()" ); + OSL_TRACE( "OutputDevice::Pop()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( mpMetaFile ) @@ -2707,3 +2693,5 @@ SystemGraphicsData OutputDevice::GetSystemGfxData() const } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx index 46b0d81c348d..d1a76a9f085b 100755..100644 --- a/vcl/source/gdi/outdev2.cxx +++ b/vcl/source/gdi/outdev2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -243,7 +244,7 @@ void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, void* pVoi void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPt, const Size& rSrcSize ) { - DBG_TRACE( "OutputDevice::DrawOutDev()" ); + OSL_TRACE( "OutputDevice::DrawOutDev()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" ); @@ -317,7 +318,7 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPt, const Size& rSrcSize, const OutputDevice& rOutDev ) { - DBG_TRACE( "OutputDevice::DrawOutDev()" ); + OSL_TRACE( "OutputDevice::DrawOutDev()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rOutDev, OutputDevice, ImplDbgCheckOutputDevice ); DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" ); @@ -390,7 +391,7 @@ void OutputDevice::CopyArea( const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize, sal_uInt16 nFlags ) { - DBG_TRACE( "OutputDevice::CopyArea()" ); + OSL_TRACE( "OutputDevice::CopyArea()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::CopyArea(...) with printer devices!" ); @@ -520,7 +521,7 @@ void OutputDevice::ImplGetFrameDev( const Point& rPt, const Point& rDevPt, const void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap ) { - DBG_TRACE( "OutputDevice::DrawBitmap()" ); + OSL_TRACE( "OutputDevice::DrawBitmap()" ); if( ImplIsRecordLayout() ) return; @@ -539,7 +540,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap ) void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap ) { - DBG_TRACE( "OutputDevice::DrawBitmap( Size )" ); + OSL_TRACE( "OutputDevice::DrawBitmap( Size )" ); if( ImplIsRecordLayout() ) return; @@ -559,7 +560,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, const Bitmap& rBitmap ) { - DBG_TRACE( "OutputDevice::DrawBitmap( Point, Size )" ); + OSL_TRACE( "OutputDevice::DrawBitmap( Point, Size )" ); if( ImplIsRecordLayout() ) return; @@ -737,7 +738,7 @@ void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize, void OutputDevice::DrawBitmapEx( const Point& rDestPt, const BitmapEx& rBitmapEx ) { - DBG_TRACE( "OutputDevice::DrawBitmapEx()" ); + OSL_TRACE( "OutputDevice::DrawBitmapEx()" ); if( ImplIsRecordLayout() ) return; @@ -756,7 +757,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, const BitmapEx& rBitmapEx ) { - DBG_TRACE( "OutputDevice::DrawBitmapEx( Size )" ); + OSL_TRACE( "OutputDevice::DrawBitmapEx( Size )" ); if( ImplIsRecordLayout() ) return; @@ -773,7 +774,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, const BitmapEx& rBitmapEx ) { - DBG_TRACE( "OutputDevice::DrawBitmapEx( Point, Size )" ); + OSL_TRACE( "OutputDevice::DrawBitmapEx( Point, Size )" ); if( ImplIsRecordLayout() ) return; @@ -1008,7 +1009,7 @@ void OutputDevice::ImplDrawBitmapEx( const Point& rDestPt, const Size& rDestSize void OutputDevice::DrawMask( const Point& rDestPt, const Bitmap& rBitmap, const Color& rMaskColor ) { - DBG_TRACE( "OutputDevice::DrawMask()" ); + OSL_TRACE( "OutputDevice::DrawMask()" ); if( ImplIsRecordLayout() ) return; @@ -1036,7 +1037,7 @@ void OutputDevice::DrawMask( const Point& rDestPt, void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap, const Color& rMaskColor ) { - DBG_TRACE( "OutputDevice::DrawMask( Size )" ); + OSL_TRACE( "OutputDevice::DrawMask( Size )" ); if( ImplIsRecordLayout() ) return; @@ -1065,7 +1066,7 @@ void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, const Bitmap& rBitmap, const Color& rMaskColor ) { - DBG_TRACE( "OutputDevice::DrawMask( Point, Size )" ); + OSL_TRACE( "OutputDevice::DrawMask( Point, Size )" ); if( ImplIsRecordLayout() ) return; @@ -1446,7 +1447,7 @@ Color* OutputDevice::GetPixel( const Polygon& rPts ) const void OutputDevice::DrawPixel( const Point& rPt ) { - DBG_TRACE( "OutputDevice::DrawPixel()" ); + OSL_TRACE( "OutputDevice::DrawPixel()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -1482,7 +1483,7 @@ void OutputDevice::DrawPixel( const Point& rPt ) void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor ) { - DBG_TRACE( "OutputDevice::DrawPixel()" ); + OSL_TRACE( "OutputDevice::DrawPixel()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -1554,7 +1555,7 @@ void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors ) DrawPixel( rPts, GetLineColor() ); else { - DBG_TRACE( "OutputDevice::DrawPixel()" ); + OSL_TRACE( "OutputDevice::DrawPixel()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_ASSERT( pColors, "OutputDevice::DrawPixel: No color array specified" ); @@ -2267,3 +2268,5 @@ void OutputDevice::ImplPrintMask( const Bitmap& rMask, const Color& rMaskColor, mpMetaFile = pOldMetaFile; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 1681e1eeec7c..5393bafb38e6 100755 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,8 +90,6 @@ #if defined UNX #define GLYPH_FONT_HEIGHT 128 -#elif defined OS2 -#define GLYPH_FONT_HEIGHT 176 #else #define GLYPH_FONT_HEIGHT 256 #endif @@ -507,7 +506,7 @@ static void ImplFontSubstitute( String& rFontName, Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang, sal_uLong nFlags, const OutputDevice* pOutDev ) { - DBG_TRACE( "OutputDevice::GetDefaultFont()" ); + OSL_TRACE( "OutputDevice::GetDefaultFont()" ); com::sun::star::lang::Locale aLocale; if( eLang == LANGUAGE_NONE || eLang == LANGUAGE_SYSTEM || eLang == LANGUAGE_DONTKNOW ) @@ -519,7 +518,7 @@ Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang, MsLangId::convertLanguageToLocale( eLang, aLocale ); } - utl::DefaultFontConfiguration& rDefaults = *utl::DefaultFontConfiguration::get(); + utl::DefaultFontConfiguration& rDefaults = utl::DefaultFontConfiguration::get(); String aSearch = rDefaults.getUserInterfaceFont( aLocale ); // ensure a fallback String aDefault = rDefaults.getDefaultFont( aLocale, nType ); if( aDefault.Len() ) @@ -615,10 +614,10 @@ Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang, // No Name, than set all names if ( !aFont.GetName().Len() ) { - xub_StrLen nIndex = 0; if ( nFlags & DEFAULTFONT_FLAGS_ONLYONE ) { - //aFont.SetName( aSearch.GetToken( 0, ';', nIndex ) ); + xub_StrLen nIndex = 0; + if( !pOutDev ) pOutDev = (const OutputDevice *)ImplGetSVData()->mpDefaultWin; if( !pOutDev ) @@ -647,10 +646,13 @@ Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang, // get the name of the first available font float fExactHeight = static_cast<float>(aSize.Height()); ImplFontEntry* pEntry = pOutDev->mpFontCache->GetFontEntry( pOutDev->mpFontList, aFont, aSize, fExactHeight, pOutDev->mpOutDevData ? &pOutDev->mpOutDevData->maDevFontSubst : NULL ); - if( pEntry->maFontSelData.mpFontData ) - aFont.SetName( pEntry->maFontSelData.mpFontData->maName ); - else - aFont.SetName( pEntry->maFontSelData.maTargetName ); + if (pEntry) + { + if( pEntry->maFontSelData.mpFontData ) + aFont.SetName( pEntry->maFontSelData.mpFontData->maName ); + else + aFont.SetName( pEntry->maFontSelData.maTargetName ); + } } } else @@ -1004,8 +1006,8 @@ ImplFontEntry::~ImplFontEntry() size_t ImplFontEntry::GFBCacheKey_Hash::operator()( const GFBCacheKey& rData ) const { - std::hash<sal_UCS4> a; - std::hash<int > b; + boost::hash<sal_UCS4> a; + boost::hash<int > b; return a(rData.first) ^ b(rData.second); } @@ -1402,16 +1404,6 @@ void ImplDevFontList::InitGenericGlyphFallback( void ) const } #endif -#if defined(HDU_DEBUG) - for( int i = 0; i < nMaxLevel; ++i ) - { - ImplDevFontListData* pFont = pFallbackList[ i ]; - ByteString aFontName( pFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 ); - fprintf( stderr, "GlyphFallbackFont[%d] (quality=%05d): \"%s\"\n", - i, pFont->GetMinQuality(), aFontName.GetBuffer() ); - } -#endif - mnFallbackCount = nMaxLevel; mpFallbackList = pFallbackList; } @@ -1514,7 +1506,8 @@ void ImplDevFontList::Add( ImplFontData* pNewData ) pNewData->maMapNames = String(); bool bKeepNewData = false; - for( xub_StrLen nMapNameIndex = 0; nMapNameIndex != STRING_NOTFOUND; ) + xub_StrLen nMapNameIndex = 0; + while( true ) { String aSearchName = pNewData->maName; GetEnglishSearchFontName( aSearchName ); @@ -1532,7 +1525,7 @@ void ImplDevFontList::Add( ImplFontData* pNewData ) bKeepNewData = pFoundData->AddFontFace( pNewData ); - // add font alias if available + // add (another) font alias if available // a font alias should never win against an original font with similar quality if( aMapNames.Len() <= nMapNameIndex ) break; @@ -1681,7 +1674,7 @@ void ImplDevFontList::InitMatchData() const mbMatchData = true; // calculate MatchData for all entries - const FontSubstConfiguration& rFontSubst = *FontSubstConfiguration::get(); + const FontSubstConfiguration& rFontSubst = FontSubstConfiguration::get(); DevFontList::const_iterator it = maDevFontList.begin(); for(; it != maDevFontList.end(); ++it ) @@ -1697,7 +1690,7 @@ void ImplDevFontList::InitMatchData() const ImplDevFontListData* ImplDevFontList::ImplFindByLocale( com::sun::star::lang::Locale& rLocale ) const { // get the default font for a specified locale - const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get(); + const DefaultFontConfiguration& rDefaults = DefaultFontConfiguration::get(); const String aDefault = rDefaults.getUserInterfaceFont( rLocale ); ImplDevFontListData* pFontData = ImplFindByTokenNames( aDefault ); if( pFontData ) @@ -2073,7 +2066,7 @@ ImplDevFontListData* ImplDevFontList::FindDefaultFont() const { // try to find one of the default fonts of the // UNICODE, SANSSERIF, SERIF or FIXED default font lists - const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get(); + const DefaultFontConfiguration& rDefaults = DefaultFontConfiguration::get(); com::sun::star::lang::Locale aLocale( OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), OUString(), OUString() ); String aFontname = rDefaults.getDefaultFont( aLocale, DEFAULTFONT_SANS_UNICODE ); ImplDevFontListData* pFoundData = ImplFindByTokenNames( aFontname ); @@ -2411,7 +2404,7 @@ ImplFontEntry* ImplFontCache::GetFontEntry( ImplDevFontList* pFontList, if( !pEntry->mnRefCount++ ) --mnRef0Count; } - else // no cache hit => create a new font instance + else if (pFontFamily)// no cache hit => create a new font instance { // find the best matching physical font face ImplFontData* pFontData = pFontFamily->FindBestFontFace( aFontSelData ); @@ -2607,7 +2600,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, { // get fallback info using FontSubstConfiguration and // the target name, it's shortened name and family name in that order - const FontSubstConfiguration& rFontSubst = *FontSubstConfiguration::get(); + const FontSubstConfiguration& rFontSubst = FontSubstConfiguration::get(); pFontAttr = rFontSubst.getSubstInfo( aSearchName ); if ( !pFontAttr && (aSearchShortName != aSearchName) ) pFontAttr = rFontSubst.getSubstInfo( aSearchShortName ); @@ -2627,7 +2620,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, if( rFSD.IsSymbolFont() ) { com::sun::star::lang::Locale aDefaultLocale( OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), OUString(), OUString() ); - aSearchName = DefaultFontConfiguration::get()->getDefaultFont( aDefaultLocale, DEFAULTFONT_SYMBOL ); + aSearchName = DefaultFontConfiguration::get().getDefaultFont( aDefaultLocale, DEFAULTFONT_SYMBOL ); ImplDevFontListData* pFoundData = ImplFindByTokenNames( aSearchName ); if( pFoundData ) return pFoundData; @@ -2663,7 +2656,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, // get fallback info using FontSubstConfiguration and // the target name, it's shortened name and family name in that order - const FontSubstConfiguration& rFontSubst = *FontSubstConfiguration::get(); + const FontSubstConfiguration& rFontSubst = FontSubstConfiguration::get(); const FontNameAttr* pTempFontAttr = rFontSubst.getSubstInfo( aSearchName ); if ( !pTempFontAttr && (aTempShortName != aSearchName) ) pTempFontAttr = rFontSubst.getSubstInfo( aTempShortName ); @@ -2757,8 +2750,20 @@ ImplFontEntry* ImplFontCache::GetGlyphFallbackFont( ImplDevFontList* pFontList, // e.g. PsPrint Arial->Helvetica for udiaeresis when Helvetica doesn't support it if( nFallbackLevel >= 1) { - ImplDevFontListData* pFallbackData = pFontList->GetGlyphFallbackFont( - rFontSelData, rMissingCodes, nFallbackLevel-1 ); + ImplDevFontListData* pFallbackData = NULL; + + //fdo#33898 If someone has EUDC installed then they really want that to + //be used as the first-choice glyph fallback seeing as it's filled with + //private area codes with don't make any sense in any other font so + //prioritise it here if it's available. Ideally we would remove from + //rMissingCodes all the glyphs which it is able to resolve as an + //optimization, but that's tricky to achieve cross-platform without + //sufficient heavy-weight code that's likely to undo the value of the + //optimization + if (nFallbackLevel == 1) + pFallbackData = pFontList->FindFontFamily(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EUDC"))); + if (!pFallbackData) + pFallbackData = pFontList->GetGlyphFallbackFont(rFontSelData, rMissingCodes, nFallbackLevel-1); // escape when there are no font candidates if( !pFallbackData ) return NULL; @@ -2950,6 +2955,9 @@ void OutputDevice::ImplInitFont() const { DBG_TESTSOLARMUTEX(); + if (!mpFontEntry) + return; + if ( mbInitFont ) { if ( meOutDevType != OUTDEV_PRINTER ) @@ -3036,6 +3044,10 @@ bool OutputDevice::ImplNewFont() const mpFontCache->Release( pOldEntry ); ImplFontEntry* pFontEntry = mpFontEntry; + + if (!pFontEntry) + return false; + // mark when lower layers need to get involved mbNewFont = sal_False; if( pFontEntry != pOldEntry ) @@ -3552,12 +3564,8 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, { long nCurX = nStartX; long nCurY = nStartY; - long nDiffX = 2; long nDiffY = nHeight-1; long nCount = nWidth; - long nOffY = -1; - long nFreq; - long i; long nPixWidth; long nPixHeight; sal_Bool bDrawPixAsRect; @@ -3597,8 +3605,11 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, } else { + long nDiffX = 2; + long nOffY = -1; + long i; nCurY += nDiffY; - nFreq = nCount / (nDiffX+nDiffY); + long nFreq = nCount / (nDiffX+nDiffY); while ( nFreq-- ) { for( i = nDiffY; i; --i ) @@ -4010,6 +4021,11 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, FontStrikeout eStrikeout, Color aColor ) { + //See qadevOOo/testdocs/StrikeThrough.odt for examples if you need + //to tweak this + if (!nWidth) + return; + // PDF-export does its own strikeout drawing... why again? if( mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) return; @@ -4022,35 +4038,23 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, cStrikeoutChar = 'X'; static const int nTestStrLen = 4; static const int nMaxStrikeStrLen = 2048; - xub_Unicode aChars[ nMaxStrikeStrLen +1]; // +1 for valgrind... + xub_Unicode aChars[nMaxStrikeStrLen+1]; // +1 for valgrind... for( int i = 0; i < nTestStrLen; ++i) aChars[i] = cStrikeoutChar; const String aStrikeoutTest( aChars, nTestStrLen ); // calculate approximation of strikeout atom size - long nStrikeoutWidth = nWidth; + long nStrikeoutWidth = 0; SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, nTestStrLen ); if( pLayout ) { - nStrikeoutWidth = (pLayout->GetTextWidth() +nTestStrLen/2) / (nTestStrLen * pLayout->GetUnitsPerPixel()); + nStrikeoutWidth = pLayout->GetTextWidth() / (nTestStrLen * pLayout->GetUnitsPerPixel()); pLayout->Release(); } if( nStrikeoutWidth <= 0 ) // sanity check return; - // calculate acceptable strikeout length - // allow the strikeout to be one pixel larger than the text it strikes out - long nMaxWidth = nStrikeoutWidth * 3 / 4; - if ( nMaxWidth < 2 ) - nMaxWidth = 2; - nMaxWidth += nWidth + 1; - - int nStrikeStrLen = (nMaxWidth - 1) / nStrikeoutWidth; - // if the text width is smaller than the strikeout text, then do not - // strike out at all. This case requires user interaction, e.g. adding - // a space to the text - if( nStrikeStrLen <= 0 ) - return; + int nStrikeStrLen = (nWidth+(nStrikeoutWidth-1)) / nStrikeoutWidth; if( nStrikeStrLen > nMaxStrikeStrLen ) nStrikeStrLen = nMaxStrikeStrLen; @@ -4079,8 +4083,29 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, ImplInitTextColor(); pLayout->DrawBase() = Point( nBaseX+mnTextOffX, nBaseY+mnTextOffY ); + + Rectangle aPixelRect; + aPixelRect.nLeft = nBaseX+mnTextOffX; + aPixelRect.nRight = aPixelRect.nLeft+nWidth; + aPixelRect.nBottom = nBaseY+mpFontEntry->maMetric.mnDescent; + aPixelRect.nTop = nBaseY-mpFontEntry->maMetric.mnAscent; + + if (mpFontEntry->mnOrientation) + { + Polygon aPoly( aPixelRect ); + aPoly.Rotate( Point(nBaseX+mnTextOffX, nBaseY+mnTextOffY), mpFontEntry->mnOrientation); + aPixelRect = aPoly.GetBoundRect(); + } + + Push( PUSH_CLIPREGION ); + IntersectClipRegion( PixelToLogic(aPixelRect) ); + if( mbInitClipRegion ) + ImplInitClipRegion(); + pLayout->DrawText( *mpGraphics ); + pLayout->Release(); + Pop(); SetTextColor( aOldColor ); ImplInitTextColor(); @@ -4440,7 +4465,6 @@ void OutputDevice::ImplDrawEmphasisMark( long nBaseX, long nX, long nY, void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout ) { - Color aOldColor = GetTextColor(); Color aOldLineColor = GetLineColor(); Color aOldFillColor = GetFillColor(); sal_Bool bOldMap = mbMap; @@ -4856,8 +4880,6 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, // auf mehr als Zwei Zeilen gebrochen wird... if ( xHyph.is() ) { - sal_Unicode cAlternateReplChar = 0; - sal_Unicode cAlternateExtraChar = 0; i18n::Boundary aBoundary = xBI->getWordBoundary( aText, nBreakPos, rDefLocale, ::com::sun::star::i18n::WordType::DICTIONARY_WORD, sal_True ); // sal_uInt16 nWordStart = nBreakPos; // sal_uInt16 nBreakPos_OLD = nBreakPos; @@ -4929,10 +4951,10 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, DBG_ASSERT( ( nAltEnd - nAltStart ) == 1, "Alternate: Falsche Annahme!" ); + sal_Unicode cAlternateReplChar = 0; + if ( nTxtEnd > nTxtStart ) cAlternateReplChar = aAlt.GetChar( nAltStart ); - else - cAlternateExtraChar = aAlt.GetChar( nAltStart ); nBreakPos = nWordStart + nTxtStart; if ( cAlternateReplChar ) @@ -5025,7 +5047,7 @@ void OutputDevice::SetAntialiasing( sal_uInt16 nMode ) void OutputDevice::SetFont( const Font& rNewFont ) { - DBG_TRACE( "OutputDevice::SetFont()" ); + OSL_TRACE( "OutputDevice::SetFont()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rNewFont, Font, NULL ); @@ -5100,12 +5122,6 @@ void OutputDevice::SetFont( const Font& rNewFont ) mpMetaFile->AddAction( new MetaTextFillColorAction( aFont.GetFillColor(), !aFont.IsTransparent() ) ); } -#if (OSL_DEBUG_LEVEL > 2) || defined (HDU_DEBUG) - fprintf( stderr, " OutputDevice::SetFont( name=\"%s\", h=%ld)\n", - OUStringToOString( aFont.GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), - aFont.GetSize().Height() ); -#endif - if ( !maFont.IsSameInstance( aFont ) ) { // Optimization MT/HDU: COL_TRANSPARENT means SetFont should ignore the font color, @@ -5143,7 +5159,7 @@ void OutputDevice::SetFont( const Font& rNewFont ) void OutputDevice::SetLayoutMode( sal_uLong nTextLayoutMode ) { - DBG_TRACE( "OutputDevice::SetTextLayoutMode()" ); + OSL_TRACE( "OutputDevice::SetTextLayoutMode()" ); if( mpMetaFile ) mpMetaFile->AddAction( new MetaLayoutModeAction( nTextLayoutMode ) ); @@ -5158,7 +5174,7 @@ void OutputDevice::SetLayoutMode( sal_uLong nTextLayoutMode ) void OutputDevice::SetDigitLanguage( LanguageType eTextLanguage ) { - DBG_TRACE( "OutputDevice::SetTextLanguage()" ); + OSL_TRACE( "OutputDevice::SetTextLanguage()" ); if( mpMetaFile ) mpMetaFile->AddAction( new MetaTextLanguageAction( eTextLanguage ) ); @@ -5173,7 +5189,7 @@ void OutputDevice::SetDigitLanguage( LanguageType eTextLanguage ) void OutputDevice::SetTextColor( const Color& rColor ) { - DBG_TRACE( "OutputDevice::SetTextColor()" ); + OSL_TRACE( "OutputDevice::SetTextColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -5219,7 +5235,7 @@ void OutputDevice::SetTextColor( const Color& rColor ) void OutputDevice::SetTextFillColor() { - DBG_TRACE( "OutputDevice::SetTextFillColor()" ); + OSL_TRACE( "OutputDevice::SetTextFillColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5238,7 +5254,7 @@ void OutputDevice::SetTextFillColor() void OutputDevice::SetTextFillColor( const Color& rColor ) { - DBG_TRACE( "OutputDevice::SetTextFillColor()" ); + OSL_TRACE( "OutputDevice::SetTextFillColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -5302,7 +5318,7 @@ Color OutputDevice::GetTextFillColor() const void OutputDevice::SetTextLineColor() { - DBG_TRACE( "OutputDevice::SetTextLineColor()" ); + OSL_TRACE( "OutputDevice::SetTextLineColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5318,7 +5334,7 @@ void OutputDevice::SetTextLineColor() void OutputDevice::SetTextLineColor( const Color& rColor ) { - DBG_TRACE( "OutputDevice::SetTextLineColor()" ); + OSL_TRACE( "OutputDevice::SetTextLineColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -5361,7 +5377,7 @@ void OutputDevice::SetTextLineColor( const Color& rColor ) void OutputDevice::SetOverlineColor() { - DBG_TRACE( "OutputDevice::SetOverlineColor()" ); + OSL_TRACE( "OutputDevice::SetOverlineColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5377,7 +5393,7 @@ void OutputDevice::SetOverlineColor() void OutputDevice::SetOverlineColor( const Color& rColor ) { - DBG_TRACE( "OutputDevice::SetOverlineColor()" ); + OSL_TRACE( "OutputDevice::SetOverlineColor()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); @@ -5421,7 +5437,7 @@ void OutputDevice::SetOverlineColor( const Color& rColor ) void OutputDevice::SetTextAlign( TextAlign eAlign ) { - DBG_TRACE( "OutputDevice::SetTextAlign()" ); + OSL_TRACE( "OutputDevice::SetTextAlign()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5445,7 +5461,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth, FontUnderline eOverline, sal_Bool bUnderlineAbove ) { - DBG_TRACE( "OutputDevice::DrawTextLine()" ); + OSL_TRACE( "OutputDevice::DrawTextLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5496,7 +5512,7 @@ sal_Bool OutputDevice::IsTextUnderlineAbove( const Font& rFont ) void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos, sal_uInt16 nStyle ) { - DBG_TRACE( "OutputDevice::DrawWaveLine()" ); + OSL_TRACE( "OutputDevice::DrawWaveLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) @@ -5575,7 +5591,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const String& rStr, pDisplayText = &mpOutDevData->mpRecordLayout->m_aDisplayText; } - DBG_TRACE( "OutputDevice::DrawText()" ); + OSL_TRACE( "OutputDevice::DrawText()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); #if OSL_DEBUG_LEVEL > 2 @@ -5651,7 +5667,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const String& rStr, long OutputDevice::GetTextWidth( const String& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const { - DBG_TRACE( "OutputDevice::GetTextWidth()" ); + OSL_TRACE( "OutputDevice::GetTextWidth()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); long nWidth = GetTextArray( rStr, NULL, nIndex, nLen ); @@ -5662,7 +5678,7 @@ long OutputDevice::GetTextWidth( const String& rStr, long OutputDevice::GetTextHeight() const { - DBG_TRACE( "OutputDevice::GetTextHeight()" ); + OSL_TRACE( "OutputDevice::GetTextHeight()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( mbNewFont ) @@ -5686,7 +5702,7 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr, const sal_Int32* pDXAry, xub_StrLen nIndex, xub_StrLen nLen ) { - DBG_TRACE( "OutputDevice::DrawTextArray()" ); + OSL_TRACE( "OutputDevice::DrawTextArray()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -5717,7 +5733,7 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr, long OutputDevice::GetTextArray( const String& rStr, sal_Int32* pDXAry, xub_StrLen nIndex, xub_StrLen nLen ) const { - DBG_TRACE( "OutputDevice::GetTextArray()" ); + OSL_TRACE( "OutputDevice::GetTextArray()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( nIndex >= rStr.Len() ) @@ -5766,7 +5782,7 @@ bool OutputDevice::GetCaretPositions( const XubString& rStr, sal_Int32* pCaretXA sal_Int32* pDXAry, long nLayoutWidth, sal_Bool bCellBreaking ) const { - DBG_TRACE( "OutputDevice::GetCaretPositions()" ); + OSL_TRACE( "OutputDevice::GetCaretPositions()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( nIndex >= rStr.Len() ) @@ -5834,7 +5850,7 @@ void OutputDevice::DrawStretchText( const Point& rStartPt, sal_uLong nWidth, const String& rStr, xub_StrLen nIndex, xub_StrLen nLen ) { - DBG_TRACE( "OutputDevice::DrawStretchText()" ); + OSL_TRACE( "OutputDevice::DrawStretchText()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -6087,6 +6103,58 @@ SalLayout* OutputDevice::ImplLayout( const String& rOrigStr, return pSalLayout; } +void OutputDevice::forceFallbackFontToFit(SalLayout &rFallback, ImplFontEntry &rFallbackFont, + ImplFontSelectData &rFontSelData, int nFallbackLevel, + ImplLayoutArgs& rLayoutArgs, const ImplFontMetricData& rOrigMetric) const +{ + Rectangle aBoundRect; + bool bHaveBounding = false; + Rectangle aRectangle; + + rFallback.AdjustLayout( rLayoutArgs ); + + //All we care about here is getting the vertical bounds of this text and + //make sure it will fit inside the available space + Point aPos; + for( int nStart = 0;;) + { + sal_GlyphId nLGlyph; + if( !rFallback.GetNextGlyphs( 1, &nLGlyph, aPos, nStart ) ) + break; + + sal_GlyphId nFontTag = nFallbackLevel << GF_FONTSHIFT; + nLGlyph |= nFontTag; + + // get bounding rectangle of individual glyph + if( mpGraphics->GetGlyphBoundRect( nLGlyph, aRectangle ) ) + { + // merge rectangle + aRectangle += aPos; + aBoundRect.Union( aRectangle ); + bHaveBounding = true; + } + } + + //Shrink it down if it won't fit + if (bHaveBounding) + { + long nGlyphsAscent = -aBoundRect.Top(); + float fScaleTop = nGlyphsAscent > rOrigMetric.mnAscent ? + rOrigMetric.mnAscent/(float)nGlyphsAscent : 1; + long nGlyphsDescent = aBoundRect.Bottom(); + float fScaleBottom = nGlyphsDescent > rOrigMetric.mnDescent ? + rOrigMetric.mnDescent/(float)nGlyphsDescent : 1; + float fScale = fScaleBottom < fScaleTop ? fScaleBottom : fScaleTop; + if (fScale < 1) + { + long nOrigHeight = rFontSelData.mnHeight; + rFontSelData.mnHeight = static_cast<int>(static_cast<float>(rFontSelData.mnHeight) * fScale); + rFallbackFont.mnSetFontFlags = mpGraphics->SetFont( &rFontSelData, nFallbackLevel ); + rFontSelData.mnHeight = nOrigHeight; + } + } +} + // ----------------------------------------------------------------------- SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLayoutArgs& rLayoutArgs ) const @@ -6097,17 +6165,6 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay rLayoutArgs.PrepareFallback(); rLayoutArgs.mnFlags |= SAL_LAYOUT_FOR_FALLBACK; -#if defined(HDU_DEBUG) - { - int nCharPos = -1; - bool bRTL = false; - fprintf(stderr,"OD:ImplLayout Glyph Fallback for"); - for( int i=0; i<8 && rLayoutArgs.GetNextPos( &nCharPos, &bRTL); ++i ) - fprintf(stderr," U+%04X", rLayoutArgs.mpStr[ nCharPos ] ); - fprintf(stderr,"\n"); - rLayoutArgs.ResetPos(); - } -#endif // get list of unicodes that need glyph fallback int nCharPos = -1; bool bRTL = false; @@ -6156,38 +6213,7 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay } } -#if defined(HDU_DEBUG) - { - ByteString aOrigFontName( maFont.GetName(), RTL_TEXTENCODING_UTF8); - ByteString aFallbackName( aFontSelData.mpFontData->GetFamilyName(), - RTL_TEXTENCODING_UTF8); - fprintf(stderr,"\tGlyphFallback[lvl=%d] \"%s\" -> \"%s\" (q=%d)\n", - nFallbackLevel, aOrigFontName.GetBuffer(), aFallbackName.GetBuffer(), - aFontSelData.mpFontData->GetQuality()); - } -#endif - - // TODO: try to get the metric data from the GFB's mpFontEntry - ImplFontMetricData aSubstituteMetric( aFontSelData ); pFallbackFont->mnSetFontFlags = mpGraphics->SetFont( &aFontSelData, nFallbackLevel ); - mpGraphics->GetFontMetric( &aSubstituteMetric, nFallbackLevel ); - - const long nOriginalHeight = aOrigMetric.mnAscent + aOrigMetric.mnDescent; - const long nSubstituteHeight = aSubstituteMetric.mnAscent + aSubstituteMetric.mnDescent; - // Too tall, shrink it a bit. Need a better calculation to include extra - // factors and any extra wriggle room we might have available? - // TODO: should we scale by max-ascent/max-descent instead of design height? - if( nSubstituteHeight > nOriginalHeight ) - { - const float fScale = nOriginalHeight / (float)nSubstituteHeight; - const float fOrigHeight = aFontSelData.mfExactHeight; - const int nOrigHeight = aFontSelData.mnHeight; - aFontSelData.mfExactHeight *= fScale; - aFontSelData.mnHeight = static_cast<int>(aFontSelData.mfExactHeight); - pFallbackFont->mnSetFontFlags = mpGraphics->SetFont( &aFontSelData, nFallbackLevel ); - aFontSelData.mnHeight = nOrigHeight; - aFontSelData.mfExactHeight = fOrigHeight; - } // create and add glyph fallback layout to multilayout rLayoutArgs.ResetPos(); @@ -6196,6 +6222,9 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay { if( pFallback->LayoutText( rLayoutArgs ) ) { + forceFallbackFontToFit(*pFallback, *pFallbackFont, aFontSelData, + nFallbackLevel, rLayoutArgs, aOrigMetric); + if( !pMultiSalLayout ) pMultiSalLayout = new MultiSalLayout( *pSalLayout ); pMultiSalLayout->AddFallback( *pFallback, @@ -6247,7 +6276,7 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth, xub_StrLen nIndex, xub_StrLen nLen, long nCharExtra, sal_Bool /*TODO: bCellBreaking*/ ) const { - DBG_TRACE( "OutputDevice::GetTextBreak()" ); + OSL_TRACE( "OutputDevice::GetTextBreak()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen ); @@ -6283,7 +6312,7 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth, xub_StrLen nIndex, xub_StrLen nLen, long nCharExtra ) const { - DBG_TRACE( "OutputDevice::GetTextBreak()" ); + OSL_TRACE( "OutputDevice::GetTextBreak()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); rHyphenatorPos = STRING_LEN; @@ -6617,7 +6646,7 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, sal_uInt16 nStyle, GDIMetaFile& rMtf ) { - DBG_TRACE( "OutputDevice::AddTextRectActions( const Rectangle& )" ); + OSL_TRACE( "OutputDevice::AddTextRectActions( const Rectangle& )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( !rOrigStr.Len() || rRect.IsEmpty() ) @@ -6659,7 +6688,7 @@ void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, sal pDisplayText = &mpOutDevData->mpRecordLayout->m_aDisplayText; } - DBG_TRACE( "OutputDevice::DrawText( const Rectangle& )" ); + OSL_TRACE( "OutputDevice::DrawText( const Rectangle& )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); bool bDecomposeTextRectAction = ( _pTextLayout != NULL ) && _pTextLayout->DecomposeTextRectAction(); @@ -6702,7 +6731,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, TextRectInfo* pInfo, const ::vcl::ITextLayout* _pTextLayout ) const { - DBG_TRACE( "OutputDevice::GetTextRect()" ); + OSL_TRACE( "OutputDevice::GetTextRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Rectangle aRect = rRect; @@ -6841,7 +6870,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rOrigStr, long nMaxWidth, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout ) { - DBG_TRACE( "OutputDevice::ImplGetEllipsisString()" ); + OSL_TRACE( "OutputDevice::ImplGetEllipsisString()" ); String aStr = rOrigStr; xub_StrLen nIndex = _rLayout.GetTextBreak( aStr, nMaxWidth, 0, aStr.Len() ); @@ -6974,7 +7003,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen, sal_uInt16 nStyle, MetricVector* pVector, String* pDisplayText ) { - DBG_TRACE( "OutputDevice::DrawCtrlText()" ); + OSL_TRACE( "OutputDevice::DrawCtrlText()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( !IsDeviceOutputNecessary() || (nIndex >= rStr.Len()) ) @@ -7107,7 +7136,7 @@ long OutputDevice::GetCtrlTextWidth( const String& rStr, xub_StrLen nIndex, xub_StrLen nLen, sal_uInt16 nStyle ) const { - DBG_TRACE( "OutputDevice::GetCtrlTextSize()" ); + OSL_TRACE( "OutputDevice::GetCtrlTextSize()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( nStyle & TEXT_DRAW_MNEMONIC ) @@ -7166,7 +7195,7 @@ String OutputDevice::GetNonMnemonicString( const String& rStr, xub_StrLen& rMnem int OutputDevice::GetDevFontCount() const { - DBG_TRACE( "OutputDevice::GetDevFontCount()" ); + OSL_TRACE( "OutputDevice::GetDevFontCount()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( !mpGetDevFontList ) @@ -7178,7 +7207,7 @@ int OutputDevice::GetDevFontCount() const FontInfo OutputDevice::GetDevFont( int nDevFontIndex ) const { - DBG_TRACE( "OutputDevice::GetDevFont()" ); + OSL_TRACE( "OutputDevice::GetDevFont()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); FontInfo aFontInfo; @@ -7210,7 +7239,7 @@ FontInfo OutputDevice::GetDevFont( int nDevFontIndex ) const sal_Bool OutputDevice::AddTempDevFont( const String& rFileURL, const String& rFontName ) { - DBG_TRACE( "OutputDevice::AddTempDevFont()" ); + OSL_TRACE( "OutputDevice::AddTempDevFont()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); ImplInitFontList(); @@ -7233,7 +7262,7 @@ sal_Bool OutputDevice::AddTempDevFont( const String& rFileURL, const String& rFo int OutputDevice::GetDevFontSizeCount( const Font& rFont ) const { - DBG_TRACE( "OutputDevice::GetDevFontSizeCount()" ); + OSL_TRACE( "OutputDevice::GetDevFontSizeCount()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); delete mpGetDevSizeList; @@ -7247,7 +7276,7 @@ int OutputDevice::GetDevFontSizeCount( const Font& rFont ) const Size OutputDevice::GetDevFontSize( const Font& rFont, int nSizeIndex ) const { - DBG_TRACE( "OutputDevice::GetDevFontSize()" ); + OSL_TRACE( "OutputDevice::GetDevFontSize()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); // check range @@ -7282,7 +7311,7 @@ Size OutputDevice::GetDevFontSize( const Font& rFont, int nSizeIndex ) const sal_Bool OutputDevice::IsFontAvailable( const String& rFontName ) const { - DBG_TRACE( "OutputDevice::IsFontAvailable()" ); + OSL_TRACE( "OutputDevice::IsFontAvailable()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); ImplDevFontListData* pFound = mpFontList->FindFontFamily( rFontName ); @@ -7293,7 +7322,7 @@ sal_Bool OutputDevice::IsFontAvailable( const String& rFontName ) const FontMetric OutputDevice::GetFontMetric() const { - DBG_TRACE( "OutputDevice::GetFontMetric()" ); + OSL_TRACE( "OutputDevice::GetFontMetric()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); FontMetric aMetric; @@ -7401,7 +7430,7 @@ SystemFontData OutputDevice::GetSysFontData(int nFallbacklevel) const SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen, const sal_Int32* pDXAry) const { - DBG_TRACE( "OutputDevice::GetSysTextLayoutData()" ); + OSL_TRACE( "OutputDevice::GetSysTextLayoutData()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); SystemTextLayoutData aSysLayoutData; @@ -7449,7 +7478,7 @@ SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, c long OutputDevice::GetMinKashida() const { - DBG_TRACE( "OutputDevice::GetMinKashida()" ); + OSL_TRACE( "OutputDevice::GetMinKashida()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( mbNewFont && !ImplNewFont() ) return 0; @@ -7502,7 +7531,7 @@ xub_StrLen OutputDevice::ValidateKashidas ( const String& rTxt, // TODO: best is to get rid of this method completely sal_uLong OutputDevice::GetKerningPairCount() const { - DBG_TRACE( "OutputDevice::GetKerningPairCount()" ); + OSL_TRACE( "OutputDevice::GetKerningPairCount()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( mbNewFont && !ImplNewFont() ) @@ -7528,7 +7557,7 @@ inline bool CmpKernData( const KerningPair& a, const KerningPair& b ) // TODO: best is to get rid of this method completely void OutputDevice::GetKerningPairs( sal_uLong nRequestedPairs, KerningPair* pKernPairs ) const { - DBG_TRACE( "OutputDevice::GetKerningPairs()" ); + OSL_TRACE( "OutputDevice::GetKerningPairs()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( mbNewFont && !ImplNewFont() ) @@ -7551,7 +7580,7 @@ void OutputDevice::GetKerningPairs( sal_uLong nRequestedPairs, KerningPair* pKer sal_Bool OutputDevice::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) { - DBG_TRACE( "OutputDevice::GetGlyphBoundRect_CTL()" ); + OSL_TRACE( "OutputDevice::GetGlyphBoundRect_CTL()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); rVector.clear(); @@ -7577,7 +7606,7 @@ sal_Bool OutputDevice::GetTextBoundRect( Rectangle& rRect, const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, xub_StrLen nLen, sal_uLong nLayoutWidth, const sal_Int32* pDXAry ) const { - DBG_TRACE( "OutputDevice::GetTextBoundRect()" ); + OSL_TRACE( "OutputDevice::GetTextBoundRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); sal_Bool bRet = sal_False; @@ -8024,6 +8053,22 @@ sal_Bool OutputDevice::GetTextOutline( PolyPolygon& rPolyPoly, return sal_True; } +bool OutputDevice::GetFontCapabilities( FontCapabilities& rFontCapabilities ) const +{ + // we need a graphics + if( !mpGraphics && !ImplGetGraphics() ) + return false; + + if( mbNewFont ) + ImplNewFont(); + if( mbInitFont ) + ImplInitFont(); + if( !mpFontEntry ) + return false; + + return mpGraphics->GetImplFontCapabilities(rFontCapabilities); +} + // ----------------------------------------------------------------------- sal_Bool OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const @@ -8117,3 +8162,5 @@ xub_StrLen OutputDevice::HasGlyphs( const Font& rTempFont, const String& rStr, } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx index 84fc4fd7c524..f3828761bd6f 100644 --- a/vcl/source/gdi/outdev4.cxx +++ b/vcl/source/gdi/outdev4.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -175,42 +176,25 @@ void OutputDevice::ImplDrawLinearGradient( const Rectangle& rRect, sal_Bool bMtf, const PolyPolygon* pClipPolyPoly ) { // rotiertes BoundRect ausrechnen - Rectangle aRect = rRect; - aRect.Left()--; - aRect.Top()--; - aRect.Right()++; - aRect.Bottom()++; - sal_uInt16 nAngle = rGradient.GetAngle() % 3600; - double fAngle = nAngle * F_PI1800; - double fWidth = aRect.GetWidth(); - double fHeight = aRect.GetHeight(); - double fDX = fWidth * fabs( cos( fAngle ) ) + - fHeight * fabs( sin( fAngle ) ); - double fDY = fHeight * fabs( cos( fAngle ) ) + - fWidth * fabs( sin( fAngle ) ); - fDX = (fDX - fWidth) * 0.5 + 0.5; - fDY = (fDY - fHeight) * 0.5 + 0.5; - aRect.Left() -= (long)fDX; - aRect.Right() += (long)fDX; - aRect.Top() -= (long)fDY; - aRect.Bottom() += (long)fDY; + Rectangle aRect; + Point aCenter; + sal_uInt16 nAngle = rGradient.GetAngle() % 3600; + + rGradient.GetBoundRect( rRect, aRect, aCenter ); // Rand berechnen und Rechteck neu setzen - Point aCenter = rRect.Center(); Rectangle aFullRect = aRect; long nBorder = (long)rGradient.GetBorder() * aRect.GetHeight() / 100; - sal_Bool bLinear; // Rand berechnen und Rechteck neu setzen fuer linearen Farbverlauf - if ( rGradient.GetStyle() == GRADIENT_LINEAR ) + bool bLinear = (rGradient.GetStyle() == GRADIENT_LINEAR); + if ( bLinear ) { - bLinear = sal_True; aRect.Top() += nBorder; } // Rand berechnen und Rechteck neu setzen fuer axiale Farbverlauf else { - bLinear = sal_False; nBorder >>= 1; aRect.Top() += nBorder; @@ -430,7 +414,8 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, // Virtuelle Device werden auch ausgeklammert, da einige Treiber // ansonsten zu langsam sind PolyPolygon* pPolyPoly; - Rectangle aRect( rRect ); + Rectangle aRect; + Point aCenter; Color aStartCol( rGradient.GetStartColor() ); Color aEndCol( rGradient.GetEndColor() ); long nStartRed = ( (long) aStartCol.GetRed() * rGradient.GetStartIntensity() ) / 100; @@ -445,66 +430,13 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, long nStepCount = rGradient.GetSteps(); sal_uInt16 nAngle = rGradient.GetAngle() % 3600; + rGradient.GetBoundRect( rRect, aRect, aCenter ); + if( (meRasterOp != ROP_OVERPAINT) || (meOutDevType != OUTDEV_WINDOW) || bMtf ) pPolyPoly = new PolyPolygon( 2 ); else pPolyPoly = NULL; - if( rGradient.GetStyle() == GRADIENT_SQUARE || rGradient.GetStyle() == GRADIENT_RECT ) - { - const double fAngle = nAngle * F_PI1800; - const double fWidth = aRect.GetWidth(); - const double fHeight = aRect.GetHeight(); - double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) ); - double fDY = fHeight * fabs( cos( fAngle ) ) + fWidth * fabs( sin( fAngle ) ); - - fDX = ( fDX - fWidth ) * 0.5 + 0.5; - fDY = ( fDY - fHeight ) * 0.5 + 0.5; - - aRect.Left() -= (long) fDX; - aRect.Right() += (long) fDX; - aRect.Top() -= (long) fDY; - aRect.Bottom() += (long) fDY; - } - - Size aSize( aRect.GetSize() ); - - if( rGradient.GetStyle() == GRADIENT_RADIAL ) - { - // Radien-Berechnung fuer Kreis - aSize.Width() = (long)(0.5 + sqrt((double)aSize.Width()*(double)aSize.Width() + (double)aSize.Height()*(double)aSize.Height())); - aSize.Height() = aSize.Width(); - } - else if( rGradient.GetStyle() == GRADIENT_ELLIPTICAL ) - { - // Radien-Berechnung fuer Ellipse - aSize.Width() = (long)( 0.5 + (double) aSize.Width() * 1.4142 ); - aSize.Height() = (long)( 0.5 + (double) aSize.Height() * 1.4142 ); - } - else if( rGradient.GetStyle() == GRADIENT_SQUARE ) - { - if ( aSize.Width() > aSize.Height() ) - aSize.Height() = aSize.Width(); - else - aSize.Width() = aSize.Height(); - } - - // neue Mittelpunkte berechnen - long nZWidth = aRect.GetWidth() * (long) rGradient.GetOfsX() / 100; - long nZHeight = aRect.GetHeight() * (long) rGradient.GetOfsY() / 100; - long nBorderX = (long) rGradient.GetBorder() * aSize.Width() / 100; - long nBorderY = (long) rGradient.GetBorder() * aSize.Height() / 100; - Point aCenter( aRect.Left() + nZWidth, aRect.Top() + nZHeight ); - - // Rand beruecksichtigen - aSize.Width() -= nBorderX; - aSize.Height() -= nBorderY; - - // Ausgaberechteck neu setzen - aRect.Left() = aCenter.X() - ( aSize.Width() >> 1 ); - aRect.Top() = aCenter.Y() - ( aSize.Height() >> 1 ); - - aRect.SetSize( aSize ); long nMinRect = Min( aRect.GetWidth(), aRect.GetHeight() ); // Anzahl der Schritte berechnen, falls nichts uebergeben wurde @@ -675,7 +607,7 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, void OutputDevice::DrawGradient( const Rectangle& rRect, const Gradient& rGradient ) { - DBG_TRACE( "OutputDevice::DrawGradient()" ); + OSL_TRACE( "OutputDevice::DrawGradient()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rGradient, Gradient, NULL ); @@ -806,7 +738,7 @@ void OutputDevice::DrawGradient( const Rectangle& rRect, void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient ) { - DBG_TRACE( "OutputDevice::DrawGradient()" ); + OSL_TRACE( "OutputDevice::DrawGradient()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKOBJ( &rGradient, Gradient, NULL ); @@ -1073,7 +1005,7 @@ void OutputDevice::AddGradientActions( const Rectangle& rRect, const Gradient& r void OutputDevice::DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch ) { - DBG_TRACE( "OutputDevice::DrawHatch()" ); + OSL_TRACE( "OutputDevice::DrawHatch()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Hatch aHatch( rHatch ); @@ -1420,3 +1352,5 @@ void OutputDevice::ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPol } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev5.cxx b/vcl/source/gdi/outdev5.cxx index 0a28203dbdfd..fcf32aff87e6 100644 --- a/vcl/source/gdi/outdev5.cxx +++ b/vcl/source/gdi/outdev5.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,7 +52,7 @@ DBG_NAMEEX( OutputDevice ) void OutputDevice::DrawRect( const Rectangle& rRect, sal_uLong nHorzRound, sal_uLong nVertRound ) { - DBG_TRACE( "OutputDevice::DrawRoundRect()" ); + OSL_TRACE( "OutputDevice::DrawRoundRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -110,7 +111,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect, void OutputDevice::DrawEllipse( const Rectangle& rRect ) { - DBG_TRACE( "OutputDevice::DrawEllipse()" ); + OSL_TRACE( "OutputDevice::DrawEllipse()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -161,7 +162,7 @@ void OutputDevice::DrawEllipse( const Rectangle& rRect ) void OutputDevice::DrawArc( const Rectangle& rRect, const Point& rStartPt, const Point& rEndPt ) { - DBG_TRACE( "OutputDevice::DrawArc()" ); + OSL_TRACE( "OutputDevice::DrawArc()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -208,7 +209,7 @@ void OutputDevice::DrawArc( const Rectangle& rRect, void OutputDevice::DrawPie( const Rectangle& rRect, const Point& rStartPt, const Point& rEndPt ) { - DBG_TRACE( "OutputDevice::DrawPie()" ); + OSL_TRACE( "OutputDevice::DrawPie()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -262,7 +263,7 @@ void OutputDevice::DrawPie( const Rectangle& rRect, void OutputDevice::DrawChord( const Rectangle& rRect, const Point& rStartPt, const Point& rEndPt ) { - DBG_TRACE( "OutputDevice::DrawChord()" ); + OSL_TRACE( "OutputDevice::DrawChord()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) @@ -310,3 +311,5 @@ void OutputDevice::DrawChord( const Rectangle& rRect, if( mpAlphaVDev ) mpAlphaVDev->DrawChord( rRect, rStartPt, rEndPt ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index 4e02681841d2..dd2d30642d25 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,7 +63,7 @@ DBG_NAMEEX( OutputDevice ) void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ) { - DBG_TRACE( "OutputDevice::DrawGrid()" ); + OSL_TRACE( "OutputDevice::DrawGrid()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() ); @@ -161,7 +162,7 @@ void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLon void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency) { - DBG_TRACE( "OutputDevice::DrawTransparent(B2D&,transparency)" ); + OSL_TRACE( "OutputDevice::DrawTransparent(B2D&,transparency)" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); // AW: Do NOT paint empty PolyPolygons @@ -211,17 +212,8 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, if( bDrawnOk ) { -#if 0 - // MetaB2DPolyPolygonAction is not implemented yet: - // according to AW adding it is very dangerous since there is a lot - // of code that uses the metafile actions directly and unless every - // place that does this knows about the new action we need to fallback - if( mpMetaFile ) - mpMetaFile->AddAction( new MetaB2DPolyPolygonAction( rB2DPolyPoly ) ); -#else if( mpMetaFile ) mpMetaFile->AddAction( new MetaTransparentAction( PolyPolygon( rB2DPolyPoly ), static_cast< sal_uInt16 >(fTransparency * 100.0))); -#endif return; } } @@ -236,7 +228,7 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ) { - DBG_TRACE( "OutputDevice::DrawTransparent()" ); + OSL_TRACE( "OutputDevice::DrawTransparent()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); // short circuit for drawing an opaque polygon @@ -633,7 +625,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize, const Gradient& rTransparenceGradient ) { - DBG_TRACE( "OutputDevice::DrawTransparent()" ); + OSL_TRACE( "OutputDevice::DrawTransparent()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); const Color aBlack( COL_BLACK ); @@ -722,6 +714,8 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, pVDev->EnableMapMode(false); const AlphaMask aAlpha(pVDev->GetBitmap(aPoint, pVDev->GetOutputSizePixel())); + delete pVDev; + // draw masked content to target and restore MapMode DrawBitmapEx(aDstRect.TopLeft(), BitmapEx(aPaint, aAlpha)); EnableMapMode(bOrigMapModeEnabled); @@ -1195,7 +1189,7 @@ void OutputDevice::ImplDraw2ColorFrame( const Rectangle& rRect, bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, const GfxLink& rGfxLink, GDIMetaFile* pSubst ) { - DBG_TRACE( "OutputDevice::DrawEPS()" ); + OSL_TRACE( "OutputDevice::DrawEPS()" ); bool bDrawn(true); @@ -1255,7 +1249,7 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, void OutputDevice::DrawRenderGraphic( const Point& rPoint, const Size& rSize, const ::vcl::RenderGraphic& rRenderGraphic ) { - DBG_TRACE( "OutputDevice::DrawRenderGraphic()" ); + OSL_TRACE( "OutputDevice::DrawRenderGraphic()" ); if( mpMetaFile ) mpMetaFile->AddAction( new MetaRenderGraphicAction( rPoint, rSize, rRenderGraphic ) ); @@ -1272,3 +1266,5 @@ void OutputDevice::DrawRenderGraphic( const Point& rPoint, const Size& rSize, mpMetaFile = pOldMetaFile; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx index c31188fc357e..52500a53e24f 100755..100644 --- a/vcl/source/gdi/outdevnative.cxx +++ b/vcl/source/gdi/outdevnative.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -214,12 +215,11 @@ static boost::shared_ptr< ImplControlValue > lcl_transformControlValue( const Im } break; default: - OSL_ENSURE( 0, "unknown ImplControlValue type !" ); + OSL_FAIL( "unknown ImplControlValue type !" ); break; } return aResult; } - sal_Bool OutputDevice::DrawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, @@ -336,3 +336,4 @@ sal_Bool OutputDevice::GetNativeControlRegion( ControlType nType, } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/outmap.cxx b/vcl/source/gdi/outmap.cxx index 72bcd2cc8a14..a7e138361200 100644 --- a/vcl/source/gdi/outmap.cxx +++ b/vcl/source/gdi/outmap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,8 +54,6 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> -#define USE_64BIT_INTS - // ======================================================================= DBG_NAMEEX( OutputDevice ) @@ -175,12 +174,10 @@ static void ImplCalcBigIntThreshold( long nDPIX, long nDPIY, rThresRes.mnThresPixToLogY = (long)(((sal_uLong)LONG_MAX + (sal_uLong)(-nProductY/2)) / nDenomY); } -#ifdef USE_64BIT_INTS rThresRes.mnThresLogToPixX /= 2; rThresRes.mnThresLogToPixY /= 2; rThresRes.mnThresPixToLogX /= 2; rThresRes.mnThresPixToLogY /= 2; -#endif } // ----------------------------------------------------------------------- @@ -284,7 +281,7 @@ static void ImplCalcMapResolution( const MapMode& rMapMode, } break; default: - DBG_ERROR( "unhandled MapUnit" ); + OSL_FAIL( "unhandled MapUnit" ); break; } @@ -384,7 +381,6 @@ static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom, { // To "use" it... (void) nThres; -#ifdef USE_64BIT_INTS #if (SAL_TYPES_SIZEOFLONG < 8) if( (+n < nThres) && (-n < nThres) ) { @@ -412,34 +408,6 @@ static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom, } } return n; -#else // USE_64BIT_INTS - if ( Abs( n ) < nThres ) - { - n *= nDPI * nMapNum; - n += n >= 0 ? nMapDenom/2 : -((nMapDenom-1)/2); - return (n / nMapDenom); - } - else - { - BigInt aTemp( n ); - aTemp *= BigInt( nDPI ); - aTemp *= BigInt( nMapNum ); - - if ( aTemp.IsNeg() ) - { - BigInt aMapScDenom2( (nMapDenom-1)/2 ); - aTemp -= aMapScDenom2; - } - else - { - BigInt aMapScDenom2( nMapDenom/2 ); - aTemp += aMapScDenom2; - } - - aTemp /= BigInt( nMapDenom ); - return (long)aTemp; - } -#endif } // ----------------------------------------------------------------------- @@ -449,7 +417,6 @@ static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom, { // To "use" it... (void) nThres; -#ifdef USE_64BIT_INTS #if (SAL_TYPES_SIZEOFLONG < 8) if( (+n < nThres) && (-n < nThres) ) n = (2 * n * nMapDenom) / (nDPI * nMapNum); @@ -463,59 +430,6 @@ static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom, } if( n < 0 ) --n; else ++n; return (n / 2); -#else // USE_64BIT_INTS - if ( Abs( n ) < nThres ) - { - long nDenom = nDPI * nMapNum; - long nNum = n * nMapDenom; - if( (nNum ^ nDenom) >= 0 ) - nNum += nDenom/2; - else - nNum -= nDenom/2; - return (nNum / nDenom); - } - else - { - BigInt aDenom( nDPI ); - aDenom *= BigInt( nMapNum ); - - BigInt aNum( n ); - aNum *= BigInt( nMapDenom ); - - BigInt aDenom2( aDenom ); - if ( aNum.IsNeg() ) - { - if ( aDenom.IsNeg() ) - { - aDenom2 /= BigInt(2); - aNum += aDenom2; - } - else - { - aDenom2 -= 1; - aDenom2 /= BigInt(2); - aNum -= aDenom2; - } - } - else - { - if ( aDenom.IsNeg() ) - { - aDenom2 += 1; - aDenom2 /= BigInt(2); - aNum -= aDenom2; - } - else - { - aDenom2 /= BigInt(2); - aNum += aDenom2; - } - } - - aNum /= aDenom; - return (long)aNum; - } -#endif } // ----------------------------------------------------------------------- @@ -1949,9 +1863,9 @@ Region OutputDevice::PixelToLogic( const Region& rDeviceRegion, #define ENTER3( eUnitSource, eUnitDest ) \ long nNumerator = 1; \ long nDenominator = 1; \ - DBG_ASSERT( eUnitSource < MAP_LASTENUMDUMMY, "Invalid source map unit"); \ - DBG_ASSERT( eUnitDest < MAP_LASTENUMDUMMY, "Invalid destination map unit"); \ - if( (eUnitSource < MAP_LASTENUMDUMMY) && (eUnitDest < MAP_LASTENUMDUMMY) ) \ + DBG_ASSERT( eUnitSource <= MAP_PIXEL, "nonpermitted source map unit"); \ + DBG_ASSERT( eUnitDest <= MAP_PIXEL, "nonpermitted destination map unit"); \ + if( (eUnitSource <= MAP_PIXEL) && (eUnitDest <= MAP_PIXEL) ) \ { \ nNumerator = aImplNumeratorAry[eUnitSource] * \ aImplDenominatorAry[eUnitDest]; \ @@ -2505,3 +2419,5 @@ long Window::ImplLogicUnitToPixelY( long nY, MapUnit eUnit ) return nY; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index c47b034e1011..868163d5ded8 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -326,7 +327,7 @@ void PageSyncData::PushAction( const OutputDevice& rOutDev, const PDFExtOutDevDa PDFExtOutDevDataSync aSync; aSync.eAct = eAct; if ( pMtf ) - aSync.nIdx = pMtf->GetActionCount(); + aSync.nIdx = pMtf->GetActionSize(); else aSync.nIdx = 0x7fffffff; // sync not possible mActions.push_back( aSync ); @@ -426,7 +427,7 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM } break; } - aBeg++; + ++aBeg; } } break; @@ -437,13 +438,11 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM break; case PDFExtOutDevDataSync::EndGroupGfxLink : { - sal_Int32 nTransparency; Rectangle aOutputRect, aVisibleOutputRect; Graphic aGraphic( mGraphics.front() ); mGraphics.pop_front(); - nTransparency = mParaInts.front(); - mParaInts.pop_front(); + mParaInts.pop_front(); //Transparency aOutputRect = mParaRects.front(); mParaRects.pop_front(); aVisibleOutputRect = mParaRects.front(); @@ -843,3 +842,5 @@ void PDFExtOutDevData::EndGroup( const Graphic& rGraphic, } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdffontcache.cxx b/vcl/source/gdi/pdffontcache.cxx index f0842c6bc1ba..61499fdc24d8 100644 --- a/vcl/source/gdi/pdffontcache.cxx +++ b/vcl/source/gdi/pdffontcache.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -83,3 +84,4 @@ sal_Int32 PDFFontCache::getGlyphWidth( const ImplFontData* pFont, sal_GlyphId nG return nWidth; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdffontcache.hxx b/vcl/source/gdi/pdffontcache.hxx index b9997c1e6fc9..f607f100c52c 100644 --- a/vcl/source/gdi/pdffontcache.hxx +++ b/vcl/source/gdi/pdffontcache.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,3 +80,5 @@ namespace vcl } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index d6c5aed6b52a..481ad2be3aa4 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -429,7 +430,6 @@ sal_Int32 PDFWriter::CreateNamedDest( const rtl::OUString& sDestName, const Rect { return ((PDFWriterImpl*)pImplementation)->createNamedDest( sDestName, rRect, nPageNr, eType ); } -//<--- sal_Int32 PDFWriter::CreateDest( const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) { return ((PDFWriterImpl*)pImplementation)->createDest( rRect, nPageNr, eType ); @@ -578,3 +578,4 @@ void PDFWriter::PlayMetafile( const GDIMetaFile& i_rMTF, const vcl::PDFWriter::P ((PDFWriterImpl*)pImplementation)->playMetafile( i_rMTF, i_pData, i_rPlayContext, NULL); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 95fe0ac6fad8..e315609165c5 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -82,7 +83,14 @@ #include "cppuhelper/implbase1.hxx" using namespace vcl; -using namespace rtl; + +using ::rtl::OUString; +using ::rtl::OUStringToOString; +using ::rtl::OString; +using ::rtl::OStringHash; +using ::rtl::OUStringHash; +using ::rtl::OStringBuffer; +using ::rtl::OUStringBuffer; #if (OSL_DEBUG_LEVEL < 2) #define COMPRESS_PAGES @@ -712,7 +720,7 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWr // find or create a hierarchical field // first find the fully qualified name up to this field aDomain = aFullName.copy( 0, nTokenIndex-1 ); - std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain ); + boost::unordered_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain ); if( it == m_aFieldNameMap.end() ) { // create new hierarchy field @@ -773,7 +781,7 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWr // insert widget into its hierarchy field if( aDomain.getLength() ) { - std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain ); + boost::unordered_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain ); if( it != m_aFieldNameMap.end() ) { OSL_ENSURE( it->second >= 0 && it->second < sal_Int32( m_aWidgets.size() ), "invalid field index" ); @@ -800,11 +808,11 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWr if( ! m_aContext.AllowDuplicateFieldNames ) { - std::hash_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aFullName ); + boost::unordered_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aFullName ); if( it != m_aFieldNameMap.end() ) // not unique { - std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it; + boost::unordered_map< OString, sal_Int32, OStringHash >::const_iterator check_it; OString aTry; sal_Int32 nTry = 2; do @@ -1251,11 +1259,6 @@ bool PDFWriterImpl::PDFPage::emit(sal_Int32 nParentObject ) } aLine.append( "]\n" ); } - #if 0 - // FIXME: implement tab order as Structure Tree - if( m_bHasWidgets && m_pWriter->getVersion() >= PDFWriter::PDF_1_5 ) - aLine.append( " /Tabs /S\n" ); - #endif if( m_aMCIDParents.size() > 0 ) { OStringBuffer aStructParents( 1024 ); @@ -2277,7 +2280,7 @@ ImplDevFontList* PDFWriterImpl::filterDevFontList( ImplDevFontList* pFontList ) // append the PDF builtin fonts if( !m_bIsPDF_A1 && !m_bEmbedStandardFonts) - for( unsigned int i = 0; i < sizeof(m_aBuiltinFonts)/sizeof(m_aBuiltinFonts[0]); i++ ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aBuiltinFonts); i++ ) { ImplFontData* pNewData = new ImplPdfBuiltinFontData( m_aBuiltinFonts[i] ); pFiltered->Add( pNewData ); @@ -2473,7 +2476,7 @@ void PDFWriterImpl::endPage() // sanity check if( m_aOutputStreams.begin() != m_aOutputStreams.end() ) { - DBG_ERROR( "redirection across pages !!!" ); + OSL_FAIL( "redirection across pages !!!" ); m_aOutputStreams.clear(); // leak ! m_aMapMode.SetOrigin( Point() ); } @@ -2724,7 +2727,7 @@ OString PDFWriterImpl::emitStructureAttributes( PDFStructureElement& i_rEle ) } else { - DBG_ERROR( "unresolved link id for Link structure" ); + OSL_FAIL( "unresolved link id for Link structure" ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "unresolved link id %" SAL_PRIdINT32 " for Link structure\n", nLink ); { @@ -2825,7 +2828,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle ) emitStructure( rChild ); else { - DBG_ERROR( "PDFWriterImpl::emitStructure: invalid child structure element" ); + OSL_FAIL( "PDFWriterImpl::emitStructure: invalid child structure element" ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "PDFWriterImpl::emitStructure: invalid child structure elemnt with id %" SAL_PRIdINT32 "\n", *it ); #endif @@ -2834,7 +2837,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle ) } else { - DBG_ERROR( "PDFWriterImpl::emitStructure: invalid child structure id" ); + OSL_FAIL( "PDFWriterImpl::emitStructure: invalid child structure id" ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "PDFWriterImpl::emitStructure: invalid child structure id %" SAL_PRIdINT32 "\n", *it ); #endif @@ -2857,7 +2860,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle ) if( ! m_aRoleMap.empty() ) { aLine.append( "/RoleMap<<" ); - for( std::hash_map<OString,OString,OStringHash>::const_iterator + for( boost::unordered_map<OString,OString,OStringHash>::const_iterator it = m_aRoleMap.begin(); it != m_aRoleMap.end(); ++it ) { aLine.append( '/' ); @@ -3101,7 +3104,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontDa return aRet; } - sal_Int32 nFontObject = 0; sal_Int32 nFontDescriptor = 0; rtl::OString aSubType( "/Type1" ); FontSubsetInfo aInfo; @@ -3164,7 +3166,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontDa } else { - DBG_ERROR( "system font neither embeddable nor subsettable" ); + OSL_FAIL( "system font neither embeddable nor subsettable" ); } // write font descriptor @@ -3199,7 +3201,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontDa "endobj\n\n" ); writeBuffer( aLine.getStr(), aLine.getLength() ); - nFontObject = nObject; aRet[ rEmbed.m_nNormalFontID ] = nObject; } } @@ -3252,7 +3253,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont return aRet; } - sal_Int32 nFontObject = 0; sal_Int32 nStreamObject = 0; sal_Int32 nFontDescriptor = 0; @@ -3370,9 +3370,9 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont throw FontException(); // nLength3 is the rest of the file - excluding any section headers - // nIndex now points to the first of the 512 '0' characters marking the + // nIndex now points before the first of the 512 '0' characters marking the // fixed content portion - sal_Int32 nLength3 = nFontLen - nIndex; + sal_Int32 nLength3 = nFontLen - nIndex - 1; for( it = aSections.begin(); it != aSections.end(); ++it ) { if( *it >= nIndex ) @@ -3668,7 +3668,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont if( nFontDescriptor ) { if( pEncoding ) - nToUnicodeStream = createToUnicodeCMap( nEncoding, &aUnicodes[0], pUnicodesPerGlyph, pEncToUnicodeIndex, sizeof(nEncoding)/sizeof(nEncoding[0]) ); + nToUnicodeStream = createToUnicodeCMap( nEncoding, &aUnicodes[0], pUnicodesPerGlyph, pEncToUnicodeIndex, SAL_N_ELEMENTS(nEncoding) ); // write font object sal_Int32 nObject = createObject(); @@ -3704,8 +3704,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) ) throw FontException(); - nFontObject = nObject; - aRet[ rEmbed.m_nNormalFontID ] = nObject; // write additional encodings @@ -3998,7 +3996,7 @@ sal_Int32 PDFWriterImpl::emitFontDescriptor( const ImplFontData* pFont, FontSubs case FontSubsetInfo::ANY_TYPE1: break; default: - DBG_ERROR( "unknown fonttype in PDF font descriptor" ); + OSL_FAIL( "unknown fonttype in PDF font descriptor" ); return 0; } aLine.append( ' ' ); @@ -4073,7 +4071,7 @@ bool PDFWriterImpl::emitFonts() nGlyphs++; else { - DBG_ERROR( "too many glyphs for subset" ); + OSL_FAIL( "too many glyphs for subset" ); } } FontSubsetInfo aSubsetInfo; @@ -4131,7 +4129,7 @@ bool PDFWriterImpl::emitFonts() else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::CFF_FONT) != 0 ) { // TODO: implement - DBG_ERROR( "PDFWriterImpl does not support CFF-font subsets yet!" ); + OSL_FAIL( "PDFWriterImpl does not support CFF-font subsets yet!" ); } else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::TYPE1_PFB) != 0 ) // TODO: also support PFA? { @@ -4594,7 +4592,6 @@ we check in the following sequence: // extract target file type INetURLObject aDocumentURL( m_aContext.BaseURL ); INetURLObject aTargetURL( rLink.m_aURL ); - sal_Int32 nChangeFileExtensionToPDF = 0; sal_Int32 nSetGoToRMode = 0; sal_Bool bTargetHasPDFExtension = sal_False; INetProtocol eTargetProtocol = aTargetURL.GetProtocol(); @@ -4633,18 +4630,19 @@ we check in the following sequence: { if( m_aContext.ConvertOOoTargetToPDFTarget ) { -//examine the file type (.odm .odt. .odp, odg, ods) + sal_Int32 bChangeFileExtensionToPDF = false; + //examine the file type (.odm .odt. .odp, odg, ods) if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odm" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odt" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odp" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odg" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ods" ) ) ) ) - nChangeFileExtensionToPDF++; - if( nChangeFileExtensionToPDF ) + bChangeFileExtensionToPDF = true; + if( bChangeFileExtensionToPDF ) aTargetURL.setExtension(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf" ) ) ); } //check if extension is pdf, see if GoToR should be forced @@ -4691,7 +4689,9 @@ we check in the following sequence: // and will force the use of URI when the protocol is not file:// if( (aFragment.getLength() > 0 && !bTargetHasPDFExtension) || eTargetProtocol != INET_PROT_FILE ) + { aLine.append( "/URI/URI" ); + } else { aLine.append( "/Launch/F" ); @@ -4702,7 +4702,8 @@ we check in the following sequence: } //fragment are encoded in the same way as in the named destination processing if( nSetGoToRMode ) - {//add the fragment + { + //add the fragment rtl::OUString aURLNoMark = aTargetURL.GetURLNoMark( INetURLObject::DECODE_WITH_CHARSET ); aLine.append("/GoToR"); aLine.append("/F"); @@ -4730,15 +4731,11 @@ we check in the following sequence: aTargetURL.SetMark( aLineLoc.getStr() ); } rtl::OUString aURL = aTargetURL.GetMainURL( bFileSpec ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE ); -// check if we have a URL available, if the string is empty, set it as the original one -// if( aURL.getLength() == 0 ) -// appendLiteralStringEncrypt( rLink.m_aURL , rLink.m_nObject, aLine ); -// else - appendLiteralStringEncrypt( bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL, - INetURLObject::WAS_ENCODED, + appendLiteralStringEncrypt(bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL, + INetURLObject::WAS_ENCODED, bFileSpec ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE ) : - aURL , rLink.m_nObject, aLine, osl_getThreadTextEncoding() ); + aURL , rLink.m_nObject, aLine, osl_getThreadTextEncoding() ); } //<--- i56629 } @@ -5042,22 +5039,6 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr beginRedirect( pListBoxStream, rBox.m_aRect ); OStringBuffer aAppearance( 64 ); -#if 0 - if( ! rWidget.DropDown ) - { - // prepare linewidth for DA string hack, see below - Size aFontSize = lcl_convert( m_aGraphicsStack.front().m_aMapMode, - m_aMapMode, - getReferenceDevice(), - Size( 0, aFont.GetHeight() ) ); - sal_Int32 nLW = aFontSize.Height() / 40; - appendFixedInt( nLW > 0 ? nLW : 1, aAppearance ); - aAppearance.append( " w\n" ); - writeBuffer( aAppearance.getStr(), aAppearance.getLength() ); - aAppearance.setLength( 0 ); - } -#endif - setLineColor( Color( COL_TRANSPARENT ) ); setFillColor( replaceColor( rWidget.BackgroundColor, rSettings.GetFieldColor() ) ); drawRectangle( rBox.m_aRect ); @@ -5073,18 +5054,6 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr // prepare DA string OStringBuffer aDA( 256 ); -#if 0 - if( !rWidget.DropDown ) - { - /* another of AR5's peculiarities: the selected item of a choice - field is highlighted using the non stroking color - same as the - text color. so workaround that by using text rendering mode 2 - (fill, then stroke) and set the stroking color - */ - appendStrokingColor( replaceColor( rWidget.BackgroundColor, rSettings.GetFieldColor() ), aDA ); - aDA.append( " 2 Tr " ); - } -#endif // prepare DA string appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA ); aDA.append( ' ' ); @@ -6660,7 +6629,7 @@ void PDFWriterImpl::sortWidgets() { // sort widget annotations on each page as per their // TabOrder attribute - std::hash_map< sal_Int32, AnnotSortContainer > sorted; + boost::unordered_map< sal_Int32, AnnotSortContainer > sorted; int nWidgets = m_aWidgets.size(); for( int nW = 0; nW < nWidgets; nW++ ) { @@ -6680,7 +6649,7 @@ void PDFWriterImpl::sortWidgets() } } } - for( std::hash_map< sal_Int32, AnnotSortContainer >::iterator it = sorted.begin(); it != sorted.end(); ++it ) + for( boost::unordered_map< sal_Int32, AnnotSortContainer >::iterator it = sorted.begin(); it != sorted.end(); ++it ) { // append entries for non widget annotations PDFPage& rPage = m_aPages[ it->first ]; @@ -7808,7 +7777,6 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, sa XubString aLastLine; ImplMultiTextLineInfo aMultiLineInfo; ImplTextLineInfo* pLineInfo; - long nMaxTextWidth; xub_StrLen i; xub_StrLen nLines; xub_StrLen nFormatLines; @@ -7816,7 +7784,7 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, sa if ( nTextHeight ) { ::vcl::DefaultTextLayout aLayout( *m_pReferenceDevice ); - nMaxTextWidth = OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout ); + OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) @@ -8307,6 +8275,9 @@ void PDFWriterImpl::drawStrikeoutLine( OStringBuffer& aLine, long nWidth, FontSt void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout ) { + //See qadevOOo/testdocs/StrikeThrough.odt for examples if you need + //to tweak this + String aStrikeoutChar = String::CreateFromAscii( eStrikeout == STRIKEOUT_SLASH ? "/" : "X" ); String aStrikeout = aStrikeoutChar; while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth ) @@ -8328,7 +8299,27 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrik // strikeout string is left aligned non-CTL text sal_uLong nOrigTLM = m_pReferenceDevice->GetLayoutMode(); m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED ); + + push( PUSH_CLIPREGION ); + FontMetric aRefDevFontMetric = m_pReferenceDevice->GetFontMetric(); + Rectangle aRect; + aRect.nLeft = rPos.X(); + aRect.nRight = aRect.nLeft+nWidth; + aRect.nBottom = rPos.Y()+aRefDevFontMetric.GetDescent(); + aRect.nTop = rPos.Y()-aRefDevFontMetric.GetAscent(); + + ImplFontEntry* pFontEntry = m_pReferenceDevice->mpFontEntry; + if (pFontEntry->mnOrientation) + { + Polygon aPoly( aRect ); + aPoly.Rotate( rPos, pFontEntry->mnOrientation); + aRect = aPoly.GetBoundRect(); + } + + intersectClipRegion( aRect ); drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false ); + pop(); + m_pReferenceDevice->SetLayoutMode( nOrigTLM ); if ( bShadow ) @@ -9316,11 +9307,6 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) * resource dict anyway, let's use the one from the page by NOT * emitting a Resources entry. */ - #if 0 - aLine.append( " /Resources " ); - aLine.append( getResourceDictObj() ); - aLine.append( " 0 R\n" ); - #endif aLine.append( "/Length " ); aLine.append( (sal_Int32)(nSize) ); @@ -9395,12 +9381,6 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) aMask.append( "]\n" ); /* #i42884# see above */ -#if 0 - aLine.append( "/Resources " ); - aMask.append( getResourceDictObj() ); - aMask.append( " 0 R\n" ); -#endif - aMask.append( "/Group<</S/Transparency/CS/DeviceRGB>>\n" ); aMask.append( "/Length " ); aMask.append( nMaskSize ); @@ -11130,11 +11110,11 @@ sal_Int32 PDFWriterImpl::beginStructureElement( PDFWriter::StructElement eType, DBG_ASSERT( 0, "Structure element inserted to StructTreeRoot that is not a document" ); } else { - DBG_ERROR( "document structure in disorder !" ); + OSL_FAIL( "document structure in disorder !" ); } } else { - DBG_ERROR( "PDF document structure MUST be contained in a Document element" ); + OSL_FAIL( "PDF document structure MUST be contained in a Document element" ); } } @@ -11252,7 +11232,7 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle ) addInternalStructureContainer( rChild );//examine the child else { - DBG_ERROR( "PDFWriterImpl::addInternalStructureContainer: invalid child structure element" ); + OSL_FAIL( "PDFWriterImpl::addInternalStructureContainer: invalid child structure element" ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "PDFWriterImpl::addInternalStructureContainer: invalid child structure elemnt with id %" SAL_PRIdINT32 "\n", *it ); #endif @@ -11261,7 +11241,7 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle ) } else { - DBG_ERROR( "PDFWriterImpl::emitStructure: invalid child structure id" ); + OSL_FAIL( "PDFWriterImpl::emitStructure: invalid child structure id" ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "PDFWriterImpl::addInternalStructureContainer: invalid child structure id %" SAL_PRIdINT32 "\n", *it ); #endif @@ -11764,7 +11744,7 @@ void PDFWriterImpl::ensureUniqueRadioOnValues() { PDFWidget& rGroupWidget = m_aWidgets[ group->second ]; // check whether all kids have a unique OnValue - std::hash_map< OUString, sal_Int32, OUStringHash > aOnValues; + boost::unordered_map< OUString, sal_Int32, OUStringHash > aOnValues; int nChildren = rGroupWidget.m_aKidsIndex.size(); bool bIsUnique = true; for( int nKid = 0; nKid < nChildren && bIsUnique; nKid++ ) @@ -11794,7 +11774,7 @@ void PDFWriterImpl::ensureUniqueRadioOnValues() int nKidIndex = rGroupWidget.m_aKidsIndex[nKid]; PDFWidget& rKid = m_aWidgets[nKidIndex]; rKid.m_aOnValue = OUString::valueOf( sal_Int32(nKid+1) ); - if( ! rKid.m_aValue.equalsAscii( "Off" ) ) + if( ! rKid.m_aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Off" ) ) ) rKid.m_aValue = rKid.m_aOnValue; } } @@ -11821,7 +11801,7 @@ void PDFWriterImpl::ensureUniqueRadioOnValues() #endif } // update selected radio button - if( ! rKid.m_aValue.equalsAscii( "Off" ) ) + if( ! rKid.m_aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Off" ) ) ) { rGroupWidget.m_aValue = rKid.m_aValue; } @@ -11955,7 +11935,7 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa rNewWidget.m_nTextStyle = TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK; - rNewWidget.m_aValue = OUString::createFromAscii( rBox.Checked ? "Yes" : "Off" ); + rNewWidget.m_aValue = rBox.Checked ? OUString(RTL_CONSTASCII_USTRINGPARAM("Yes")) : OUString(RTL_CONSTASCII_USTRINGPARAM("Off" )); // create default appearance before m_aRect gets transformed createDefaultCheckBoxAppearance( rNewWidget, rBox ); } @@ -12154,3 +12134,4 @@ void PDFWriterImpl::addStream( const String& rMimeType, PDFOutputStream* pStream +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 845e95d29270..8649beff6ceb 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,13 +44,14 @@ #include "rtl/digest.h" #include "com/sun/star/util/XURLTransformer.hpp" #include "com/sun/star/lang/Locale.hpp" +#include <sal/macros.h> #include <sallayout.hxx> #include "pdffontcache.hxx" #include <vector> #include <map> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <list> #include <boost/shared_array.hpp> @@ -201,7 +203,7 @@ public: return *this; } - bool operator==( const BitmapID& rComp ) + bool operator==( const BitmapID& rComp ) const { return (m_aPixelSize == rComp.m_aPixelSize && m_nSize == rComp.m_nSize && @@ -228,7 +230,7 @@ public: sal_Int32 m_nObject; bool m_bTrueColor; - JPGEmit() : m_pStream( NULL ) {} + JPGEmit() : m_pStream( NULL ), m_bTrueColor( false ) {} ~JPGEmit() { delete m_pStream; } }; @@ -293,7 +295,7 @@ public: GlyphEmit() : m_nUnicodes(0), m_nSubsetGlyphID(0) { rtl_zeroMemory( m_aBufferedUnicodes, sizeof( m_aBufferedUnicodes ) ); - m_nMaxUnicodes = sizeof(m_aBufferedUnicodes)/sizeof(m_aBufferedUnicodes[0]); + m_nMaxUnicodes = SAL_N_ELEMENTS(m_aBufferedUnicodes); } ~GlyphEmit() { @@ -384,7 +386,6 @@ public: PDFWriter::DestAreaType m_eType; Rectangle m_aRect; }; -//<--- struct PDFOutlineEntry { @@ -439,8 +440,8 @@ public: {} }; - typedef std::hash_map< rtl::OString, SvMemoryStream*, rtl::OStringHash > PDFAppearanceStreams; - typedef std::hash_map< rtl::OString, PDFAppearanceStreams, rtl::OStringHash > PDFAppearanceMap; + typedef boost::unordered_map< rtl::OString, SvMemoryStream*, rtl::OStringHash > PDFAppearanceStreams; + typedef boost::unordered_map< rtl::OString, PDFAppearanceStreams, rtl::OStringHash > PDFAppearanceMap; struct PDFWidget : public PDFAnnotation { @@ -608,7 +609,6 @@ private: destination id is always the destination's position in this vector */ std::vector<PDFNamedDest> m_aNamedDests; - //<--- /* contains all dests ever set during the PDF creation, dest id is always the dest's position in this vector */ @@ -647,7 +647,7 @@ private: bool m_bEmitStructure; bool m_bNewMCID; /* role map of struct tree root */ - std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > + boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aRoleMap; /* contains all widgets used in the PDF @@ -657,8 +657,8 @@ private: std::map< sal_Int32, sal_Int32 > m_aRadioGroupWidgets; /* used to store control id during beginControlAppearance/endControlAppearance */ sal_Int32 m_nCurrentControl; - /* hash_map for field names, used to ensure unique field names */ - std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash > m_aFieldNameMap; + /* boost::unordered_map for field names, used to ensure unique field names */ + boost::unordered_map< rtl::OString, sal_Int32, rtl::OStringHash > m_aFieldNameMap; /* contains Bitmaps for gradient functions until they are written * to the file stream */ @@ -1338,3 +1338,4 @@ public: #endif //_VCL_PDFEXPORT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index b957c57205e8..c1fd5a8c6ca5 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -196,18 +196,18 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz uno::Reference < io::XStream > xStream = new utl::OStreamWrapper( aStrm ); uno::Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW ); uno::Reference< graphic::XGraphicProvider > xGraphicProvider( ImplGetSVData()->maAppData.mxMSF->createInstance( - OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY ); + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")) ), UNO_QUERY ); if ( xGraphicProvider.is() ) { uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() ); uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() ); - rtl::OUString aMimeType( ::rtl::OUString::createFromAscii( "image/jpeg" ) ); + rtl::OUString aMimeType(RTL_CONSTASCII_USTRINGPARAM("image/jpeg")); uno::Sequence< beans::PropertyValue > aOutMediaProperties( 3 ); - aOutMediaProperties[0].Name = ::rtl::OUString::createFromAscii( "OutputStream" ); + aOutMediaProperties[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutputStream")); aOutMediaProperties[0].Value <<= xOut; - aOutMediaProperties[1].Name = ::rtl::OUString::createFromAscii( "MimeType" ); + aOutMediaProperties[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MimeType")); aOutMediaProperties[1].Value <<= aMimeType; - aOutMediaProperties[2].Name = ::rtl::OUString::createFromAscii( "FilterData" ); + aOutMediaProperties[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterData")); aOutMediaProperties[2].Value <<= aFilterData; xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties ); xOut->flush(); @@ -221,13 +221,13 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz xSeekable->seek( 0 ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[ 0 ].Name = ::rtl::OUString::createFromAscii( "InputStream" ); + aArgs[ 0 ].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")); aArgs[ 0 ].Value <<= xStream; uno::Reference< XPropertySet > xPropSet( xGraphicProvider->queryGraphicDescriptor( aArgs ) ); if ( xPropSet.is() ) { sal_Int16 nBitsPerPixel = 24; - if ( xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii( "BitsPerPixel" ) ) >>= nBitsPerPixel ) + if ( xPropSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BitsPerPixel")) ) >>= nBitsPerPixel ) { bTrueColorJPG = nBitsPerPixel != 8; } @@ -268,7 +268,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa } GDIMetaFile aMtf( i_rMtf ); - for( sal_uInt32 i = 0, nCount = aMtf.GetActionCount(); i < nCount; ) + for( sal_uInt32 i = 0, nCount = aMtf.GetActionSize(); i < (sal_uInt32)nCount; ) { if ( !i_pOutDevData || !i_pOutDevData->PlaySyncPageAct( m_rOuterFace, i ) ) { @@ -834,7 +834,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa case( META_MASKSCALE_ACTION ): case( META_MASKSCALEPART_ACTION ): { - DBG_ERROR( "MetaMask...Action not supported yet" ); + OSL_TRACE( "MetaMask...Action not supported yet" ); } break; @@ -1066,7 +1066,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa if( !bAssertionFired ) { bAssertionFired = true; - DBG_ERROR( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" ); + OSL_TRACE( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" ); } break; } diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index ac6116e38234..cd47967f760e 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -157,7 +158,6 @@ private: bool ReadNextChunk(); void ReadRemainingChunks(); - void SkipRemainingChunks(); void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor & ); void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, sal_uInt8 nPalIndex ); @@ -200,7 +200,9 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream ) mpInflateInBuf ( NULL ), mpScanPrior ( NULL ), mpTransTab ( NULL ), + mpScanCurrent ( NULL ), mpColorTable ( (sal_uInt8*) mpDefaultColorTable ), + mnPass ( 0 ), mbzCodecInUse ( sal_False ), mbStatus( sal_True), mbIDAT( sal_False ), @@ -333,30 +335,6 @@ void PNGReaderImpl::ReadRemainingChunks() // ------------------------------------------------------------------------ -// move position of mrPNGStream to the end of the file -void PNGReaderImpl::SkipRemainingChunks() -{ - // nothing to skip if the last chunk was read - if( !maChunkSeq.empty() && (maChunkSeq.back().nType == PNGCHUNK_IEND) ) - return; - - // read from the stream until the IEND chunk is found - const sal_Size nStreamPos = mrPNGStream.Tell(); - while( !mrPNGStream.IsEof() && (mrPNGStream.GetError() == ERRCODE_NONE) ) - { - mrPNGStream >> mnChunkLen >> mnChunkType; - if( mnChunkLen < 0 ) - break; - if( nStreamPos + mnChunkLen >= mnStreamSize ) - break; - mrPNGStream.SeekRel( mnChunkLen + 4 ); // skip data + CRC - if( mnChunkType == PNGCHUNK_IEND ) - break; - } -} - -// ------------------------------------------------------------------------ - const std::vector< vcl::PNGReader::ChunkData >& PNGReaderImpl::GetAllChunks() { ReadRemainingChunks(); @@ -426,7 +404,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint ) sal_uInt32 nYPixelPerMeter = ImplReadsal_uInt32(); sal_uInt8 nUnitSpecifier = *maDataIter++; - if( (nUnitSpecifier == 1) && nXPixelPerMeter && nXPixelPerMeter ) + if( (nUnitSpecifier == 1) && nXPixelPerMeter && nYPixelPerMeter ) { mbpHYs = sal_True; @@ -478,11 +456,6 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint ) aRet.SetPrefSize( maPhysSize ); } -#if 0 - // TODO: make sure nobody depends on the stream being after the IEND chunks - // => let them do ReadChunks before - ReadRemainingChunks(); -#endif } return aRet; @@ -1587,3 +1560,5 @@ void PNGReader::SetIgnoreGammaChunk( sal_Bool b ) } // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index 3d814bea000e..35c0e13908dd 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -119,7 +120,7 @@ private: void ImplWriteChunk( sal_uInt8 nNumb ); void ImplWriteChunk( sal_uInt32 nNumb ); void ImplWriteChunk( unsigned char* pSource, sal_uInt32 nDatSize ); - void ImplCloseChunk( void ); + void ImplCloseChunk( void ) const; }; // ------------------------------------------------------------------------ @@ -148,11 +149,11 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, sal_Int32 i = 0; for ( i = 0; i < pFilterData->getLength(); i++ ) { - if ( (*pFilterData)[ i ].Name.equalsAscii( "Compression" ) ) + if ( (*pFilterData)[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Compression" ) ) ) (*pFilterData)[ i ].Value >>= mnCompLevel; - else if ( (*pFilterData)[ i ].Name.equalsAscii( "Interlaced" ) ) + else if ( (*pFilterData)[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Interlaced" ) ) ) (*pFilterData)[ i ].Value >>= mnInterlaced; - else if ( (*pFilterData)[ i ].Name.equalsAscii( "MaxChunkSize" ) ) + else if ( (*pFilterData)[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MaxChunkSize" ) ) ) { sal_Int32 nVal = 0; if ( (*pFilterData)[ i ].Value >>= nVal ) @@ -185,7 +186,7 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, ImplWriteTransparent(); ImplWriteIDAT(); } - aBmp.ReleaseAccess( mpAccess ); + aBmp.ReleaseAccess( mpAccess ), mpAccess = 0; } else mbStatus = sal_False; @@ -206,7 +207,7 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, ImplWritepHYs( rBmpEx ); ImplWriteIDAT(); } - aMask.ReleaseAccess( mpMaskAccess ); + aMask.ReleaseAccess( mpMaskAccess ), mpMaskAccess = 0; } else mbStatus = sal_False; @@ -222,12 +223,12 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, ImplWritepHYs( rBmpEx ); ImplWriteIDAT(); } - aMask.ReleaseAccess( mpMaskAccess ); + aMask.ReleaseAccess( mpMaskAccess ), mpMaskAccess = 0; } else mbStatus = sal_False; } - aBmp.ReleaseAccess( mpAccess ); + aBmp.ReleaseAccess( mpAccess ), mpAccess = 0; } else mbStatus = sal_False; @@ -246,7 +247,7 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, ImplWriteIDAT(); } - aBmp.ReleaseAccess( mpAccess ); + aBmp.ReleaseAccess( mpAccess ), mpAccess = 0; } else mbStatus = sal_False; @@ -698,7 +699,7 @@ void PNGWriterImpl::ImplWriteChunk ( unsigned char* pSource, sal_uInt32 nDatSize // ------------------------------------------------------------------------ // nothing to do -void PNGWriterImpl::ImplCloseChunk ( void ) +void PNGWriterImpl::ImplCloseChunk ( void ) const { } @@ -735,3 +736,4 @@ std::vector< vcl::PNGWriter::ChunkData >& PNGWriter::GetChunks() } // namespace vcl +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 9d8bee00ef24..4c9461fbcb97 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -339,7 +340,7 @@ ImplPrnQueueList::~ImplPrnQueueList() void ImplPrnQueueList::Add( SalPrinterQueueInfo* pData ) { - std::hash_map< rtl::OUString, sal_Int32, rtl::OUStringHash >::iterator it = + boost::unordered_map< rtl::OUString, sal_Int32, rtl::OUStringHash >::iterator it = m_aNameToIndex.find( pData->maPrinterName ); if( it == m_aNameToIndex.end() ) { @@ -364,7 +365,7 @@ void ImplPrnQueueList::Add( SalPrinterQueueInfo* pData ) ImplPrnQueueData* ImplPrnQueueList::Get( const rtl::OUString& rPrinter ) { ImplPrnQueueData* pData = NULL; - std::hash_map<rtl::OUString,sal_Int32,rtl::OUStringHash>::iterator it = + boost::unordered_map<rtl::OUString,sal_Int32,rtl::OUStringHash>::iterator it = m_aNameToIndex.find( rPrinter ); if( it != m_aNameToIndex.end() ) pData = &m_aQueueInfos[it->second]; @@ -1285,7 +1286,7 @@ rtl::OUString Printer::GetPaperName( Paper ePaper ) ImplSVData* pSVData = ImplGetSVData(); if( ! pSVData->mpPaperNames ) { - pSVData->mpPaperNames = new std::hash_map< int, rtl::OUString >(); + pSVData->mpPaperNames = new boost::unordered_map< int, rtl::OUString >(); if( ImplGetResMgr() ) { ResStringArray aPaperStrings( VclResId( RID_STR_PAPERNAMES ) ); @@ -1305,7 +1306,7 @@ rtl::OUString Printer::GetPaperName( Paper ePaper ) } } - std::hash_map<int,rtl::OUString>::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper ); + boost::unordered_map<int,rtl::OUString>::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper ); return (it != pSVData->mpPaperNames->end()) ? it->second : rtl::OUString(); } @@ -1626,3 +1627,5 @@ void Printer::updatePrinters() delete pNewList; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 4e951fb30d5e..42ef64a48289 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -218,7 +219,7 @@ static void ImplConvertTransparentAction( GDIMetaFile& o_rMtf, case META_TRANSPARENT_ACTION: default: - DBG_ERROR("Printer::GetPreparedMetafile impossible state reached"); + OSL_FAIL("Printer::GetPreparedMetafile impossible state reached"); break; } @@ -288,7 +289,7 @@ static void ImplConvertTransparentAction( GDIMetaFile& o_rMtf, static_cast<const MetaRenderGraphicAction&>(rAct).GetSize(), aBmp )); default: - DBG_ERROR("Unexpected case"); + OSL_FAIL("Unexpected case"); break; } } @@ -651,7 +652,7 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic break; case META_TEXTLINE_ACTION: - DBG_ERROR("META_TEXTLINE_ACTION not supported"); + OSL_FAIL("META_TEXTLINE_ACTION not supported"); break; case( META_RENDERGRAPHIC_ACTION ): @@ -1139,7 +1140,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // settings for all cases. // maps mtf actions to CC list entries - ::std::vector< const ConnectedComponents* > aCCList_MemberMap( rInMtf.GetActionCount() ); + ::std::vector< const ConnectedComponents* > aCCList_MemberMap( rInMtf.GetActionSize() ); // iterate over all aCCList members and their contained metaactions ConnectedComponentsList::iterator aCurr( aCCList.begin() ); @@ -1621,3 +1622,5 @@ void Printer::DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, else pOut->DrawGradient( rPolyPoly, rGradient ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 3bc47e6cf8fb..61a40af43bdd 100755..100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,8 +51,8 @@ #include "com/sun/star/awt/Size.hpp" #include "comphelper/processfactory.hxx" -#include <hash_map> -#include <hash_set> +#include <boost/unordered_map.hpp> +#include <boost/unordered_set.hpp> using namespace com::sun::star; using namespace com::sun::star::uno; @@ -76,13 +77,8 @@ class ImplPageCache { 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; } } @@ -149,9 +145,9 @@ public: ControlDependency() : mnDependsOnEntry( -1 ) {} }; - typedef std::hash_map< rtl::OUString, size_t, rtl::OUStringHash > PropertyToIndexMap; - typedef std::hash_map< rtl::OUString, ControlDependency, rtl::OUStringHash > ControlDependencyMap; - typedef std::hash_map< rtl::OUString, Sequence< sal_Bool >, rtl::OUStringHash > ChoiceDisableMap; + typedef boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash > PropertyToIndexMap; + typedef boost::unordered_map< rtl::OUString, ControlDependency, rtl::OUStringHash > ControlDependencyMap; + typedef boost::unordered_map< rtl::OUString, Sequence< sal_Bool >, rtl::OUStringHash > ChoiceDisableMap; boost::shared_ptr<Printer> mpPrinter; Sequence< PropertyValue > maUIOptions; @@ -254,7 +250,7 @@ static rtl::OUString queryFile( Printer* pPrinter ) // add arbitrary files xFilterMgr->appendFilter( String( VclResId( SV_STDTEXT_ALLFILETYPES ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.*" ) ) ); } - catch( lang::IllegalArgumentException rExc ) + catch( lang::IllegalArgumentException ) { DBG_ERRORFILE( "caught IllegalArgumentException when registering filter\n" ); } @@ -775,21 +771,21 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons sal_Int32 nPaperBin = mnDefaultPaperBin; for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty ) { - if( i_rProps[ nProperty ].Name.equalsAscii( "PreferredPageSize" ) ) + if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PreferredPageSize" ) ) ) { i_rProps[ nProperty ].Value >>= aSetSize; } - else if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) ) + else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PageSize" ) ) ) { i_rProps[ nProperty ].Value >>= aIsSize; } - else if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) ) + else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PageIncludesNonprintableArea" ) ) ) { sal_Bool bVal = sal_False; i_rProps[ nProperty ].Value >>= bVal; aPageSize.bFullPaper = static_cast<bool>(bVal); } - else if( i_rProps[ nProperty ].Name.equalsAscii( "PrinterPaperTray" ) ) + else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrinterPaperTray" ) ) ) { sal_Int32 nBin = -1; i_rProps[ nProperty ].Value >>= nBin; @@ -1235,7 +1231,7 @@ bool PrinterController::getReversePrint() const Sequence< PropertyValue > PrinterController::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const { - std::hash_set< rtl::OUString, rtl::OUStringHash > aMergeSet; + boost::unordered_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 ); @@ -1284,14 +1280,14 @@ const Sequence< beans::PropertyValue >& PrinterController::getUIOptions() const beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty ) { - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + boost::unordered_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 = + boost::unordered_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; } @@ -1321,7 +1317,7 @@ void PrinterController::setValue( const rtl::OUString& i_rName, const Any& i_rVa void PrinterController::setValue( const beans::PropertyValue& i_rValue ) { - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + boost::unordered_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; @@ -1352,7 +1348,7 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ for( int n = 0; n < aOptProp.getLength(); n++ ) { const beans::PropertyValue& rEntry( aOptProp[ n ] ); - if( rEntry.Name.equalsAscii( "Property" ) ) + if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Property" ) ) ) { PropertyValue aVal; rEntry.Value >>= aVal; @@ -1362,17 +1358,17 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ aPropName = aVal.Name; bHaveProperty = true; } - else if( rEntry.Name.equalsAscii( "Enabled" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Enabled" ) ) ) { sal_Bool bValue = sal_True; rEntry.Value >>= bValue; bIsEnabled = bValue; } - else if( rEntry.Name.equalsAscii( "DependsOnName" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnName" ) ) ) { rEntry.Value >>= aDep.maDependsOnName; } - else if( rEntry.Name.equalsAscii( "DependsOnEntry" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnEntry" ) ) ) { rEntry.Value >>= aDep.mnDependsOnEntry; } @@ -1400,7 +1396,7 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ void PrinterController::enableUIOption( const rtl::OUString& i_rProperty, bool i_bEnable ) { - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rProperty ); if( it != mpImplData->maPropertyToIndex.end() ) { @@ -1418,7 +1414,7 @@ void PrinterController::enableUIOption( const rtl::OUString& i_rProperty, bool i 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 = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator prop_it = mpImplData->maPropertyToIndex.find( i_rProperty ); if( prop_it != mpImplData->maPropertyToIndex.end() ) { @@ -1458,7 +1454,7 @@ bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) co else { // if the type does not match something is awry - OSL_ENSURE( 0, "strange type in control dependency" ); + OSL_FAIL( "strange type in control dependency" ); bEnabled = false; } } @@ -1526,7 +1522,7 @@ rtl::OUString PrinterController::makeEnabled( const rtl::OUString& i_rProperty ) else { // if the type does not match something is awry - OSL_ENSURE( 0, "strange type in control dependency" ); + OSL_FAIL( "strange type in control dependency" ); } } } @@ -1639,7 +1635,7 @@ sal_Bool PrinterController::getBoolProperty( const rtl::OUString& i_rProperty, s Any PrinterOptionsHelper::getValue( const rtl::OUString& i_rPropertyName ) const { Any aRet; - std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = m_aPropertyMap.find( i_rPropertyName ); if( it != m_aPropertyMap.end() ) aRet = it->second; @@ -1654,7 +1650,7 @@ void PrinterOptionsHelper::setValue( const rtl::OUString& i_rPropertyName, const bool PrinterOptionsHelper::hasProperty( const rtl::OUString& i_rPropertyName ) const { Any aRet; - std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = m_aPropertyMap.find( i_rPropertyName ); return it != m_aPropertyMap.end(); } @@ -1694,7 +1690,7 @@ bool PrinterOptionsHelper::processProperties( const Sequence< PropertyValue >& i for( sal_Int32 i = 0; i < nElements; i++ ) { bool bElementChanged = false; - std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::iterator it = + boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::iterator it = m_aPropertyMap.find( pVals[ i ].Name ); if( it != m_aPropertyMap.end() ) { @@ -1945,3 +1941,5 @@ Any PrinterOptionsHelper::getEditControlOpt( const rtl::OUString& i_rTitle, i_rControlOptions ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx index 08c94bc2ebc6..1cec295bda93 100644 --- a/vcl/source/gdi/regband.cxx +++ b/vcl/source/gdi/regband.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -165,7 +166,7 @@ void ImplRegionBand::ProcessPoints() while ( pRegionBandPoint ) { // within list? - if ( pRegionBandPoint && pRegionBandPoint->mpNextBandPoint ) + if ( pRegionBandPoint->mpNextBandPoint ) { // start/stop? if ( pRegionBandPoint->mbEndPoint && pRegionBandPoint->mpNextBandPoint->mbEndPoint ) @@ -967,3 +968,5 @@ ImplRegionBand* ImplRegionBand::SplitBand (const sal_Int32 nY) return pLowerBand; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index fe2e0f763e08..3992b774630d 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,10 +34,8 @@ #include <tools/vcompat.hxx> #include <tools/stream.hxx> #include <tools/debug.hxx> - #include <vcl/region.hxx> #include <vcl/regband.hxx> -#include <vcl/salbtype.hxx> #include <region.h> @@ -660,7 +659,7 @@ sal_Bool ImplRegion::InsertPoint( const Point &rPoint, long nLineID, mpLastCheckedBand = mpLastCheckedBand->mpNextBand; } - DBG_ERROR( "ImplRegion::InsertPoint reached the end of the list!" ); + OSL_FAIL( "ImplRegion::InsertPoint reached the end of the list!" ); } else { @@ -677,10 +676,10 @@ sal_Bool ImplRegion::InsertPoint( const Point &rPoint, long nLineID, mpLastCheckedBand = mpLastCheckedBand->mpPrevBand; } - DBG_ERROR( "ImplRegion::InsertPoint reached the beginning of the list!" ); + OSL_FAIL( "ImplRegion::InsertPoint reached the beginning of the list!" ); } - DBG_ERROR( "ImplRegion::InsertPoint point not inserted!" ); + OSL_FAIL( "ImplRegion::InsertPoint point not inserted!" ); // reinitialize pointer (should never be reached!) mpLastCheckedBand = mpFirstBand; @@ -893,7 +892,7 @@ void ImplRegion::Union( long nLeft, long nTop, long nRight, long nBottom ) { if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) ) { - DBG_ERROR( "ImplRegion::Union() - Bands not sorted!" ); + OSL_FAIL( "ImplRegion::Union() - Bands not sorted!" ); } pBand = pBand->mpNextBand; } @@ -930,7 +929,7 @@ void ImplRegion::Exclude( long nLeft, long nTop, long nRight, long nBottom ) { if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) ) { - DBG_ERROR( "ImplRegion::Exclude() - Bands not sorted!" ); + OSL_FAIL( "ImplRegion::Exclude() - Bands not sorted!" ); } pBand = pBand->mpNextBand; } @@ -967,7 +966,7 @@ void ImplRegion::XOr( long nLeft, long nTop, long nRight, long nBottom ) { if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) ) { - DBG_ERROR( "ImplRegion::XOr() - Bands not sorted!" ); + OSL_FAIL( "ImplRegion::XOr() - Bands not sorted!" ); } pBand = pBand->mpNextBand; } @@ -1058,12 +1057,12 @@ sal_Bool ImplRegion::OptimizeBandList() "Exiting ImplRegion::OptimizeBandList(): empty band in region!" ); if ( pBand->mnYBottom < pBand->mnYTop ) - DBG_ERROR( "ImplRegion::OptimizeBandList(): YBottomBoundary < YTopBoundary" ); + OSL_FAIL( "ImplRegion::OptimizeBandList(): YBottomBoundary < YTopBoundary" ); if ( pBand->mpNextBand ) { if ( pBand->mnYBottom >= pBand->mpNextBand->mnYTop ) - DBG_ERROR( "ImplRegion::OptimizeBandList(): overlapping bands in region!" ); + OSL_FAIL( "ImplRegion::OptimizeBandList(): overlapping bands in region!" ); } pBand = pBand->mpNextBand; @@ -2654,7 +2653,7 @@ SvStream& operator>>( SvStream& rIStrm, Region& rRegion ) if( rIStrm.IsEof() ) { - DBG_ERROR( "premature end of region stream" ); + OSL_FAIL( "premature end of region stream" ); delete rRegion.mpImplRegion; rRegion.mpImplRegion = (ImplRegion*)&aImplEmptyRegion; return rIStrm; @@ -3102,3 +3101,5 @@ Region Region::GetRegionFromPolyPolygon( const PolyPolygon& rPolyPoly ) } return aResult; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 0b6677b2426f..bf0f7523a453 100755..100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -827,3 +828,4 @@ void SalGraphics::AddDevFontSubstitute( OutputDevice* pOutDev, pOutDev->ImplAddDevFontSubstitute( rFontName, rReplaceFontName, nFlags ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 3a2251da5d84..9679170df9b9 100755..100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,7 +37,6 @@ #include <salgdi.hxx> #include <sallayout.hxx> - #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> @@ -97,11 +97,6 @@ bool IsDiacritic( sal_UCS4 nChar ) {0x0590, 0x05BE}, {0x05BF, 0x05C0}, {0x05C1, 0x05C3}, {0x05C4, 0x05C6}, {0x05C7, 0x05C8}, {0x0610, 0x061B}, {0x064B, 0x0660}, {0x0670, 0x0671}, {0x06D6, 0x06DD}, {0x06DF, 0x06E5}, {0x06E7, 0x06E9}, {0x06EA,0x06EF}, {0x0730, 0x074D}, {0x07A6, 0x07B1}, {0x07EB, 0x07F4}, -#if 0 // all known fonts have zero-width diacritics already, so no need to query it - {0x0900, 0x0904}, {0x093C, 0x093D}, {0x0941, 0x0948}, {0x094D, 0x0950}, {0x0951, 0x0958}, - {0x0980, 0x0985}, {0x09BC, 0x09BD}, {0x09C1, 0x09C7}, {0x09CD, 0x09CE}, {0x09E2, 0x09E6}, - {0x0A00, 0x0A05}, {0x0A3C, 0x0A59}, //... -#endif {0x1DC0, 0x1E00}, {0x205F, 0x2070}, {0x20D0, 0x2100}, {0xFB1E, 0xFB1F} @@ -152,48 +147,6 @@ int GetVerticalFlags( sal_UCS4 nChar ) sal_UCS4 GetVerticalChar( sal_UCS4 ) { return 0; // #i14788# input method is responsible vertical char changes - -#if 0 - int nVert = 0; - switch( nChar ) - { - // #104627# special treatment for some unicodes - case 0x002C: nVert = 0x3001; break; - case 0x002E: nVert = 0x3002; break; - /* - // to few fonts have the compatibility forms, using - // them will then cause more trouble than good - // TODO: decide on a font specific basis - case 0x2018: nVert = 0xFE41; break; - case 0x2019: nVert = 0xFE42; break; - case 0x201C: nVert = 0xFE43; break; - case 0x201D: nVert = 0xFE44; break; - // CJK compatibility forms - case 0x2025: nVert = 0xFE30; break; - case 0x2014: nVert = 0xFE31; break; - case 0x2013: nVert = 0xFE32; break; - case 0x005F: nVert = 0xFE33; break; - case 0x0028: nVert = 0xFE35; break; - case 0x0029: nVert = 0xFE36; break; - case 0x007B: nVert = 0xFE37; break; - case 0x007D: nVert = 0xFE38; break; - case 0x3014: nVert = 0xFE39; break; - case 0x3015: nVert = 0xFE3A; break; - case 0x3010: nVert = 0xFE3B; break; - case 0x3011: nVert = 0xFE3C; break; - case 0x300A: nVert = 0xFE3D; break; - case 0x300B: nVert = 0xFE3E; break; - case 0x3008: nVert = 0xFE3F; break; - case 0x3009: nVert = 0xFE40; break; - case 0x300C: nVert = 0xFE41; break; - case 0x300D: nVert = 0xFE42; break; - case 0x300E: nVert = 0xFE43; break; - case 0x300F: nVert = 0xFE44; break; - */ - } - - return nVert; -#endif } // ----------------------------------------------------------------------- @@ -370,17 +323,6 @@ sal_UCS4 GetLocalizedChar( sal_UCS4 nChar, LanguageType eLang ) case LANGUAGE_TIBETAN & LANGUAGE_MASK_PRIMARY: nOffset = 0x0F20 - '0'; // tibetan break; -#if 0 // TODO: use language type for these digit substitutions? - // TODO case: - nOffset = 0x2776 - '0'; // dingbat circled - break; - // TODO case: - nOffset = 0x2070 - '0'; // superscript - break; - // TODO case: - nOffset = 0x2080 - '0'; // subscript - break; -#endif } nChar += nOffset; @@ -839,12 +781,6 @@ int SalLayout::CalcAsianKerning( sal_UCS4 c, bool bLeft, bool /*TODO:? bVertical nResult = nTable[ c - 0x3000 ]; else switch( c ) { -#if 0 // TODO: enable it for real-fixed-width fonts? - case ':': case ';': case '!': - if( !bVertical ) - nResult = bLeft ? -1 : +1; // 25% left and right - break; -#endif case 0x30FB: nResult = bLeft ? -1 : +1; // 25% left/right/top/bottom break; @@ -950,10 +886,6 @@ bool SalLayout::IsSpacingGlyph( sal_GlyphId nGlyph ) const const ImplFontData* SalLayout::GetFallbackFontData( sal_GlyphId /*nGlyphId*/ ) const { -#if 0 - int nFallbackLevel = (nGlyphId & GF_FONTMASK) >> GF_FONTSHIFT - assert( nFallbackLevel == 0 ); -#endif return NULL; } @@ -2321,3 +2253,5 @@ bool MultiSalLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rRect ) co } // ======================================================================= + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx index d1cf56f6a044..d2b794af02d6 100644 --- a/vcl/source/gdi/salmisc.cxx +++ b/vcl/source/gdi/salmisc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -212,7 +213,7 @@ static void ImplTCToTC( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffer if( BMP_SCANLINE_FORMAT( rSrcBuffer.mnFormat ) == BMP_FORMAT_24BIT_TC_BGR ) { BitmapColor aCol; - sal_uInt8* pPixel; + sal_uInt8* pPixel = NULL; for( long nActY = 0, nMapY; nActY < nHeight; nActY++ ) { @@ -325,7 +326,7 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec // initialize pFncGetPixel to something valid that is // least likely to crash pFncGetPixel = BitmapReadAccess::GetPixelFor_1BIT_MSB_PAL; - DBG_ERROR( "unknown read format" ); + OSL_FAIL( "unknown read format" ); break; } @@ -356,7 +357,7 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec // least likely to crash pFncSetPixel = BitmapReadAccess::SetPixelFor_1BIT_MSB_PAL; pDstBuffer->mnBitCount = 1; - DBG_ERROR( "unknown write format" ); + OSL_FAIL( "unknown write format" ); break; } @@ -514,3 +515,5 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec return pDstBuffer; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx index 50048831f3b3..8f50802c9431 100644 --- a/vcl/source/gdi/salnativewidgets-none.cxx +++ b/vcl/source/gdi/salnativewidgets-none.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,7 @@ #include <salgdi.hxx> -using namespace rtl; +using ::rtl::OUString; /**************************************************************** * Placeholder for no native widgets @@ -132,3 +133,4 @@ sal_Bool SalGraphics::getNativeControlRegion( ControlType, return( sal_False ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/svgread.cxx b/vcl/source/gdi/svgread.cxx index 47ef39c37f20..554cfa804b1b 100644 --- a/vcl/source/gdi/svgread.cxx +++ b/vcl/source/gdi/svgread.cxx @@ -78,7 +78,7 @@ namespace vcl if( nStmLen ) { - const vcl::RenderGraphic aSVGGraphic( ::rtl::OUString::createFromAscii( "image/svg+xml" ), nStmLen ); + const vcl::RenderGraphic aSVGGraphic( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/svg+xml")), nStmLen ); mrStm.Seek( nStmPos ); mrStm.Read( aSVGGraphic.GetGraphicData().get(), nStmLen ); diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index fa674d1a712b..e1a2667a8f58 100755..100644 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -227,7 +228,7 @@ namespace vcl aTrace.append( ", " ); } aTrace.append( ")" ); - OSL_TRACE( aTrace.makeStringAndClear().getStr() ); + OSL_TRACE( "%s", aTrace.makeStringAndClear().getStr() ); } #endif return nTextWidth; @@ -385,3 +386,5 @@ namespace vcl //........................................................................ } // namespace vcl //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index cfea7205ee34..5e693d23abf5 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -139,7 +140,7 @@ VirtualDevice::VirtualDevice( sal_uInt16 nBitCount ) : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { - DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); + OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount ); } @@ -150,7 +151,7 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { - DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); + OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); ImplInitVirDev( &rCompDev, 1, 1, nBitCount ); } @@ -161,7 +162,7 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { - DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); + OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); ImplInitVirDev( &rCompDev, 1, 1, nBitCount ); @@ -175,7 +176,7 @@ VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCo : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { - DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); + OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount ); ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount, pData ); } @@ -184,7 +185,7 @@ VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCo VirtualDevice::~VirtualDevice() { - DBG_TRACE( "VirtualDevice::~VirtualDevice()" ); + OSL_TRACE( "VirtualDevice::~VirtualDevice()" ); ImplSVData* pSVData = ImplGetSVData(); @@ -209,7 +210,7 @@ VirtualDevice::~VirtualDevice() sal_Bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase ) { - DBG_TRACE3( "VirtualDevice::ImplSetOutputSizePixel( %ld, %ld, %d )", rNewSize.Width(), rNewSize.Height(), (int)bErase ); + OSL_TRACE( "VirtualDevice::ImplSetOutputSizePixel( %ld, %ld, %d )", rNewSize.Width(), rNewSize.Height(), (int)bErase ); if ( !mpVirDev ) return sal_False; @@ -446,3 +447,4 @@ void VirtualDevice::Compat_ZeroExtleadBug() // ----------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx index aa7c421dbc65..a24d3b0cbd66 100644 --- a/vcl/source/gdi/wall.cxx +++ b/vcl/source/gdi/wall.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -640,3 +641,5 @@ SvStream& operator<<( SvStream& rOStm, const Wallpaper& rWallpaper ) { return( rOStm << *rWallpaper.mpImplWallpaper ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx index fc23dba23bfb..79bcb608fb5f 100644 --- a/vcl/source/glyphs/gcach_ftyp.cxx +++ b/vcl/source/glyphs/gcach_ftyp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,18 +37,23 @@ #include "gcach_ftyp.hxx" #include "vcl/svapp.hxx" - -#include "outfont.hxx" -#include "impfont.hxx" +#include <outfont.hxx> +#include <impfont.hxx> +#ifdef ENABLE_GRAPHITE +#include <graphite2/Font.h> +#include <graphite_layout.hxx> +#endif #include "tools/poly.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" -#include "basegfx/matrix/b2dhommatrixtools.hxx" +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "basegfx/polygon/b2dpolypolygon.hxx" #include "osl/file.hxx" #include "osl/thread.hxx" +#include "sft.hxx" + #include <ft2build.h> #include FT_FREETYPE_H #include FT_GLYPH_H @@ -78,10 +84,8 @@ typedef FT_Vector* FT_Vector_CPtr; // TODO: move file mapping stuff to OSL #if defined(UNX) - #if !defined(HPUX) - // PORTERS: dlfcn is used for getting symbols from FT versions newer than baseline - #include <dlfcn.h> - #endif + // PORTERS: dlfcn is used for getting symbols from FT versions newer than baseline + #include <dlfcn.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> @@ -136,7 +140,8 @@ FT_Error (*pFTOblique)(FT_GlyphSlot); static bool bEnableSizeFT = false; struct EqStr{ bool operator()(const char* a, const char* b) const { return !strcmp(a,b); } }; -typedef ::std::hash_map<const char*,FtFontFile*,::std::hash<const char*>, EqStr> FontFileList; +struct HashStr { size_t operator()( const char* s ) const { return rtl_str_hashCode(s); } }; +typedef ::boost::unordered_map<const char*,boost::shared_ptr<FtFontFile>,HashStr, EqStr> FontFileList; namespace { struct vclFontFileList : public rtl::Static< FontFileList, vclFontFileList > {}; } // ----------------------------------------------------------------------- @@ -211,12 +216,12 @@ FtFontFile* FtFontFile::FindFontFile( const ::rtl::OString& rNativeFileName ) FontFileList &rFontFileList = vclFontFileList::get(); FontFileList::const_iterator it = rFontFileList.find( pFileName ); if( it != rFontFileList.end() ) - return (*it).second; + return it->second.get(); // no => create new one FtFontFile* pFontFile = new FtFontFile( rNativeFileName ); pFileName = pFontFile->maNativeFileName.getStr(); - rFontFileList[ pFileName ] = pFontFile; + rFontFileList[pFileName].reset(pFontFile); return pFontFile; } @@ -289,6 +294,33 @@ void FtFontFile::Unmap() mpFileMap = NULL; } +#ifdef ENABLE_GRAPHITE +// wrap FtFontInfo's table function +const void * graphiteFontTable(const void* appFaceHandle, unsigned int name, size_t *len) +{ + const FtFontInfo * pFontInfo = reinterpret_cast<const FtFontInfo*>(appFaceHandle); + typedef union { + char m_c[5]; + unsigned int m_id; + } TableId; + TableId tableId; + tableId.m_id = name; +#ifndef WORDS_BIGENDIAN + TableId swapped; + swapped.m_c[3] = tableId.m_c[0]; + swapped.m_c[2] = tableId.m_c[1]; + swapped.m_c[1] = tableId.m_c[2]; + swapped.m_c[0] = tableId.m_c[3]; + tableId.m_id = swapped.m_id; +#endif + tableId.m_c[4] = '\0'; + sal_uLong nLength = 0; + const void * pTable = static_cast<const void*>(pFontInfo->GetTable(tableId.m_c, &nLength)); + if (len) *len = static_cast<size_t>(nLength); + return pTable; +} +#endif + // ======================================================================= FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes, @@ -300,6 +332,10 @@ FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes, mnFaceNum( nFaceNum ), mnRefCount( 0 ), mnSynthetic( nSynthetic ), +#ifdef ENABLE_GRAPHITE + mbCheckedGraphite(false), + mpGraphiteFace(NULL), +#endif mnFontId( nFontId ), maDevFontAttributes( rDevFontAttributes ), mpFontCharMap( NULL ), @@ -325,6 +361,10 @@ FtFontInfo::~FtFontInfo() delete mpExtraKernInfo; delete mpChar2Glyph; delete mpGlyph2Char; +#ifdef ENABLE_GRAPHITE + if (mpGraphiteFace) + delete mpGraphiteFace; +#endif } void FtFontInfo::InitHashes() const @@ -353,6 +393,30 @@ FT_FaceRec_* FtFontInfo::GetFaceFT() return maFaceFT; } +#ifdef ENABLE_GRAPHITE +GraphiteFaceWrapper * FtFontInfo::GetGraphiteFace() +{ + if (mbCheckedGraphite) + return mpGraphiteFace; + // test for graphite here so that it is cached most efficiently + if (GetTable("Silf", 0)) + { + int graphiteSegCacheSize = 10000; + static const char* pGraphiteCacheStr = getenv( "SAL_GRAPHITE_CACHE_SIZE" ); + graphiteSegCacheSize = pGraphiteCacheStr ? (atoi(pGraphiteCacheStr)) : 0; + gr_face * pGraphiteFace; + if (graphiteSegCacheSize > 500) + pGraphiteFace = gr_make_face_with_seg_cache(this, graphiteFontTable, graphiteSegCacheSize, gr_face_cacheCmap); + else + pGraphiteFace = gr_make_face(this, graphiteFontTable, gr_face_cacheCmap); + if (pGraphiteFace) + mpGraphiteFace = new GraphiteFaceWrapper(pGraphiteFace); + } + mbCheckedGraphite = true; + return mpGraphiteFace; +} +#endif + // ----------------------------------------------------------------------- void FtFontInfo::ReleaseFaceFT( FT_FaceRec_* pFaceFT ) @@ -508,6 +572,7 @@ FreetypeManager::FreetypeManager() nDefaultPrioAutoHint = pEnv[0] - '0'; InitGammaTable(); + vclFontFileList::get(); } // ----------------------------------------------------------------------- @@ -524,25 +589,11 @@ void* FreetypeServerFont::GetFtFace() const FreetypeManager::~FreetypeManager() { - // an application about to exit can omit garbage collecting the heap - // since it makes things slower and introduces risks if the heap was not perfect - // for debugging, for memory grinding or leak checking the env allows to force GC - const char* pEnv = getenv( "SAL_FORCE_GC_ON_EXIT" ); - if( pEnv && (*pEnv != '0') ) - { - // cleanup container of fontinfos - for( FontList::const_iterator it = maFontList.begin(); it != maFontList.end(); ++it ) - { - FtFontInfo* pInfo = (*it).second; - delete pInfo; - } - maFontList.clear(); - -#if 0 // FT_Done_FreeType crashes on Solaris 10 - // TODO: check which versions have this problem - FT_Error rcFT = FT_Done_FreeType( aLibFT ); -#endif - } + ClearFontList(); +// This crashes on Solaris 10 +// TODO: check which versions have this problem +// +// FT_Error rcFT = FT_Done_FreeType( aLibFT ); } // ----------------------------------------------------------------------- @@ -579,7 +630,7 @@ long FreetypeManager::AddFontDir( const String& rUrlName ) rtl_TextEncoding theEncoding = osl_getThreadTextEncoding(); while( (rcOSL = aDir.getNextItem( aDirItem, 20 )) == osl::FileBase::E_None ) { - osl::FileStatus aFileStatus( FileStatusMask_FileURL ); + osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL ); rcOSL = aDirItem.getFileStatus( aFileStatus ); ::rtl::OUString aUSytemPath; @@ -608,7 +659,7 @@ long FreetypeManager::AddFontDir( const String& rUrlName ) aDFA.maName = String::CreateFromAscii( aFaceFT->family_name ); if ( aFaceFT->style_name ) - aDFA.maStyleName = String::CreateFromAscii( aFaceFT->style_name ); + aDFA.maStyleName = String::CreateFromAscii( aFaceFT->style_name ); aDFA.mbSymbolFlag = false; for( int i = aFaceFT->num_charmaps; --i >= 0; ) @@ -725,11 +776,6 @@ FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontIn { maFaceFT = pFI->GetFaceFT(); -#ifdef HDU_DEBUG - fprintf( stderr, "FTSF::FTSF(\"%s\", h=%d, w=%d, sy=%d) => %d\n", - pFI->GetFontFileName()->getStr(), rFSD.mnHeight, rFSD.mnWidth, pFI->IsSymbolFont(), maFaceFT!=0 ); -#endif - if( !maFaceFT ) return; @@ -869,9 +915,14 @@ FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontIn mnLoadFlags |= FT_LOAD_NO_BITMAP; } -void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions) +void FreetypeServerFont::SetFontOptions( boost::shared_ptr<ImplFontOptions> pFontOptions) { - FontAutoHint eHint = rFontOptions.GetUseAutoHint(); + mpFontOptions = pFontOptions; + + if (!mpFontOptions) + return; + + FontAutoHint eHint = mpFontOptions->GetUseAutoHint(); if( eHint == AUTOHINT_DONTKNOW ) eHint = mbUseGamma ? AUTOHINT_TRUE : AUTOHINT_FALSE; @@ -882,11 +933,11 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions) mnLoadFlags |= FT_LOAD_NO_HINTING; mnLoadFlags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; //#88334# - if( rFontOptions.DontUseAntiAlias() ) + if( mpFontOptions->DontUseAntiAlias() ) mnPrioAntiAlias = 0; - if( rFontOptions.DontUseEmbeddedBitmaps() ) + if( mpFontOptions->DontUseEmbeddedBitmaps() ) mnPrioEmbedded = 0; - if( rFontOptions.DontUseHinting() ) + if( mpFontOptions->DontUseHinting() ) mnPrioAutoHint = 0; #if (FTVERSION >= 2005) || defined(TT_CONFIG_OPTION_BYTECODE_INTERPRETER) @@ -898,7 +949,7 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions) if( !(mnLoadFlags & FT_LOAD_NO_HINTING) && (nFTVERSION >= 2103)) { mnLoadFlags |= FT_LOAD_TARGET_NORMAL; - switch( rFontOptions.GetHintStyle() ) + switch( mpFontOptions->GetHintStyle() ) { case HINT_NONE: mnLoadFlags |= FT_LOAD_NO_HINTING; @@ -919,6 +970,11 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions) mnLoadFlags |= FT_LOAD_NO_BITMAP; } +boost::shared_ptr<ImplFontOptions> FreetypeServerFont::GetFontOptions() const +{ + return mpFontOptions; +} + // ----------------------------------------------------------------------- bool FreetypeServerFont::TestFont() const @@ -1228,11 +1284,6 @@ int FreetypeServerFont::GetRawGlyphIndex( sal_UCS4 aChar ) const // check if symbol aliasing helps if( (aChar <= 0x00FF) && mpFontInfo->IsSymbolFont() ) nGlyphIndex = FT_Get_Char_Index( maFaceFT, aChar | 0xF000 ); -#if 0 // disabled for now because it introduced ae bad side-effect (#i88376#) - // Finally try the postscript name table - if (!nGlyphIndex) - nGlyphIndex = psp::PrintFontManager::get().FreeTypeCharIndex( maFaceFT, aChar ); -#endif } mpFontInfo->CacheGlyphIndex( aChar, nGlyphIndex ); } @@ -1270,17 +1321,6 @@ int FreetypeServerFont::FixupGlyphIndex( int nGlyphIndex, sal_UCS4 aChar ) const } } -#if 0 - // #95556# autohinting not yet optimized for non-western glyph styles - if( !(mnLoadFlags & (FT_LOAD_NO_HINTING | FT_LOAD_FORCE_AUTOHINT) ) - && ( (aChar >= 0x0600 && aChar < 0x1E00) // south-east asian + arabic - ||(aChar >= 0x2900 && aChar < 0xD800) // CJKV - ||(aChar >= 0xF800) ) ) // presentation + symbols - { - nGlyphFlags |= GF_UNHINTED; - } -#endif - if( nGlyphIndex != 0 ) nGlyphIndex |= nGlyphFlags; @@ -1825,6 +1865,29 @@ bool FtFontInfo::GetFontCodeRanges( CmapResult& rResult ) const return true; } +bool FreetypeServerFont::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const +{ + bool bRet = false; + + sal_uLong nLength = 0; + // load GSUB table + const FT_Byte* pGSUB = mpFontInfo->GetTable("GSUB", &nLength); + if (pGSUB) + vcl::getTTScripts(rFontCapabilities.maGSUBScriptTags, pGSUB, nLength); + + // load OS/2 table + const FT_Byte* pOS2 = mpFontInfo->GetTable("OS/2", &nLength); + if (pOS2) + { + bRet = vcl::getTTCoverage( + rFontCapabilities.maUnicodeRange, + rFontCapabilities.maCodePageRange, + pOS2, nLength); + } + + return bRet; +} + // ----------------------------------------------------------------------- // kerning stuff // ----------------------------------------------------------------------- @@ -2058,7 +2121,7 @@ sal_uLong FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) con // prepare glyphindex to character mapping // TODO: this is needed to support VCL's existing kerning infrastructure, // eliminate it up by redesigning kerning infrastructure to work with glyph indizes - typedef std::hash_multimap<sal_uInt16,sal_Unicode> Cmap; + typedef boost::unordered_multimap<sal_uInt16,sal_Unicode> Cmap; Cmap aCmap; for( sal_Unicode aChar = 0x0020; aChar < 0xFFFE; ++aChar ) { @@ -2147,6 +2210,7 @@ PolyArgs::PolyArgs( PolyPolygon& rPolyPoly, sal_uInt16 nMaxPoints ) mnMaxPoints(nMaxPoints), mnPoints(0), mnPoly(0), + mnHeight(0), bHasOffline(false) { mpPointAry = new Point[ mnMaxPoints ]; @@ -2366,7 +2430,7 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) sal_uLong nRequestedLangsys = 0; //MKTAG("ZHT"); //### TODO: where to get langsys? // TODO: request more features depending on script and language system - if( aReqFeatureTagList.size() == 0) // nothing to do + if( aReqFeatureTagList.empty()) // nothing to do return true; // load GSUB table into memory @@ -2446,7 +2510,7 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) } } - if( !aFeatureIndexList.size() ) + if( aFeatureIndexList.empty() ) return true; UshortList aLookupIndexList; @@ -2600,3 +2664,4 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) // ======================================================================= +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/glyphs/gcach_ftyp.hxx b/vcl/source/glyphs/gcach_ftyp.hxx index 747219451b64..9cbe49cd495e 100644 --- a/vcl/source/glyphs/gcach_ftyp.hxx +++ b/vcl/source/glyphs/gcach_ftyp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,6 +36,10 @@ #include FT_FREETYPE_H class FreetypeServerFont; +#ifdef ENABLE_GRAPHITE +class GraphiteFaceWrapper; +#endif + struct FT_GlyphRec_; // ----------------------------------------------------------------------- @@ -80,6 +85,9 @@ public: const unsigned char* GetTable( const char*, sal_uLong* pLength=0 ) const; FT_FaceRec_* GetFaceFT(); +#ifdef ENABLE_GRAPHITE + GraphiteFaceWrapper* GetGraphiteFace(); +#endif void ReleaseFaceFT( FT_FaceRec_* ); const ::rtl::OString* GetFontFileName() const { return mpFontFile->GetFileName(); } @@ -107,15 +115,18 @@ private: const int mnFaceNum; int mnRefCount; const int mnSynthetic; - +#ifdef ENABLE_GRAPHITE + bool mbCheckedGraphite; + GraphiteFaceWrapper * mpGraphiteFace; +#endif sal_IntPtr mnFontId; ImplDevFontAttributes maDevFontAttributes; const ImplFontCharMap* mpFontCharMap; // cache unicode->glyphid mapping because looking it up is expensive - // TODO: change to hash_multimap when a use case requires a m:n mapping - typedef ::std::hash_map<int,int> Int2IntMap; + // TODO: change to boost::unordered_multimap when a use case requires a m:n mapping + typedef ::boost::unordered_map<int,int> Int2IntMap; mutable Int2IntMap* mpChar2Glyph; mutable Int2IntMap* mpGlyph2Char; void InitHashes() const; @@ -161,7 +172,7 @@ public: FreetypeServerFont* CreateFont( const ImplFontSelectData& ); private: - typedef ::std::hash_map<sal_IntPtr,FtFontInfo*> FontList; + typedef ::boost::unordered_map<sal_IntPtr,FtFontInfo*> FontList; FontList maFontList; sal_IntPtr mnMaxFontId; @@ -180,7 +191,8 @@ public: virtual int GetFontFaceNum() const { return mpFontInfo->GetFaceNum(); } virtual bool TestFont() const; virtual void* GetFtFace() const; - virtual void SetFontOptions( const ImplFontOptions&); + virtual void SetFontOptions( boost::shared_ptr<ImplFontOptions> ); + virtual boost::shared_ptr<ImplFontOptions> GetFontOptions() const; virtual int GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); } virtual bool NeedsArtificialBold() const { return mbArtBold; } virtual bool NeedsArtificialItalic() const { return mbArtItalic; } @@ -203,12 +215,16 @@ public: { return mpFontInfo->GetTable( pName, pLength ); } int GetEmUnits() const; const FT_Size_Metrics& GetMetricsFT() const { return maSizeFT->metrics; } +#ifdef ENABLE_GRAPHITE + GraphiteFaceWrapper* GetGraphiteFace() const { return mpFontInfo->GetGraphiteFace(); } +#endif protected: friend class GlyphCache; int ApplyGlyphTransform( int nGlyphFlags, FT_GlyphRec_*, bool ) const; virtual void InitGlyphData( int nGlyphIndex, GlyphData& ) const; + virtual bool GetFontCapabilities(vcl::FontCapabilities &) const; bool ApplyGSUB( const ImplFontSelectData& ); virtual ServerFontLayoutEngine* GetLayoutEngine(); @@ -223,12 +239,14 @@ private: FT_FaceRec_* maFaceFT; FT_SizeRec_* maSizeFT; + boost::shared_ptr<ImplFontOptions> mpFontOptions; + bool mbFaceOk; bool mbArtItalic; bool mbArtBold; bool mbUseGamma; - typedef ::std::hash_map<int,int> GlyphSubstitution; + typedef ::boost::unordered_map<int,int> GlyphSubstitution; GlyphSubstitution maGlyphSubstitution; rtl_UnicodeToTextConverter maRecodeConverter; @@ -258,3 +276,5 @@ public: // ----------------------------------------------------------------------- #endif // _SV_GCACHFTYP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/glyphs/gcach_layout.cxx b/vcl/source/glyphs/gcach_layout.cxx index 3fb0a21bd13c..311654586596 100755..100644 --- a/vcl/source/glyphs/gcach_layout.cxx +++ b/vcl/source/glyphs/gcach_layout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -389,6 +390,9 @@ static bool lcl_CharIsJoiner(sal_Unicode cChar) return ((cChar == 0x200C) || (cChar == 0x200D)); } +//See https://bugs.freedesktop.org/show_bug.cgi?id=31016 +#define ARABIC_BANDAID + bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rArgs ) { LEUnicode* pIcuChars; @@ -522,17 +526,6 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr if( nCharPos >= 0 ) { sal_UCS4 aChar = rArgs.mpStr[ nCharPos ]; -#if 0 // TODO: enable if some unicodes>0xFFFF should need glyph flags!=0 - if( (aChar >= 0xD800) && (aChar <= 0xDFFF) ) - { - if( cChar >= 0xDC00 ) // this part of a surrogate pair was already processed - continue; - // calculate unicode scalar value of surrogate pair - aChar = 0x10000 + ((aChar - 0xD800) << 10); - sal_UCS4 aLow = rArgs.mpStr[ nCharPos+1 ]; - aChar += aLow & 0x03FF; - } -#endif nGlyphIndex = rFont.FixupGlyphIndex( nGlyphIndex, aChar ); // #i99367# HACK: try to detect all diacritics @@ -544,12 +537,40 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr aNewPos = Point( (int)(pPos->fX+0.5), (int)(pPos->fY+0.5) ); const GlyphMetric& rGM = rFont.GetGlyphMetric( nGlyphIndex ); int nGlyphWidth = rGM.GetCharWidth(); + int nNewWidth = nGlyphWidth; if( nGlyphWidth <= 0 ) bDiacritic |= true; // #i99367# force all diacritics to zero width // TODO: we need mnOrigWidth/mnLogicWidth/mnNewWidth else if( bDiacritic ) - nGlyphWidth = 0; + nGlyphWidth = nNewWidth = 0; + else + { + // Hack, find next +ve width glyph and calculate current + // glyph width by substracting the two posituons + const IcuPosition* pNextPos = pPos+1; + for ( int j = i + 1; j <= nRawRunGlyphCount; ++j, ++pNextPos ) + { + if ( j == nRawRunGlyphCount ) + { + nNewWidth = static_cast<int>(pNextPos->fX - pPos->fX); + break; + } + + LEGlyphID nNextGlyphIndex = pIcuGlyphs[j]; + if( (nNextGlyphIndex == ICU_MARKED_GLYPH) + || (nNextGlyphIndex == ICU_DELETED_GLYPH) ) + continue; + + const GlyphMetric& rNextGM = rFont.GetGlyphMetric( nNextGlyphIndex ); + int nNextGlyphWidth = rNextGM.GetCharWidth(); + if ( nNextGlyphWidth > 0 ) + { + nNewWidth = static_cast<int>(pNextPos->fX - pPos->fX); + break; + } + } + } // heuristic to detect glyph clusters bool bInCluster = true; @@ -603,7 +624,10 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr nGlyphFlags |= GlyphItem::IS_DIACRITIC; // add resulting glyph item to layout - const GlyphItem aGI( nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nGlyphWidth ); + GlyphItem aGI( nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nGlyphWidth ); +#ifdef ARABIC_BANDAID + aGI.mnNewWidth = nNewWidth; +#endif rLayout.AppendGlyph( aGI ); ++nFilteredRunGlyphCount; nLastCharPos = nCharPos; @@ -642,3 +666,4 @@ ServerFontLayoutEngine* FreetypeServerFont::GetLayoutEngine() // ======================================================================= +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/glyphs/gcach_rbmp.cxx b/vcl/source/glyphs/gcach_rbmp.cxx index 34d0d4104590..71784f5dd083 100755..100644 --- a/vcl/source/glyphs/gcach_rbmp.cxx +++ b/vcl/source/glyphs/gcach_rbmp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -272,3 +273,5 @@ bool RawBitmap::Rotate( int nAngle ) } //------------------------------------------------------------------------ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/glyphs/gcach_vdev.cxx b/vcl/source/glyphs/gcach_vdev.cxx new file mode 100644 index 000000000000..944d9aee16a3 --- /dev/null +++ b/vcl/source/glyphs/gcach_vdev.cxx @@ -0,0 +1,290 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include <gcach_vdev.hxx> + +#include <vcl/svapp.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/outfont.hxx> +#include <vcl/virdev.hxx> +#include <vcl/metric.hxx> + +// ======================================================================= +// VirtDevServerFont +// ======================================================================= + +// ----------------------------------------------------------------------- + +void VirtDevServerFont::AnnounceFonts( ImplDevFontList* pToAdd ) +{ + // TODO: get fonts on server but not on client, + // problem is that currently there is no serverside virtual device... + VirtualDevice vdev( 1 ); + long nCount = vdev.GetDevFontCount(); + + for( int i = 0; i < nCount; ++i ) + { + const FontInfo aFontInfo = vdev.GetDevFont( i ); + + ImplFontData& rData = *new ImplFontData; + rData.SetSysData( new FontSysData( (void*)SERVERFONT_MAGIC ) ); + + rData.maName = aFontInfo.GetName(); + rData.maStyleName = aFontInfo.GetStyleName(); + rData.mnWidth = aFontInfo.GetWidth(); + rData.mnHeight = aFontInfo.GetHeight(); + rData.meFamily = aFontInfo.GetFamily(); + rData.meCharSet = aFontInfo.GetCharSet(); + rData.mePitch = aFontInfo.GetPitch(); + rData.meWidthType = aFontInfo.GetWidthType(); + rData.meWeight = aFontInfo.GetWeight(); + rData.meItalic = aFontInfo.GetItalic(); + rData.meType = aFontInfo.GetType(); + rData.meFamily = aFontInfo.GetFamily(); + + rData.mbOrientation = true; // TODO: where to get this info? + rData.mbDevice = false; + rData.mnQuality = 0; // prefer client-side fonts if available + + pToAdd->Add( &rData ); + } +} + +// ----------------------------------------------------------------------- + +void VirtDevServerFont::ClearFontList() +{ + // TODO +} + +// ----------------------------------------------------------------------- + +VirtDevServerFont* VirtDevServerFont::CreateFont( const ImplFontSelectData& rFSD ) +{ + VirtDevServerFont* pServerFont = NULL; + // TODO: search list of VirtDevServerFonts, return NULL if not found + // pServerFont = new VirtDevServerFont( rFSD ); + return pServerFont; +} + +// ----------------------------------------------------------------------- + +VirtDevServerFont::VirtDevServerFont( const ImplFontSelectData& rFSD ) +: ServerFont( rFSD) +{} + +// ----------------------------------------------------------------------- + +void VirtDevServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const +{ + const ImplFontSelectData& aFSD = GetFontSelData(); + + Font aFont; + aFont.SetName ( aFSD.maName ); + aFont.SetStyleName ( aFSD.maStyleName ); + aFont.SetHeight ( aFSD.mnHeight ); + aFont.SetWidth ( aFSD.mnWidth ); + aFont.SetOrientation( aFSD.mnOrientation ); + aFont.SetVertical ( GetFontSelData().mbVertical ); + + VirtualDevice vdev( 1 ); + FontMetric aMetric( vdev.GetFontMetric( aFont ) ); + + rFactor = 0x100; + + rTo.mnAscent = aMetric.GetAscent(); + rTo.mnDescent = aMetric.GetDescent(); + rTo.mnIntLeading = aMetric.GetIntLeading(); + rTo.mnExtLeading = aMetric.GetExtLeading(); + rTo.mnSlant = aMetric.GetSlant(); + rTo.meType = aMetric.GetType(); + rTo.mnFirstChar = 0x0020; // TODO: where to get this info? + rTo.mnLastChar = 0xFFFE; // TODO: where to get this info? + + rTo.mnWidth = aFSD.mnWidth; + rTo.maName = aFSD.maName; + rTo.maStyleName = aFSD.maStyleName; + rTo.mnOrientation = aFSD.mnOrientation; + rTo.meFamily = aFSD.meFamily; + rTo.meCharSet = aFSD.meCharSet; + rTo.meWeight = aFSD.meWeight; + rTo.meItalic = aFSD.meItalic; + rTo.mePitch = aFSD.mePitch; + rTo.mbDevice = sal_False; +} + +// ----------------------------------------------------------------------- + +int VirtDevServerFont::GetGlyphIndex( sal_Unicode aChar ) const +{ + return aChar; +} + +// ----------------------------------------------------------------------- + +void VirtDevServerFont::InitGlyphData( int nGlyphIndex, GlyphData& rGD ) const +{ + Font aFont; + aFont.SetName ( GetFontSelData().maName ); + aFont.SetStyleName ( GetFontSelData().maStyleName ); + aFont.SetHeight ( GetFontSelData().mnHeight ); + aFont.SetWidth ( GetFontSelData().mnWidth ); + aFont.SetOrientation( GetFontSelData().mnOrientation ); + aFont.SetVertical ( GetFontSelData().mbVertical ); + + VirtualDevice vdev( 1 ); + vdev.SetFont( aFont ); + + // get glyph metrics + sal_Int32 nCharWidth = 10; +// TODO: vdev.GetCharWidth( nGlyphIndex, nGlyphIndex, &nCharWidth ); + rGD.SetCharWidth( nCharWidth ); + + sal_Unicode aChar = nGlyphIndex; + String aGlyphStr( &aChar, 1 ); + Rectangle aRect; + if( vdev.GetTextBoundRect( aRect, aGlyphStr, 0, 1 ) ) + { + rGD.SetOffset( aRect.Top(), aRect.Left() ); + rGD.SetDelta( vdev.GetTextWidth( nGlyphIndex ), 0 ); + rGD.SetSize( aRect.GetSize() ); + } +} + +// ----------------------------------------------------------------------- + +bool VirtDevServerFont::GetAntialiasAdvice( void ) const +{ + return false; +} + +// ----------------------------------------------------------------------- + +bool VirtDevServerFont::GetGlyphBitmap1( int nGlyphIndex, RawBitmap& ) const +{ + /* + sal_Unicode aChar = nGlyphIndex; + String aGlyphStr( &aChar, 1 ); + + // draw bitmap + vdev.SetOutputSizePixel( aSize, sal_True ); + vdev.DrawText( Point(0,0)-rGD.GetMetric().GetOffset(), aGlyphStr ); + + // create new glyph item + + const Bitmap& rBitmap = vdev.GetBitmap( Point(0,0), aSize ); + rGD.SetBitmap( new Bitmap( rBitmap ) ); + return true; + */ + return false; +} + +// ----------------------------------------------------------------------- + +bool VirtDevServerFont::GetGlyphBitmap8( int nGlyphIndex, RawBitmap& ) const +{ + return false; +} + +// ----------------------------------------------------------------------- + +int VirtDevServerFont::GetGlyphKernValue( int, int ) const +{ + return 0; +} + +// ----------------------------------------------------------------------- + +sal_uLong VirtDevServerFont::GetKernPairs( ImplKernPairData** ppImplKernPairs ) const +{ + Font aFont; + aFont.SetName ( GetFontSelData().maName ); + aFont.SetStyleName ( GetFontSelData().maStyleName ); + aFont.SetHeight ( GetFontSelData().mnHeight ); + aFont.SetWidth ( GetFontSelData().mnWidth ); + aFont.SetOrientation( GetFontSelData().mnOrientation ); + aFont.SetVertical ( GetFontSelData().mbVertical ); + + VirtualDevice vdev( 1 ); + vdev.SetFont( aFont ); + + sal_uLong nPairs = vdev.GetKerningPairCount(); + if( nPairs > 0 ) + { + KerningPair* const pKernPairs = new KerningPair[ nPairs ]; + vdev.GetKerningPairs( nPairs, pKernPairs ); + + *ppImplKernPairs = new ImplKernPairData[ nPairs ]; + ImplKernPairData* pTo = *ppImplKernPairs; + KerningPair* pFrom = pKernPairs; + for ( sal_uLong n = 0; n < nPairs; n++ ) + { + pTo->mnChar1 = pFrom->nChar1; + pTo->mnChar2 = pFrom->nChar2; + pTo->mnKern = pFrom->nKern; + ++pFrom; + ++pTo; + } + + delete[] pKernPairs; + } + + return nPairs; +} + +// ----------------------------------------------------------------------- + +bool VirtDevServerFont::GetGlyphOutline( int nGlyphIndex, PolyPolygon& rPolyPoly ) const +{ + return false; + /* + Font aFont; + aFont.SetName ( GetFontSelData().maName ); + aFont.SetStyleName ( GetFontSelData().maStyleName ); + aFont.SetHeight ( GetFontSelData().mnHeight ); + aFont.SetWidth ( GetFontSelData().mnWidth ); + aFont.SetOrientation( GetFontSelData().mnOrientation ); + aFont.SetVertical ( GetFontSelData().mbVertical ); + + VirtualDevice vdev( 1 ); + vdev.SetFont( aFont ); + + const bool bOptimize = true; + + sal_Unicode aChar = nGlyphIndex; + String aGlyphStr( &aChar, 1 ); + return vdev.GetTextOutline( rPolyPoly, aGlyphStr, 0, 1, bOptimize ); + */ +} + +// ======================================================================= + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/glyphs/gcach_vdev.hxx b/vcl/source/glyphs/gcach_vdev.hxx new file mode 100644 index 000000000000..61cd02b1f9cc --- /dev/null +++ b/vcl/source/glyphs/gcach_vdev.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <vcl/glyphcache.hxx> + +// ----------------------------------------------------------------------- + +class VirtDevServerFont : public ServerFont +{ +public: + virtual bool GetAntialiasAdvice( void ) const; + virtual bool GetGlyphBitmap1( int nGlyphIndex, RawBitmap& ) const; + virtual bool GetGlyphBitmap8( int nGlyphIndex, RawBitmap& ) const; + virtual bool GetGlyphOutline( int nGlyphIndex, PolyPolygon& ) const; + +protected: + friend class GlyphCache; + static void AnnounceFonts( ImplDevFontList* ); + static void ClearFontList(); + + static VirtDevServerFont* CreateFont( const ImplFontSelectData& ); + virtual void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const; + virtual sal_uLong GetKernPairs( ImplKernPairData** ) const; + virtual int GetGlyphKernValue( int, int ) const; + + virtual int GetGlyphIndex( sal_Unicode ) const; + virtual void InitGlyphData( int nGlyphIndex, GlyphData& ) const; + +private: + VirtDevServerFont( const ImplFontSelectData& ); +}; + +// ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx index 5dbec89e9619..c12eb1cabcf5 100644 --- a/vcl/source/glyphs/glyphcache.cxx +++ b/vcl/source/glyphs/glyphcache.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,13 +32,11 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> - +#include <vcl/salbtype.hxx> #include <gcach_ftyp.hxx> #include <vcl/svapp.hxx> #include <vcl/bitmap.hxx> -#include <vcl/salbtype.hxx> - #include <outfont.hxx> #ifdef ENABLE_GRAPHITE @@ -72,6 +71,12 @@ GlyphCache::GlyphCache( GlyphCachePeer& rPeer ) GlyphCache::~GlyphCache() { InvalidateAllGlyphs(); + for( FontList::iterator it = maFontList.begin(), end = maFontList.end(); it != end; ++it ) + { + ServerFont* pServerFont = it->second; + mrPeer.RemovingFont(*pServerFont); + delete pServerFont; + } if( mpFtManager ) delete mpFtManager; } @@ -344,7 +349,7 @@ void GlyphCache::GarbageCollect() pServerFont->GarbageCollect( mnLruIndex+0x10000000 ); if( pServerFont == mpCurrentGCFont ) mpCurrentGCFont = NULL; - const ImplFontSelectData& rIFSD = pServerFont->GetFontSelData(); + const ImplFontSelectData& rIFSD = pServerFont->GetFontSelData(); maFontList.erase( rIFSD ); mrPeer.RemovingFont( *pServerFont ); mnBytesUsed -= pServerFont->GetByteCount(); @@ -530,7 +535,6 @@ ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD ) : ImplFontEntry( rFSD ) , mpServerFont( NULL ) , mbGotFontOptions( false ) -, mbValidFontOptions( false ) {} // ----------------------------------------------------------------------- @@ -602,3 +606,4 @@ int ExtraKernInfo::GetUnscaledKernValue( sal_Unicode cLeft, sal_Unicode cRight ) // ======================================================================= +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx deleted file mode 100644 index 27c9eb02da64..000000000000 --- a/vcl/source/glyphs/graphite_adaptors.cxx +++ /dev/null @@ -1,336 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// Description: Implements the Graphite interfaces with access to the -// platform's font and graphics systems. - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" - -// We need this to enable namespace support in libgrengine headers. -#define GR_NAMESPACE - -// Header files -// -// Standard Library -#include <string> -#include <cassert> -// Libraries -#include <rtl/string.hxx> -#include <rtl/ustring.hxx> -#include <i18npool/mslangid.hxx> -// Platform -#ifndef WNT -#include <unx/saldisp.hxx> - -#include <salgdi.hxx> - -#include <freetype/ftsynth.h> - -// Module -#include "gcach_ftyp.hxx" - -#include <graphite_features.hxx> -#include <graphite_adaptors.hxx> - -// Module private type definitions and forward declarations. -// -using gr::GrResult; -namespace -{ - inline float from_hinted(const int x) { - return static_cast<float>(x + 32) / 64.0; - } - typedef std::hash_map<long,bool> SilfMap; - SilfMap sSilfMap; -} -extern FT_Error (*pFTEmbolden)(FT_GlyphSlot); -extern FT_Error (*pFTOblique)(FT_GlyphSlot); - -// class CharacterRenderProperties implentation. -// -FontProperties::FontProperties(const FreetypeServerFont &font) throw() -{ - clrFore = gr::kclrBlack; - clrBack = gr::kclrTransparent; - - pixHeight = from_hinted(font.GetMetricsFT().height); - - switch (font.GetFontSelData().meWeight) - { - case WEIGHT_SEMIBOLD: case WEIGHT_BOLD: - case WEIGHT_ULTRABOLD: case WEIGHT_BLACK: - fBold = true; - break; - default : - fBold = false; - } - - switch (font.GetFontSelData().meItalic) - { - case ITALIC_NORMAL: case ITALIC_OBLIQUE: - fItalic = true; - break; - default : - fItalic = false; - } - - // Get the font name, but prefix with file name hash in case - // there are 2 fonts on the system with the same face name - sal_Int32 nHashCode = font.GetFontFileName()->hashCode(); - ::rtl::OUStringBuffer nHashFaceName; - nHashFaceName.append(nHashCode, 16); - const sal_Unicode * name = font.GetFontSelData().maName.GetBuffer(); - nHashFaceName.append(name); - - const size_t name_sz = std::min(sizeof szFaceName/sizeof(wchar_t)-1, - static_cast<size_t>(nHashFaceName.getLength())); - - std::copy(nHashFaceName.getStr(), nHashFaceName.getStr() + name_sz, szFaceName); - szFaceName[name_sz] = '\0'; -} - -// class GraphiteFontAdaptor implementaion. -// -GraphiteFontAdaptor::GraphiteFontAdaptor(ServerFont & sfont, const sal_Int32 dpiX, const sal_Int32 dpiY) - : mrFont(static_cast<FreetypeServerFont &>(sfont)), - maFontProperties(static_cast<FreetypeServerFont &>(sfont)), - mnDpiX(dpiX), - mnDpiY(dpiY), - mfAscent(from_hinted(static_cast<FreetypeServerFont &>(sfont).GetMetricsFT().ascender)), - mfDescent(from_hinted(static_cast<FreetypeServerFont &>(sfont).GetMetricsFT().descender)), - mfEmUnits(static_cast<FreetypeServerFont &>(sfont).GetMetricsFT().y_ppem), - mpFeatures(NULL) -{ - const rtl::OString aLang = MsLangId::convertLanguageToIsoByteString( sfont.GetFontSelData().meLanguage ); - rtl::OString name = rtl::OUStringToOString( - sfont.GetFontSelData().maTargetName, RTL_TEXTENCODING_UTF8 ); -#ifdef DEBUG - printf("GraphiteFontAdaptor %lx %s italic=%u bold=%u\n", (long)this, name.getStr(), - maFontProperties.fItalic, maFontProperties.fBold); -#endif - sal_Int32 nFeat = name.indexOf(grutils::GrFeatureParser::FEAT_PREFIX) + 1; - if (nFeat > 0) - { - rtl::OString aFeat = name.copy(nFeat, name.getLength() - nFeat); - mpFeatures = new grutils::GrFeatureParser(*this, aFeat.getStr(), aLang.getStr()); -#ifdef DEBUG - printf("GraphiteFontAdaptor %s/%s/%s %x language %d features %d errors\n", - rtl::OUStringToOString( sfont.GetFontSelData().maName, - RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( sfont.GetFontSelData().maTargetName, - RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( sfont.GetFontSelData().maSearchName, - RTL_TEXTENCODING_UTF8 ).getStr(), - sfont.GetFontSelData().meLanguage, - (int)mpFeatures->getFontFeatures(NULL), mpFeatures->parseErrors()); -#endif - } - else - { - mpFeatures = new grutils::GrFeatureParser(*this, aLang.getStr()); - } -} - -GraphiteFontAdaptor::GraphiteFontAdaptor(const GraphiteFontAdaptor &rhs) throw() - : Font(rhs), - mrFont (rhs.mrFont), maFontProperties(rhs.maFontProperties), - mnDpiX(rhs.mnDpiX), mnDpiY(rhs.mnDpiY), - mfAscent(rhs.mfAscent), mfDescent(rhs.mfDescent), mfEmUnits(rhs.mfEmUnits), - mpFeatures(NULL) -{ - if (rhs.mpFeatures) mpFeatures = new grutils::GrFeatureParser(*(rhs.mpFeatures)); -} - - -GraphiteFontAdaptor::~GraphiteFontAdaptor() throw() -{ - maGlyphMetricMap.clear(); - if (mpFeatures) delete mpFeatures; - mpFeatures = NULL; -} - -void GraphiteFontAdaptor::UniqueCacheInfo(ext_std::wstring & face_name_out, bool & bold_out, bool & italic_out) -{ - face_name_out = maFontProperties.szFaceName; - bold_out = maFontProperties.fBold; - italic_out = maFontProperties.fItalic; -} - -bool GraphiteFontAdaptor::IsGraphiteEnabledFont(ServerFont & font) throw() -{ - // NOTE: this assumes that the same FTFace pointer won't be reused, - // so FtFontInfo::ReleaseFaceFT must only be called at shutdown. - FreetypeServerFont & aFtFont = dynamic_cast<FreetypeServerFont &>(font); - FT_Face aFace = reinterpret_cast<FT_FaceRec_*>(aFtFont.GetFtFace()); - SilfMap::iterator i = sSilfMap.find(reinterpret_cast<long>(aFace)); - if (i != sSilfMap.end()) - { -#ifdef DEBUG - if (static_cast<bool>(aFtFont.GetTable("Silf", 0)) != (*i).second) - printf("Silf cache font mismatch\n"); -#endif - return (*i).second; - } - bool bHasSilf = aFtFont.GetTable("Silf", 0); - sSilfMap[reinterpret_cast<long>(aFace)] = bHasSilf; - return bHasSilf; -} - - -gr::Font * GraphiteFontAdaptor::copyThis() { - return new GraphiteFontAdaptor(*this); -} - - -unsigned int GraphiteFontAdaptor::getDPIx() { - return mnDpiX; -} - - -unsigned int GraphiteFontAdaptor::getDPIy() { - return mnDpiY; -} - - -float GraphiteFontAdaptor::ascent() { - return mfAscent; -} - - -float GraphiteFontAdaptor::descent() { - return mfDescent; -} - - -bool GraphiteFontAdaptor::bold() { - return maFontProperties.fBold; -} - - -bool GraphiteFontAdaptor::italic() { - return maFontProperties.fItalic; -} - - -float GraphiteFontAdaptor::height() { - return maFontProperties.pixHeight; -} - - -void GraphiteFontAdaptor::getFontMetrics(float * ascent_out, float * descent_out, float * em_square_out) { - if (ascent_out) *ascent_out = mfAscent; - if (descent_out) *descent_out = mfDescent; - if (em_square_out) *em_square_out = mfEmUnits; -} - - -const void * GraphiteFontAdaptor::getTable(gr::fontTableId32 table_id, size_t * buffer_sz) -{ - char tag_name[5] = {char(table_id >> 24), char(table_id >> 16), char(table_id >> 8), char(table_id), 0}; - sal_uLong temp = *buffer_sz; - - const void * const tbl_buf = static_cast<FreetypeServerFont &>(mrFont).GetTable(tag_name, &temp); - *buffer_sz = temp; - - return tbl_buf; -} - -#define fix26_6(x) (x >> 6) + (x & 32 ? (x > 0 ? 1 : 0) : (x < 0 ? -1 : 0)) - -// Return the glyph's metrics in pixels. -void GraphiteFontAdaptor::getGlyphMetrics(gr::gid16 nGlyphId, gr::Rect & aBounding, gr::Point & advances) -{ - // There used to be problems when orientation was set however, this no - // longer seems to be the case and the Glyph Metric cache in - // FreetypeServerFont is more efficient since it lasts between calls to VCL -#if 1 - const GlyphMetric & metric = mrFont.GetGlyphMetric(nGlyphId); - - aBounding.right = aBounding.left = metric.GetOffset().X(); - aBounding.bottom = aBounding.top = -metric.GetOffset().Y(); - aBounding.right += metric.GetSize().Width(); - aBounding.bottom -= metric.GetSize().Height(); - - advances.x = metric.GetDelta().X(); - advances.y = -metric.GetDelta().Y(); - -#else - // The problem with the code below is that the cache only lasts - // as long as the life time of the GraphiteFontAdaptor, which - // is created once per call to X11SalGraphics::GetTextLayout - GlyphMetricMap::const_iterator gm_itr = maGlyphMetricMap.find(nGlyphId); - if (gm_itr != maGlyphMetricMap.end()) - { - // We've cached the results from last time. - aBounding = gm_itr->second.first; - advances = gm_itr->second.second; - } - else - { - // We need to look up the glyph. - FT_Int nLoadFlags = mrFont.GetLoadFlags(); - - FT_Face aFace = reinterpret_cast<FT_Face>(mrFont.GetFtFace()); - if (!aFace) - { - aBounding.top = aBounding.bottom = aBounding.left = aBounding.right = 0; - advances.x = advances.y = 0; - return; - } - FT_Error aStatus = -1; - aStatus = FT_Load_Glyph(aFace, nGlyphId, nLoadFlags); - if( aStatus != FT_Err_Ok || (!aFace->glyph)) - { - aBounding.top = aBounding.bottom = aBounding.left = aBounding.right = 0; - advances.x = advances.y = 0; - return; - } - // check whether we need synthetic bold/italic otherwise metric is wrong - if (mrFont.NeedsArtificialBold() && pFTEmbolden) - (*pFTEmbolden)(aFace->glyph); - - if (mrFont.NeedsArtificialItalic() && pFTOblique) - (*pFTOblique)(aFace->glyph); - - const FT_Glyph_Metrics &gm = aFace->glyph->metrics; - - // Fill out the bounding box an advances. - aBounding.top = aBounding.bottom = fix26_6(gm.horiBearingY); - aBounding.bottom -= fix26_6(gm.height); - aBounding.left = aBounding.right = fix26_6(gm.horiBearingX); - aBounding.right += fix26_6(gm.width); - advances.x = fix26_6(gm.horiAdvance); - advances.y = 0; - - // Now add an entry to our metrics map. - maGlyphMetricMap[nGlyphId] = std::make_pair(aBounding, advances); - } -#endif -} - -#endif diff --git a/vcl/source/glyphs/graphite_cache.cxx b/vcl/source/glyphs/graphite_cache.cxx deleted file mode 100644 index a19f5c5a2c9d..000000000000 --- a/vcl/source/glyphs/graphite_cache.cxx +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" - -#ifdef WNT -#include <tools/svwin.h> -#include <svsys.h> -#endif - -#include <tools/debug.hxx> -#include <sallayout.hxx> - -#include <preextstl.h> -#include <graphite/GrClient.h> -#include <graphite/Segment.h> -#include <postextstl.h> - -#include <rtl/ustring.hxx> -#include <graphite_layout.hxx> -#include <graphite_cache.hxx> - -#include "graphite_textsrc.hxx" - -GrSegRecord::GrSegRecord(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl) - : m_rope(rope), m_text(textSrc), m_seg(seg), m_nextKey(NULL), - m_fontScale(0.0f), mbIsRtl(bIsRtl), m_lockCount(0) -{ - m_pStr = textSrc->getLayoutArgs().mpStr + seg->startCharacter(); - m_startChar = seg->startCharacter(); -} - -GrSegRecord::~GrSegRecord() -{ - clear(); -} - -void GrSegRecord::reuse(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl) -{ - clear(); - mnWidth = 0; - m_rope = rope; - m_text = textSrc; - m_seg = seg; - m_nextKey = NULL; - m_pStr = textSrc->getLayoutArgs().mpStr + seg->startCharacter(); - m_startChar = seg->startCharacter(); - mbIsRtl = bIsRtl; -} - -void GrSegRecord::clearVectors() -{ - mvGlyphs.clear(); - mvCharDxs.clear(); - mvChar2BaseGlyph.clear(); - mvGlyph2Char.clear(); -} - -void GrSegRecord::clear() -{ -#ifdef GR_DEBUG_TEXT - if (m_lockCount != 0) - OutputDebugString("GrSegRecord locked!"); -#endif - clearVectors(); - delete m_rope; - delete m_seg; - delete m_text; - m_rope = NULL; - m_seg = NULL; - m_text = NULL; - m_fontScale = 0.0f; - m_lockCount = 0; -} - -GrSegRecord * GraphiteSegmentCache::cacheSegment(TextSourceAdaptor * adapter, gr::Segment * seg, bool bIsRtl) -{ - GrSegRecord * record = NULL; - // We keep a record of the oldest key and the last key added - // when the next key is added, the record for the prevKey's m_nextKey field - // is updated to the newest key so that m_oldestKey can be updated to the - // next oldest key when the record for m_oldestKey is deleted - if (m_segMap.size() > m_nSegCacheSize) - { - GraphiteSegMap::iterator oldestPair = m_segMap.find(reinterpret_cast<long>(m_oldestKey)); - // oldest record may no longer exist if a buffer was changed - if (oldestPair != m_segMap.end()) - { - record = oldestPair->second; - m_segMap.erase(reinterpret_cast<long>(m_oldestKey)); - GrRMEntry range = m_ropeMap.equal_range((*(record->m_rope)).hashCode()); - while (range.first != range.second) - { - if (range.first->second == record) - { - m_ropeMap.erase(range.first); - break; - } - ++range.first; - } - m_oldestKey = record->m_nextKey; - // record will be reused, so don't delete - } - } - - -// const int seg_char_limit = min(adapter->maLayoutArgs().mnLength, -// adapter->maLayoutArgs().mnEndCharPos -// + GraphiteLayout::EXTRA_CONTEXT_LENGTH); -// if (seg->stopCharacter() - seg->startCharacter() <= 0) -// OutputDebugString("Invalid seg indices\n"); - rtl::OUString * pRope = new rtl::OUString(adapter->getLayoutArgs().mpStr + seg->startCharacter(), - seg->stopCharacter() - seg->startCharacter()); - if (!pRope) return NULL; - bool reuse = false; - if (record) - record->reuse(pRope, adapter, seg, bIsRtl); - else - record = new GrSegRecord(pRope, adapter, seg, bIsRtl); - if (!record) - { - delete pRope; - return NULL; - } - GraphiteSegMap::iterator iMap = - m_segMap.find(reinterpret_cast<long>(record->m_pStr)); - if (iMap != m_segMap.end()) - { - // the buffer has changed, so the old cached Segment is useless - reuse = true; - GrSegRecord * found = iMap->second; - // Note: we reuse the old next key to avoid breaking our history - // chain. This means it will be prematurely deleted, but this is - // unlikely to happen very often. - record->m_nextKey = found->m_nextKey; - // overwrite the old record - m_segMap[reinterpret_cast<long>(record->m_pStr)] = record; - // erase the old rope key and save the new one - GrRMEntry range = m_ropeMap.equal_range((*(found->m_rope)).hashCode()); - while (range.first != range.second) - { - if (range.first->second == found) - { - m_ropeMap.erase(range.first); - break; - } - ++range.first; - } - GraphiteRopeMap::value_type mapEntry(record->m_rope->hashCode(), record); - m_ropeMap.insert(mapEntry); - // remove the old record - delete found; - record->m_lockCount++; - return record; - } - m_segMap[reinterpret_cast<long>(record->m_pStr)] = record; - GraphiteRopeMap::value_type mapEntry((*(record->m_rope)).hashCode(), record); - m_ropeMap.insert(mapEntry); - - if (m_oldestKey == NULL) - { - m_oldestKey = record->m_pStr; - m_prevKey = record->m_pStr; - } - else if (reuse == false) - { - DBG_ASSERT(m_segMap.count(reinterpret_cast<long>(m_prevKey)), - "Previous key got lost somehow!"); - m_segMap.find(reinterpret_cast<long>(m_prevKey)) - ->second->m_nextKey = record->m_pStr; - m_prevKey = record->m_pStr; - } - record->m_lockCount++; - return record; -} diff --git a/vcl/source/glyphs/graphite_features.cxx b/vcl/source/glyphs/graphite_features.cxx index 4aba41c4b6d3..1db4a50564bd 100644 --- a/vcl/source/glyphs/graphite_features.cxx +++ b/vcl/source/glyphs/graphite_features.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,8 +37,7 @@ #include <sal/types.h> #ifdef WNT -#include <tools/svwin.h> -#include <svsys.h> +#include <windows.h> #endif #include <graphite_features.hxx> @@ -47,81 +47,108 @@ using namespace grutils; const char GrFeatureParser::FEAT_PREFIX = ':'; const char GrFeatureParser::FEAT_SEPARATOR = '&'; const char GrFeatureParser::FEAT_ID_VALUE_SEPARATOR = '='; -const std::string GrFeatureParser::ISO_LANG("lang"); -GrFeatureParser::GrFeatureParser(gr::Font & font, const std::string lang) - : mnNumSettings(0), mbErrors(false) +GrFeatureParser::GrFeatureParser(const gr_face * pFace, const ::rtl::OString lang) + : mnNumSettings(0), mbErrors(false), mpSettings(NULL) { - maLang.rgch[0] = maLang.rgch[1] = maLang.rgch[2] = maLang.rgch[3] = '\0'; - setLang(font, lang); + maLang.label[0] = maLang.label[1] = maLang.label[2] = maLang.label[3] = '\0'; + setLang(pFace, lang); } -GrFeatureParser::GrFeatureParser(gr::Font & font, const std::string features, const std::string lang) - : mnNumSettings(0), mbErrors(false) +GrFeatureParser::GrFeatureParser(const gr_face * pFace, const ::rtl::OString features, const ::rtl::OString lang) + : mnNumSettings(0), mbErrors(false), mpSettings(NULL) { - size_t nEquals = 0; - size_t nFeatEnd = 0; - size_t pos = 0; - maLang.rgch[0] = maLang.rgch[1] = maLang.rgch[2] = maLang.rgch[3] = '\0'; - setLang(font, lang); - while (pos < features.length() && mnNumSettings < MAX_FEATURES) + sal_Int32 nEquals = 0; + sal_Int32 nFeatEnd = 0; + sal_Int32 pos = 0; + maLang.num = 0u; + setLang(pFace, lang); + while ((pos < features.getLength()) && (mnNumSettings < MAX_FEATURES)) { - nEquals = features.find(FEAT_ID_VALUE_SEPARATOR,pos); - if (nEquals == std::string::npos) + nEquals = features.indexOf(FEAT_ID_VALUE_SEPARATOR, pos); + if (nEquals == -1) { mbErrors = true; break; } // check for a lang=xxx specification - if (features.compare(pos, nEquals - pos, ISO_LANG) == 0) + const ::rtl::OString aLangPrefix("lang"); + if (features.match(aLangPrefix, pos )) { pos = nEquals + 1; - nFeatEnd = features.find(FEAT_SEPARATOR, pos); - if (nFeatEnd == std::string::npos) + nFeatEnd = features.indexOf(FEAT_SEPARATOR, pos); + if (nFeatEnd == -1) { - nFeatEnd = features.length(); + nFeatEnd = features.getLength(); } if (nFeatEnd - pos > 3) mbErrors = true; else { - gr::isocode aLang = maLang; - for (size_t i = pos; i < nFeatEnd; i++) - aLang.rgch[i-pos] = features[i]; - ext_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported - = font.getSupportedLanguages(); - gr::LanguageIterator iL = aSupported.first; - while (iL != aSupported.second) + FeatId aLang = maLang; + aLang.num = 0; + for (sal_Int32 i = pos; i < nFeatEnd; i++) + aLang.label[i-pos] = features[i]; + + //ext_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported + // = font.getSupportedLanguages(); + //gr::LanguageIterator iL = aSupported.first; + unsigned short i = 0; + for (; i < gr_face_n_languages(pFace); i++) { - gr::isocode aSupportedLang = *iL; + gr_uint32 nFaceLang = gr_face_lang_by_index(pFace, i); + FeatId aSupportedLang; + aSupportedLang.num = nFaceLang; +#ifdef __BIG_ENDIAN__ // here we only expect full 3 letter codes - if (aLang.rgch[0] == aSupportedLang.rgch[0] && - aLang.rgch[1] == aSupportedLang.rgch[1] && - aLang.rgch[2] == aSupportedLang.rgch[2] && - aLang.rgch[3] == aSupportedLang.rgch[3]) break; - ++iL; + if (aLang.label[0] == aSupportedLang.label[0] && + aLang.label[1] == aSupportedLang.label[1] && + aLang.label[2] == aSupportedLang.label[2] && + aLang.label[3] == aSupportedLang.label[3]) +#else + if (aLang.label[0] == aSupportedLang.label[3] && + aLang.label[1] == aSupportedLang.label[2] && + aLang.label[2] == aSupportedLang.label[1] && + aLang.label[3] == aSupportedLang.label[0]) +#endif + { + maLang = aSupportedLang; + break; + } + } + if (i == gr_face_n_languages(pFace)) mbErrors = true; + else + { + mnHash = maLang.num; + mpSettings = gr_face_featureval_for_lang(pFace, maLang.num); } - if (iL == aSupported.second) mbErrors = true; - else maLang = aLang; } } else { + sal_uInt32 featId = 0; if (isCharId(features, pos, nEquals - pos)) - maSettings[mnNumSettings].id = getCharId(features, pos, nEquals - pos); - else maSettings[mnNumSettings].id = getIntValue(features, pos, nEquals - pos); - pos = nEquals + 1; - nFeatEnd = features.find(FEAT_SEPARATOR, pos); - if (nFeatEnd == std::string::npos) { - nFeatEnd = features.length(); + featId = getCharId(features, pos, nEquals - pos); } - if (isCharId(features, pos, nFeatEnd - pos)) - maSettings[mnNumSettings].value = getCharId(features, pos, nFeatEnd - pos); else - maSettings[mnNumSettings].value= getIntValue(features, pos, nFeatEnd - pos); - if (isValid(font, maSettings[mnNumSettings])) + { + featId = getIntValue(features, pos, nEquals - pos); + } + const gr_feature_ref * pFref = gr_face_find_fref(pFace, featId); + pos = nEquals + 1; + nFeatEnd = features.indexOf(FEAT_SEPARATOR, pos); + if (nFeatEnd == -1) + { + nFeatEnd = features.getLength(); + } + sal_Int16 featValue = 0; + featValue = getIntValue(features, pos, nFeatEnd - pos); + if (pFref && gr_fref_set_feature_value(pFref, featValue, mpSettings)) + { + mnHash = (mnHash << 16) ^ ((featId << 8) | featValue); mnNumSettings++; + } else mbErrors = true; } @@ -129,89 +156,76 @@ GrFeatureParser::GrFeatureParser(gr::Font & font, const std::string features, co } } -void GrFeatureParser::setLang(gr::Font & font, const std::string & lang) +void GrFeatureParser::setLang(const gr_face * pFace, const rtl::OString & lang) { - gr::isocode aLang = {{0,0,0,0}}; - if (lang.length() > 2) + FeatId aLang; + aLang.num = 0; + if (lang.getLength() >= 2) { - for (size_t i = 0; i < lang.length() && i < 3; i++) + for (sal_Int32 i = 0; i < lang.getLength() && i < 3; i++) { if (lang[i] == '-') break; - aLang.rgch[i] = lang[i]; + aLang.label[i] = lang[i]; } - ext_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported - = font.getSupportedLanguages(); - gr::LanguageIterator iL = aSupported.first; - while (iL != aSupported.second) + unsigned short i = 0; + for (; i < gr_face_n_languages(pFace); i++) { - gr::isocode aSupportedLang = *iL; - if (aLang.rgch[0] == aSupportedLang.rgch[0] && - aLang.rgch[1] == aSupportedLang.rgch[1] && - aLang.rgch[2] == aSupportedLang.rgch[2] && - aLang.rgch[3] == aSupportedLang.rgch[3]) break; - ++iL; - } - if (iL != aSupported.second) - maLang = aLang; -#ifdef DEBUG - else - printf("%s has no features\n", aLang.rgch); + gr_uint32 nFaceLang = gr_face_lang_by_index(pFace, i); + FeatId aSupportedLang; + aSupportedLang.num = nFaceLang; + // here we only expect full 2 & 3 letter codes +#ifdef __BIG_ENDIAN__ + if (aLang.label[0] == aSupportedLang.label[0] && + aLang.label[1] == aSupportedLang.label[1] && + aLang.label[2] == aSupportedLang.label[2] && + aLang.label[3] == aSupportedLang.label[3]) +#else + if (aLang.label[0] == aSupportedLang.label[3] && + aLang.label[1] == aSupportedLang.label[2] && + aLang.label[2] == aSupportedLang.label[1] && + aLang.label[3] == aSupportedLang.label[0]) #endif + { + maLang = aSupportedLang; + break; + } + } + if (i != gr_face_n_languages(pFace)) + { + if (mpSettings) + gr_featureval_destroy(mpSettings); + mpSettings = gr_face_featureval_for_lang(pFace, maLang.num); + mnHash = maLang.num; + } } -} - -GrFeatureParser::GrFeatureParser(const GrFeatureParser & aCopy) - : maLang(aCopy.maLang), mbErrors(aCopy.mbErrors) -{ - mnNumSettings = aCopy.getFontFeatures(maSettings); + if (!mpSettings) + mpSettings = gr_face_featureval_for_lang(pFace, 0); } GrFeatureParser::~GrFeatureParser() { -} - -size_t GrFeatureParser::getFontFeatures(gr::FeatureSetting settings[64]) const -{ - if (settings) - { - std::copy(maSettings, maSettings + mnNumSettings, settings); - } - return mnNumSettings; -} - -bool GrFeatureParser::isValid(gr::Font & font, gr::FeatureSetting & setting) -{ - gr::FeatureIterator i = font.featureWithID(setting.id); - if (font.getFeatures().second == i) - { - return false; - } - ext_std::pair< gr::FeatureSettingIterator, gr::FeatureSettingIterator > - validValues = font.getFeatureSettings(i); - gr::FeatureSettingIterator j = validValues.first; - while (j != validValues.second) + if (mpSettings) { - if (*j == setting.value) return true; - ++j; + gr_featureval_destroy(mpSettings); + mpSettings = NULL; } - return false; } -bool GrFeatureParser::isCharId(const std::string & id, size_t offset, size_t length) +bool GrFeatureParser::isCharId(const rtl::OString & id, size_t offset, size_t length) { if (length > 4) return false; for (size_t i = 0; i < length; i++) { if (i > 0 && id[offset+i] == '\0') continue; - if ((id[offset+i]) < 0x20 || (id[offset+i]) < 0) + if ((id[offset+i] < 0x20) || (id[offset+i] < 0)) return false; - if (i==0 && id[offset+i] < 0x41) + if (i==0 && (id[offset+i] < 0x41)) return false; } return true; } -int GrFeatureParser::getCharId(const std::string & id, size_t offset, size_t length) +gr_uint32 GrFeatureParser::getCharId(const rtl::OString & id, size_t offset, size_t length) { FeatId charId; charId.num = 0; @@ -229,9 +243,9 @@ int GrFeatureParser::getCharId(const std::string & id, size_t offset, size_t len return charId.num; } -int GrFeatureParser::getIntValue(const std::string & id, size_t offset, size_t length) +short GrFeatureParser::getIntValue(const rtl::OString & id, size_t offset, size_t length) { - int value = 0; + short value = 0; int sign = 1; for (size_t i = 0; i < length; i++) { @@ -271,16 +285,4 @@ int GrFeatureParser::getIntValue(const std::string & id, size_t offset, size_t l return value; } - -sal_Int32 GrFeatureParser::hashCode() const -{ - union IsoHash { sal_Int32 mInt; gr::isocode mCode; }; - IsoHash isoHash; - isoHash.mCode = maLang; - sal_Int32 hash = isoHash.mInt; - for (size_t i = 0; i < mnNumSettings; i++) - { - hash = (hash << 16) ^ ((maSettings[i].id << 8) | maSettings[i].value); - } - return hash; -} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index 267454d825c5..46de93aaac39 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,8 +37,9 @@ // Enable lots of debug info #ifdef DEBUG +#include <cstdio> //#define GRLAYOUT_DEBUG 1 -//#undef NDEBUG +#undef NDEBUG #endif // Header files @@ -51,14 +53,7 @@ #include <deque> // Platform -#ifdef WNT -#include <tools/svwin.h> #include <svsys.h> -#endif - -#ifdef UNX -#include <graphite_adaptors.hxx> -#endif #include <salgdi.hxx> @@ -67,18 +62,10 @@ #include <unicode/uscript.h> // Graphite Libraries (must be after vcl headers on windows) -#include <preextstl.h> -#include <graphite/GrClient.h> -#include <graphite/Font.h> -#include <graphite/ITextSource.h> -#include <graphite/Segment.h> -#include <graphite/SegmentPainter.h> -#include <postextstl.h> +#include <graphite2/Segment.h> #include <graphite_layout.hxx> #include <graphite_features.hxx> -#include "graphite_textsrc.hxx" - // Module private type definitions and forward declarations. // @@ -86,48 +73,38 @@ // #ifdef GRLAYOUT_DEBUG -FILE * grLogFile = NULL; -FILE * grLog() +static FILE * grLogFile = NULL; +static FILE * grLog() { #ifdef WNT std::string logFileName(getenv("TEMP")); - logFileName.append("\\graphitelayout.log"); + logFileName.append("/graphitelayout.log"); if (grLogFile == NULL) grLogFile = fopen(logFileName.c_str(),"w"); else fflush(grLogFile); return grLogFile; #else + fflush(stdout); return stdout; #endif } #endif -#ifdef GRCACHE -#include <graphite_cache.hxx> -#endif - - namespace { - typedef ext_std::pair<gr::GlyphIterator, gr::GlyphIterator> glyph_range_t; - typedef ext_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)); } - template<typename T> inline bool in_range(const T i, const T b, const T e) { return !(b > i) && i < e; } - template<typename T> inline bool is_subrange(const T sb, const T se, const T b, const T e) { return !(b > sb || se > e); } - template<typename T> inline bool is_subrange(const std::pair<T, T> &s, const T b, const T e) { return is_subrange(s.first, s.second, b, e); @@ -150,9 +127,18 @@ namespace return limit; } -} // namespace - + template <typename T> + T maximum(T a, T b) + { + return (a > b)? a : b; + } + template <typename T> + T minimum(T a, T b) + { + return (a < b)? a : b; + } +} // namespace // Impementation of the GraphiteLayout::Glyphs container class. // This is an extended vector class with methods added to enable @@ -161,413 +147,368 @@ namespace // o manipulations that affect neighouring glyphs. const int GraphiteLayout::EXTRA_CONTEXT_LENGTH = 10; -#ifdef GRCACHE -GraphiteCacheHandler GraphiteCacheHandler::instance; -#endif + +// find first slot of cluster and first slot of subsequent cluster +static void findFirstClusterSlot(const gr_slot* base, gr_slot const** first, gr_slot const** after, int * firstChar, int * lastChar, bool bRtl) +{ + if (gr_slot_attached_to(base) == NULL) + { + *first = base; + *after = (bRtl)? gr_slot_prev_in_segment(base) : + gr_slot_next_in_segment(base); + *firstChar = gr_slot_before(base); + *lastChar = gr_slot_after(base); + } + const gr_slot * attachment = gr_slot_first_attachment(base); + while (attachment) + { + if (gr_slot_origin_X(*first) > gr_slot_origin_X(attachment)) + *first = attachment; + const gr_slot* attachmentNext = (bRtl)? + gr_slot_prev_in_segment(attachment) : gr_slot_next_in_segment(attachment); + if (attachmentNext) + { + if (*after && (gr_slot_origin_X(*after) < gr_slot_origin_X(attachmentNext))) + *after = attachmentNext; + } + else + { + *after = NULL; + } + if (gr_slot_before(attachment) < *firstChar) + *firstChar = gr_slot_before(attachment); + if (gr_slot_after(attachment) > *lastChar) + *lastChar = gr_slot_after(attachment); + if (gr_slot_first_attachment(attachment)) + findFirstClusterSlot(attachment, first, after, firstChar, lastChar, bRtl); + attachment = gr_slot_next_sibling_attachment(attachment); + } +} // The Graphite glyph stream is really a sequence of glyph attachment trees -// each rooted at a non-attached base glyph. fill_from walks the glyph stream -// find each non-attached base glyph and calls append to record them as a +// each rooted at a non-attached base glyph. fill_from walks the glyph stream, +// finds each non-attached base glyph and calls append to record them as a // sequence of clusters. void -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) +GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fScaling) { - // Create a glyph item for each of the glyph and append it to the base class glyph list. - typedef ext_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; - gr::GlyphIterator prevBase = iGlyphs.second; - float fSegmentAdvance = rSegment.advanceWidth(); - float fMinX = fSegmentAdvance; + bool bRtl = (rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL); + int nCharRequested = rArgs.mnEndCharPos - rArgs.mnMinCharPos; + int nChar = gr_seg_n_cinfo(pSegment); + float fMinX = gr_seg_advance_X(pSegment); float fMaxX = 0.0f; - rGlyph2Char.assign(nGlyphs, -1); - long nDxOffset = 0; - int nGlyphIndex = (bRtl)? (nGlyphs - 1) : 0; - // OOo always expects the glyphs in ltr order - int nDelta = (bRtl)? -1 : 1; - - int nLastGlyph = (bRtl)? nGlyphs - 1: 0; - int nNextChar = (bRtl)? (rSegment.stopCharacter() - 1) : rSegment.startCharacter();//rArgs.mnMinCharPos; - // current glyph number (Graphite glyphs) - //int currGlyph = 0; - int nFirstCharInCluster = nNextChar; - int nFirstGlyphInCluster = nLastGlyph; - - // ltr first char in cluster is lowest, same is true for rtl - // ltr first glyph in cluster is lowest, rtl first glyph is highest - - // loop over the glyphs determining which characters are linked to them - gr::GlyphIterator gi; - for (gi = iGlyphs.first + nGlyphIndex; - nGlyphIndex >= 0 && nGlyphIndex < nGlyphs; - nGlyphIndex+= nDelta, gi = iGlyphs.first + nGlyphIndex) + long nDxOffset = 0; // from dropped glyphs + int nFirstCharInCluster = 0; + int nLastCharInCluster = 0; + unsigned int nGlyphs = gr_seg_n_slots(pSegment); + mvGlyph2Char.assign(nGlyphs, -1); + mvGlyphs.reserve(nGlyphs); + + if (bRtl) { - gr::GlyphInfo info = (*gi); -#ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"Glyph %d %f,%f\n", (int)info.logicalIndex(), info.origin(), info.yOffset()); -#endif - // the last character associated with this glyph is after - // our current cluster buffer position - if ((bRtl && ((signed)info.firstChar() <= nNextChar)) || - (!bRtl && ((signed)info.lastChar() >= nNextChar))) + const gr_slot* baseSlot = gr_seg_last_slot(pSegment); + // find first base + while (baseSlot && (gr_slot_attached_to(baseSlot) != NULL)) + baseSlot = gr_slot_prev_in_segment(baseSlot); + int iChar = nChar - 1; + int iNextChar = nChar - 1; + bool reordered = false; + int nBaseGlyphIndex = 0; + // now loop over bases + while (baseSlot) { - if ((bRtl && nGlyphIndex < nLastGlyph) || - (!bRtl && nGlyphIndex > nLastGlyph)) + bool bCluster = !reordered; + const gr_slot * clusterFirst = NULL; + const gr_slot * clusterAfter = NULL; + int firstChar = -1; + int lastChar = -1; + findFirstClusterSlot(baseSlot, &clusterFirst, &clusterAfter, &firstChar, &lastChar, bRtl); + iNextChar = minimum<int>(firstChar, iNextChar); + if (bCluster) { - // this glyph is after the previous one left->right - // if insertion is allowed before it then we are in a - // new cluster - int nAttachedBase = (*(info.attachedClusterBase())).logicalIndex(); - if (!info.isAttached() || - !in_range(nAttachedBase, nFirstGlyphInCluster, nGlyphIndex)) + nBaseGlyphIndex = mvGlyphs.size(); + mvGlyph2Char[nBaseGlyphIndex] = iChar + mnSegCharOffset; + nFirstCharInCluster = firstChar; + nLastCharInCluster = lastChar; + } + else + { + mvGlyph2Char[mvGlyphs.size()] = firstChar + mnSegCharOffset; + nFirstCharInCluster = minimum<int>(firstChar, nFirstCharInCluster); + nLastCharInCluster = maximum<int>(firstChar, nLastCharInCluster); + } + float leftBoundary = gr_slot_origin_X(clusterFirst); + float rightBoundary = (clusterAfter)? + gr_slot_origin_X(clusterAfter) : gr_seg_advance_X(pSegment); + if ( + lastChar < iChar && + (gr_cinfo_after(gr_seg_cinfo(pSegment, iChar)) > + static_cast<int>(gr_slot_index(clusterAfter))) + ) + { + reordered = true; + } + else + { + reordered = false; + iChar = iNextChar - 1; + } + if (mnSegCharOffset + nFirstCharInCluster >= mnMinCharPos && + mnSegCharOffset + nFirstCharInCluster < mnEndCharPos) + { + fMinX = minimum<float>(fMinX, leftBoundary); + fMaxX = maximum<float>(fMaxX, rightBoundary); + if (!reordered) { - if (in_range(nFirstCharInCluster, rArgs.mnMinCharPos, rArgs.mnEndCharPos) && - nFirstGlyphInCluster != nGlyphIndex) + for (int i = nFirstCharInCluster; i <= nLastCharInCluster; i++) { - std::pair <float,float> aBounds = - appendCluster(rSegment, rArgs, bRtl, - fSegmentAdvance, nFirstCharInCluster, - nNextChar, nFirstGlyphInCluster, nGlyphIndex, fScaling, - rChar2Base, rGlyph2Char, rCharDxs, nDxOffset); - fMinX = std::min(aBounds.first, fMinX); - fMaxX = std::max(aBounds.second, fMaxX); + if (mnSegCharOffset + i >= mnEndCharPos) + break; + // from the point of view of the dx array, the xpos is + // the origin of the first glyph of the cluster rtl + mvCharDxs[mnSegCharOffset + i - mnMinCharPos] = + static_cast<int>(leftBoundary * fScaling) + nDxOffset; + mvCharBreaks[mnSegCharOffset + i - mnMinCharPos] = gr_cinfo_break_weight(gr_seg_cinfo(pSegment, i)); } - nFirstCharInCluster = (bRtl)? info.lastChar() : info.firstChar(); - nFirstGlyphInCluster = nGlyphIndex; + mvChar2BaseGlyph[mnSegCharOffset + nFirstCharInCluster - mnMinCharPos] = nBaseGlyphIndex; } - nLastGlyph = (bRtl)? std::min(nGlyphIndex, nAttachedBase) : - std::max(nGlyphIndex, nAttachedBase); + append(pSegment, rArgs, baseSlot, rightBoundary, fScaling, + nDxOffset, bCluster, mnSegCharOffset + firstChar); + } + if (mnSegCharOffset + nLastCharInCluster < mnMinCharPos) + break; + baseSlot = gr_slot_next_sibling_attachment(baseSlot); + } + } + else + { + const gr_slot* baseSlot = gr_seg_first_slot(pSegment); + // find first base + while (baseSlot && (gr_slot_attached_to(baseSlot) != NULL)) + baseSlot = gr_slot_next_in_segment(baseSlot); + int iChar = 0; // relative to segment + int iNextChar = 0; + bool reordered = false; + int nBaseGlyphIndex = 0; + // now loop over bases + while (baseSlot) + { + bool bCluster = !reordered; + const gr_slot * clusterFirst = NULL; + const gr_slot * clusterAfter = NULL; + int firstChar = -1; + int lastChar = -1; + findFirstClusterSlot(baseSlot, &clusterFirst, &clusterAfter, &firstChar, &lastChar, bRtl); + iNextChar = maximum<int>(lastChar, iNextChar); + if (bCluster) + { + nBaseGlyphIndex = mvGlyphs.size(); + mvGlyph2Char[nBaseGlyphIndex] = iChar + mnSegCharOffset; + nFirstCharInCluster = firstChar; + nLastCharInCluster = lastChar; } - // loop over chacters associated with this glyph and characters - // between nextChar and the last character associated with this glyph - // giving them the current cluster id. This allows for character /glyph - // order reversal. - // For each character we do a reverse glyph id look up - // and store the glyph id with the highest logical index in nLastGlyph - while ((bRtl && ((signed)info.firstChar() <= nNextChar)) || - (!bRtl && (signed)info.lastChar() >= nNextChar)) + else { - GrGlyphSet charGlyphs = rSegment.charToGlyphs(nNextChar); - nNextChar += nDelta; - gr::GlyphSetIterator gj = charGlyphs.first; - while (gj != charGlyphs.second) - { - nLastGlyph = (bRtl)? min(nLastGlyph, (signed)(*gj).logicalIndex()) : max(nLastGlyph, (signed)(*gj).logicalIndex()); - ++gj; - } + mvGlyph2Char[mvGlyphs.size()] = firstChar + mnSegCharOffset; + nFirstCharInCluster = minimum<int>(firstChar, nFirstCharInCluster); + nLastCharInCluster = maximum<int>(lastChar, nLastCharInCluster); } - // Loop over attached glyphs and make sure they are all in the cluster since you - // can have glyphs attached with another base glyph in between - glyph_set_range_t iAttached = info.attachedClusterGlyphs(); - for (gr::GlyphSetIterator agi = iAttached.first; agi != iAttached.second; ++agi) + if ( + firstChar > iChar && + (gr_cinfo_before(gr_seg_cinfo(pSegment, iChar)) > + static_cast<int>(gr_slot_index(clusterFirst))) + ) { - nLastGlyph = (bRtl)? min(nLastGlyph, (signed)(*agi).logicalIndex()) : max(nLastGlyph, (signed)(*agi).logicalIndex()); + reordered = true; } - - // if this is a rtl attached glyph, then we need to include its - // base in the cluster, which will have a lower graphite index - if (bRtl) + else + { + reordered = false; + iChar = iNextChar + 1; + } + float leftBoundary = gr_slot_origin_X(clusterFirst); + float rightBoundary = (clusterAfter)? + gr_slot_origin_X(clusterAfter) : gr_seg_advance_X(pSegment); + if (mnSegCharOffset + nFirstCharInCluster >= mnMinCharPos && + mnSegCharOffset + nFirstCharInCluster < mnEndCharPos) { - if ((signed)info.attachedClusterBase()->logicalIndex() < nLastGlyph) + fMinX = minimum<float>(fMinX, leftBoundary); + fMaxX = maximum<float>(fMaxX, rightBoundary); + if (!reordered) { - nLastGlyph = info.attachedClusterBase()->logicalIndex(); + for (int i = nFirstCharInCluster; i <= nLastCharInCluster; i++) + { + if (mnSegCharOffset + i >= mnEndCharPos) + break; + // from the point of view of the dx array, the xpos is + // the origin of the first glyph of the next cluster ltr + mvCharDxs[mnSegCharOffset + i - mnMinCharPos] = + static_cast<int>(rightBoundary * fScaling) + nDxOffset; + mvCharBreaks[mnSegCharOffset + i - mnMinCharPos] = gr_cinfo_break_weight(gr_seg_cinfo(pSegment, i)); + } + // only set mvChar2BaseGlyph for first character of cluster + mvChar2BaseGlyph[mnSegCharOffset + nFirstCharInCluster - mnMinCharPos] = nBaseGlyphIndex; } + append(pSegment, rArgs, baseSlot, rightBoundary, fScaling, + nDxOffset, true, mnSegCharOffset + firstChar); } - } - - // it is possible for the lastChar to be after nextChar and - // firstChar to be before the nFirstCharInCluster in rare - // circumstances e.g. Myanmar word for cemetery - if ((bRtl && ((signed)info.lastChar() > nFirstCharInCluster)) || - (!bRtl && ((signed)info.firstChar() < nFirstCharInCluster))) - { - nFirstCharInCluster = info.firstChar(); + if (mnSegCharOffset + nFirstCharInCluster >= mnEndCharPos) + break; + baseSlot = gr_slot_next_sibling_attachment(baseSlot); } } - // process last cluster - if (in_range(nFirstCharInCluster, rArgs.mnMinCharPos, rArgs.mnEndCharPos) && - nFirstGlyphInCluster != nGlyphIndex) - { - std::pair <float,float> aBounds = - appendCluster(rSegment, rArgs, bRtl, fSegmentAdvance, - nFirstCharInCluster, nNextChar, - nFirstGlyphInCluster, nGlyphIndex, fScaling, - rChar2Base, rGlyph2Char, rCharDxs, nDxOffset); - fMinX = std::min(aBounds.first, fMinX); - fMaxX = std::max(aBounds.second, fMaxX); - } long nXOffset = round(fMinX * fScaling); - rWidth = round(fMaxX * fScaling) - nXOffset + nDxOffset; - if (rWidth < 0) + mnWidth = round(fMaxX * fScaling) - nXOffset + nDxOffset; + if (mnWidth < 0) { // This can happen when there was no base inside the range - rWidth = 0; + mnWidth = 0; } // fill up non-base char dx with cluster widths from previous base glyph if (bRtl) { - if (rCharDxs[nChar-1] == -1) - rCharDxs[nChar-1] = 0; + if (mvCharDxs[nCharRequested-1] == -1) + mvCharDxs[nCharRequested-1] = 0; else - rCharDxs[nChar-1] -= nXOffset; - for (int i = nChar - 2; i >= 0; i--) + mvCharDxs[nCharRequested-1] -= nXOffset; + for (int i = nCharRequested - 2; i >= 0; i--) { - if (rCharDxs[i] == -1) rCharDxs[i] = rCharDxs[i+1]; - else rCharDxs[i] -= nXOffset; + if (mvCharDxs[i] == -1) mvCharDxs[i] = mvCharDxs[i+1]; + else mvCharDxs[i] -= nXOffset; } } else { - if (rCharDxs[0] == -1) - rCharDxs[0] = 0; + if (mvCharDxs[0] == -1) + mvCharDxs[0] = 0; else - rCharDxs[0] -= nXOffset; - for (int i = 1; i < nChar; i++) + mvCharDxs[0] -= nXOffset; + for (int i = 1; i < nCharRequested; i++) { - if (rCharDxs[i] == -1) rCharDxs[i] = rCharDxs[i-1]; - else rCharDxs[i] -= nXOffset; - } - } + if (mvCharDxs[i] == -1) mvCharDxs[i] = mvCharDxs[i-1]; + else mvCharDxs[i] -= nXOffset; #ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"Glyphs xOff%ld dropDx%ld w%ld\n", nXOffset, nDxOffset, rWidth); + fprintf(grLog(),"%d,%d ", (int)i, (int)mvCharDxs[i]); #endif - // remove offset due to context if there is one - if (nXOffset != 0) - { - for (size_t i = 0; i < size(); i++) - (*this)[i].maLinearPos.X() -= nXOffset; - } -} - -std::pair<float,float> GraphiteLayout::Glyphs::appendCluster(gr::Segment& rSeg, - ImplLayoutArgs & rArgs, bool bRtl,float fSegmentAdvance, - int nFirstCharInCluster, int nNextChar, int nFirstGlyphInCluster, - int nNextGlyph, float fScaling, std::vector<int> & rChar2Base, - std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs, long & rDXOffset) -{ - glyph_range_t iGlyphs = rSeg.glyphs(); - int nGlyphs = iGlyphs.second - iGlyphs.first; - int nDelta = (bRtl)? -1 : 1; - gr::GlyphInfo aFirstGlyph = *(iGlyphs.first + nFirstGlyphInCluster); - std::pair <float, float> aBounds; - aBounds.first = aFirstGlyph.origin(); - aBounds.second = aFirstGlyph.origin(); - // before we add the glyphs to this vector, we record the - // glyph's index in the vector (which is not the same as - // the Segment's glyph index!) - assert(size() < rGlyph2Char.size()); - rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] = size(); - rGlyph2Char[size()] = nFirstCharInCluster; - - // can we break before this cluster? - // Glyphs may have either a positive or negative breakWeight refering to - // the position after or before the glyph respectively - int nPrevBreakWeight = 0; - if (nFirstGlyphInCluster > 0) - { - nPrevBreakWeight = (iGlyphs.first + (nFirstGlyphInCluster - 1))->breakweight(); - } - int nBreakWeight = aFirstGlyph.breakweight(); - if (nBreakWeight < 0) - { - // negative means it applies to the position before the glyph's character - nBreakWeight *= -1; - if (nPrevBreakWeight > 0 && nPrevBreakWeight < nBreakWeight) - { - // prevBreakWeight wins - nBreakWeight = nPrevBreakWeight; } } - else - { - nBreakWeight = 0; - // positive means break after - if (nPrevBreakWeight > 0) - nBreakWeight = nPrevBreakWeight; - } - if (nBreakWeight > gr::klbNoBreak/*0*/ && - // nBreakWeight <= gr::klbHyphenBreak) // uses Graphite hyphenation - nBreakWeight <= gr::klbLetterBreak) // Needed for issue 111272 - { - if (nBreakWeight < gr::klbHyphenBreak) - rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE; - else - rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= HYPHEN_BREAK_BEFORE; - } - // always allow a break before a space even if graphite doesn't - if (rArgs.mpStr[nFirstCharInCluster] == 0x20) - rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE; - - bool bBaseGlyph = true; - for (int j = nFirstGlyphInCluster; - j != nNextGlyph; j += nDelta) - { - long nNextOrigin; - float fNextOrigin; - gr::GlyphInfo aGlyph = *(iGlyphs.first + j); - if (j + nDelta >= nGlyphs || j + nDelta < 0) // at rhs ltr,rtl - { - fNextOrigin = fSegmentAdvance; - nNextOrigin = round(fSegmentAdvance * fScaling + rDXOffset); - aBounds.second = std::max(fSegmentAdvance, aBounds.second); - } - else - { - gr::GlyphInfo aNextGlyph = *(iGlyphs.first + j + nDelta); - fNextOrigin = std::max(aNextGlyph.attachedClusterBase()->origin(), aNextGlyph.origin()); - aBounds.second = std::max(fNextOrigin, aBounds.second); - nNextOrigin = round(fNextOrigin * fScaling + rDXOffset); - } - aBounds.first = std::min(aGlyph.origin(), aBounds.first); - if ((signed)aGlyph.firstChar() < rArgs.mnEndCharPos && - (signed)aGlyph.firstChar() >= rArgs.mnMinCharPos) - { - rCharDxs[aGlyph.firstChar()-rArgs.mnMinCharPos] = nNextOrigin; - } - if ((signed)aGlyph.attachedClusterBase()->logicalIndex() == j) - { - append(rSeg, rArgs, aGlyph, fNextOrigin, fScaling, rChar2Base, rGlyph2Char, rCharDxs, rDXOffset, bBaseGlyph); - bBaseGlyph = false; - } - } - // from the point of view of the dx array, the xpos is - // the origin of the first glyph of the next cluster ltr - // rtl it is the origin of the 1st glyph of the cluster - long nXPos = (bRtl)? - round(aFirstGlyph.attachedClusterBase()->origin() * fScaling) + rDXOffset : - round(aBounds.second * fScaling) + rDXOffset; - // force the last char in range to have the width of the cluster - if (bRtl) - { - for (int n = nNextChar + 1; n <= nFirstCharInCluster; n++) - { - if ((n < rArgs.mnEndCharPos) && (n >= rArgs.mnMinCharPos)) - rCharDxs[n-rArgs.mnMinCharPos] = nXPos; - } - } - else + // remove offset due to context if there is one + if (nXOffset != 0) { - for (int n = nNextChar - 1; n >= nFirstCharInCluster; n--) - { - if (n < rArgs.mnEndCharPos && n >= rArgs.mnMinCharPos) - rCharDxs[n-rArgs.mnMinCharPos] = nXPos; - } + for (size_t i = 0; i < mvGlyphs.size(); i++) + mvGlyphs[i].maLinearPos.X() -= nXOffset; } #ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"Cluster g[%d-%d) c[%d-%d)%x x%ld y%f bw%d\n", nFirstGlyphInCluster, nNextGlyph, nFirstCharInCluster, nNextChar, rArgs.mpStr[nFirstCharInCluster], nXPos, aFirstGlyph.yOffset(), nBreakWeight); + fprintf(grLog(), "fillFrom %d glyphs offset %ld width %d\n", mvGlyphs.size(), nXOffset, mnWidth); #endif - return aBounds; } // append walks an attachment tree, flattening it, and converting it into a // sequence of GlyphItem objects which we can later manipulate. void -GraphiteLayout::Glyphs::append(gr::Segment &segment, ImplLayoutArgs &args, gr::GlyphInfo & gi, float nextGlyphOrigin, float scaling, std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs, long & rDXOffset, bool bIsBase) +GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs &rArgs, + const gr_slot * gi, float nextGlyphOrigin, float scaling, long & rDXOffset, + bool bIsBase, int baseChar) { + bool bRtl = (rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL); float nextOrigin = nextGlyphOrigin; - int firstChar = std::min(gi.firstChar(), gi.lastChar()); - assert(size() < rGlyph2Char.size()); - if (!bIsBase) rGlyph2Char[size()] = firstChar; + assert(gi); + assert(gr_slot_before(gi) <= gr_slot_after(gi)); + int firstChar = gr_slot_before(gi) + mnSegCharOffset; + assert(mvGlyphs.size() < mvGlyph2Char.size()); + if (!bIsBase) mvGlyph2Char[mvGlyphs.size()] = baseChar;//firstChar; // is the next glyph attached or in the next cluster? - glyph_set_range_t iAttached = gi.attachedClusterGlyphs(); - if (iAttached.first != iAttached.second) + //glyph_set_range_t iAttached = gi.attachedClusterGlyphs(); + const gr_slot * pFirstAttached = gr_slot_first_attachment(gi); + if (pFirstAttached) { - nextOrigin = iAttached.first->origin(); + nextOrigin = gr_slot_origin_X(pFirstAttached); } - long glyphId = gi.glyphID(); + long glyphId = gr_slot_gid(gi); long deltaOffset = 0; - int glyphWidth = round(nextOrigin * scaling) - round(gi.origin() * scaling); + int scaledGlyphPos = round(gr_slot_origin_X(gi) * scaling); + int glyphWidth = round(nextOrigin * scaling) - scaledGlyphPos; + if (glyphWidth < 0) + glyphWidth = 0; #ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"c%d g%d gWidth%d x%f ", firstChar, (int)gi.logicalIndex(), glyphWidth, nextOrigin); + fprintf(grLog(),"c%d g%ld,X%d W%d nX%f ", firstChar, glyphId, + (int)(gr_slot_origin_X(gi) * scaling), glyphWidth, nextOrigin * scaling); #endif if (glyphId == 0) { - args.NeedFallback( - firstChar, - gr::RightToLeftDir(gr::DirCode(gi.directionality()))); - if( (SAL_LAYOUT_FOR_FALLBACK & args.mnFlags )) + rArgs.NeedFallback(firstChar, bRtl); + if( (SAL_LAYOUT_FOR_FALLBACK & rArgs.mnFlags )) { glyphId = GF_DROPPED; deltaOffset -= glyphWidth; glyphWidth = 0; } } - else if(args.mnFlags & SAL_LAYOUT_FOR_FALLBACK) + else if(rArgs.mnFlags & SAL_LAYOUT_FOR_FALLBACK) { #ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"fallback c%d %x in run %d\n", firstChar, args.mpStr[firstChar], - args.maRuns.PosIsInAnyRun(firstChar)); + fprintf(grLog(),"fallback c%d %x in run %d\n", firstChar, rArgs.mpStr[firstChar], + rArgs.maRuns.PosIsInAnyRun(firstChar)); #endif // glyphs that aren't requested for fallback will be taken from base // layout, so mark them as dropped (should this wait until Simplify(false) is called?) - if (!args.maRuns.PosIsInAnyRun(firstChar) && - in_range(firstChar, args.mnMinCharPos, args.mnEndCharPos)) + if (!rArgs.maRuns.PosIsInAnyRun(firstChar) && + in_range(firstChar, rArgs.mnMinCharPos, rArgs.mnEndCharPos)) { glyphId = GF_DROPPED; deltaOffset -= glyphWidth; glyphWidth = 0; } } - // append this glyph. + // append this glyph. Set the cluster flag if this glyph is attached to another long nGlyphFlags = bIsBase ? 0 : GlyphItem::IS_IN_CLUSTER; - // directionality seems to be unreliable - //nGlyphFlags |= gr::RightToLeftDir(gr::DirCode(gi.attachedClusterBase()->directionality())) ? GlyphItem::IS_RTL_GLYPH : 0; - nGlyphFlags |= (gi.directionLevel() & 0x1)? GlyphItem::IS_RTL_GLYPH : 0; - GlyphItem aGlyphItem(size(),//gi.logicalIndex(), + nGlyphFlags |= (bRtl)? GlyphItem::IS_RTL_GLYPH : 0; + GlyphItem aGlyphItem(mvGlyphs.size(), glyphId, - Point(round(gi.origin() * scaling + rDXOffset), - round((-gi.yOffset() * scaling) - segment.AscentOffset()* scaling)), + Point(scaledGlyphPos + rDXOffset, + round((-gr_slot_origin_Y(gi) * scaling))), nGlyphFlags, glyphWidth); - aGlyphItem.mnOrigWidth = round(gi.advanceWidth() * scaling); - push_back(aGlyphItem); + if (glyphId != static_cast<long>(GF_DROPPED)) + aGlyphItem.mnOrigWidth = round(gr_slot_advance_X(gi, mpFace, mpFont) * scaling); + mvGlyphs.push_back(aGlyphItem); // update the offset if this glyph was dropped rDXOffset += deltaOffset; - // Recursively apply append all the attached glyphs. - for (gr::GlyphSetIterator agi = iAttached.first; agi != iAttached.second; ++agi) + // Recursively append all the attached glyphs. + for (const gr_slot * agi = gr_slot_first_attachment(gi); agi != NULL; + agi = gr_slot_next_sibling_attachment(agi)) { - if (agi + 1 == iAttached.second) - append(segment, args, *agi, nextGlyphOrigin, scaling, rChar2Base, rGlyph2Char,rCharDxs, rDXOffset, false); + if (gr_slot_next_sibling_attachment(agi) == NULL) + append(pSeg, rArgs, agi, nextGlyphOrigin, scaling, rDXOffset, + false, baseChar); else - append(segment, args, *agi, (agi + 1)->origin(), scaling, rChar2Base, rGlyph2Char, rCharDxs, rDXOffset, false); + append(pSeg, rArgs, agi, gr_slot_origin_X(gr_slot_next_sibling_attachment(agi)), + scaling, rDXOffset, false, baseChar); } } // // An implementation of the SalLayout interface to enable Graphite enabled fonts to be used. // -GraphiteLayout::GraphiteLayout(const gr::Font & font, const grutils::GrFeatureParser * pFeatures) throw() - : mpTextSrc(0), - mrFont(font), +GraphiteLayout::GraphiteLayout(const gr_face * face, gr_font * font, + const grutils::GrFeatureParser * pFeatures) throw() + : mpFace(face), + mpFont(font), mnWidth(0), mfScaling(1.0), mpFeatures(pFeatures) { - // Line settings can have subtle affects on space handling - // since we don't really know whether it is the end of a line or just a run - // in the middle, it is hard to know what to set them to. - // If true, it can cause end of line spaces to be hidden e.g. Doulos SIL - maLayout.setStartOfLine(false); - maLayout.setEndOfLine(false); - maLayout.setDumbFallback(true); - // trailing ws doesn't seem to always take affect if end of line is true - maLayout.setTrailingWs(gr::ktwshAll); -#ifdef GRLAYOUT_DEBUG - gr::ScriptDirCode aDirCode = font.getSupportedScriptDirections(); - fprintf(grLog(),"GraphiteLayout scripts %x %lx\n", aDirCode, long(this)); -#endif -} +} GraphiteLayout::~GraphiteLayout() throw() { clear(); - // the features are owned by the platform layers + // the features and font are owned by the platform layers mpFeatures = NULL; + mpFont = NULL; } void GraphiteLayout::clear() @@ -579,12 +520,7 @@ void GraphiteLayout::clear() mvChar2BaseGlyph.clear(); mvGlyph2Char.clear(); -#ifndef GRCACHE - delete mpTextSrc; -#endif - // Reset the state to the empty state. - mpTextSrc=0; mnWidth = 0; // Don't reset the scaling, because it is set before LayoutText } @@ -592,28 +528,7 @@ void GraphiteLayout::clear() // This method shouldn't be called on windows, since it needs the dc reset bool GraphiteLayout::LayoutText(ImplLayoutArgs & rArgs) { -#ifdef GRCACHE - GrSegRecord * pSegRecord = NULL; - gr::Segment * pSegment = NULL; - // Graphite can in rare cases crash with a zero length - if (rArgs.mnMinCharPos < rArgs.mnEndCharPos) - { - pSegment = CreateSegment(rArgs, &pSegRecord); - if (!pSegment) - return false; - } - else - { - clear(); - return true; - } - // layout the glyphs as required by OpenOffice - bool success = LayoutGlyphs(rArgs, pSegment, pSegRecord); - - if (pSegRecord) pSegRecord->unlock(); - else delete pSegment; -#else - gr::Segment * pSegment = NULL; + gr_segment * pSegment = NULL; bool success = true; if (rArgs.mnMinCharPos < rArgs.mnEndCharPos) { @@ -621,88 +536,25 @@ bool GraphiteLayout::LayoutText(ImplLayoutArgs & rArgs) if (!pSegment) return false; success = LayoutGlyphs(rArgs, pSegment); - if (pSegment) delete pSegment; + if (pSegment) + { + gr_seg_destroy(pSegment); + pSegment = NULL; + } } else { clear(); } -#endif return success; } -#ifdef GRCACHE -class GrFontHasher : public gr::Font -{ -public: - GrFontHasher(const gr::Font & aFont) : gr::Font(aFont), mrRealFont(const_cast<gr::Font&>(aFont)) {}; - ~GrFontHasher(){}; - virtual bool bold() { return mrRealFont.bold(); }; - virtual bool italic() { return mrRealFont.italic(); }; - virtual float ascent() { return mrRealFont.ascent(); }; - virtual float descent() { return mrRealFont.descent(); }; - virtual float height() { return mrRealFont.height(); }; - virtual gr::Font* copyThis() { return mrRealFont.copyThis(); }; - virtual unsigned int getDPIx() { return mrRealFont.getDPIx(); }; - virtual unsigned int getDPIy() { return mrRealFont.getDPIy(); }; - virtual const void* getTable(gr::fontTableId32 nId, size_t* nSize) - { return mrRealFont.getTable(nId,nSize); } - virtual void getFontMetrics(float*pA, float*pB, float*pC) { mrRealFont.getFontMetrics(pA,pB,pC); }; - - sal_Int32 hashCode(const grutils::GrFeatureParser * mpFeatures) - { - // is this sufficient? - ext_std::wstring aFace; - bool bBold; - bool bItalic; - UniqueCacheInfo(aFace, bBold, bItalic); - sal_Unicode uName[32]; // max length used in gr::Font - // Note: graphite stores font names as UTF-16 even if wchar_t is 32bit - // this conversion should be OK. - for (size_t i = 0; i < aFace.size() && i < 32; i++) - { - uName[i] = aFace[i]; - } - size_t iSize = aFace.size(); - if (0 == iSize) return 0; - sal_Int32 hash = rtl_ustr_hashCode_WithLength(uName, iSize); - hash ^= static_cast<sal_Int32>(height()); - hash |= (bBold)? 0x1000000 : 0; - hash |= (bItalic)? 0x2000000 : 0; - if (mpFeatures) - hash ^= mpFeatures->hashCode(); -#ifdef GRLAYOUT_DEBUG - fprintf(grLog(), "font hash %x size %f\n", (int)hash, height()); -#endif - return hash; - }; -protected: - virtual void UniqueCacheInfo( ext_std::wstring& stuFace, bool& fBold, bool& fItalic ) - { -#ifdef WIN32 - dynamic_cast<GraphiteWinFont&>(mrRealFont).UniqueCacheInfo(stuFace, fBold, fItalic); -#else -#ifdef UNX - dynamic_cast<GraphiteFontAdaptor&>(mrRealFont).UniqueCacheInfo(stuFace, fBold, fItalic); -#else -#error Unknown base type for gr::Font::UniqueCacheInfo -#endif -#endif - } -private: - gr::Font & mrRealFont; -}; -#endif -#ifdef GRCACHE -gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs, GrSegRecord ** pSegRecord) -#else -gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) -#endif +gr_segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) { assert(rArgs.mnLength >= 0); - gr::Segment * pSegment = NULL; + gr_segment * pSegment = NULL; // Set the SalLayouts values to be the inital ones. SalLayout::AdjustLayout(rArgs); @@ -717,89 +569,47 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) { // Don't set RTL if font doesn't support it otherwise it forces rtl on // everything - if (bRtl && (mrFont.getSupportedScriptDirections() & gr::kfsdcHorizRtl)) - maLayout.setRightToLeft(bRtl); + //if (bRtl && (mrFont.getSupportedScriptDirections() & gr::kfsdcHorizRtl)) + // maLayout.setRightToLeft(bRtl); // Context is often needed beyond the specified end, however, we don't // want it if there has been a direction change, since it is hard // to tell between reordering within one direction and multi-directional // text. Extra context, can also cause problems with ligatures stradling // a hyphenation point, so disable if CTL is disabled. - const int nSegCharLimit = min(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH); + mnSegCharOffset = rArgs.mnMinCharPos; int limit = rArgs.mnEndCharPos; - if ((nSegCharLimit > limit) && !(SAL_LAYOUT_COMPLEX_DISABLED & rArgs.mnFlags)) - { - limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos, - nSegCharLimit - rArgs.mnEndCharPos, bRtl); - } - -#ifdef GRCACHE - GrFontHasher hasher(mrFont); - sal_Int32 aFontHash = hasher.hashCode(mpFeatures); - GraphiteSegmentCache * pCache = - (GraphiteCacheHandler::instance).getCache(aFontHash); - if (pCache) + if (!(SAL_LAYOUT_COMPLEX_DISABLED & rArgs.mnFlags)) { - *pSegRecord = pCache->getSegment(rArgs, bRtl, limit); - if (*pSegRecord) + const int nSegCharMin = maximum<int>(0, mnMinCharPos - EXTRA_CONTEXT_LENGTH); + const int nSegCharLimit = minimum(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH); + if (nSegCharMin < mnSegCharOffset) { - pSegment = (*pSegRecord)->getSegment(); - mpTextSrc = (*pSegRecord)->getTextSrc(); - maLayout.setRightToLeft((*pSegRecord)->isRtl()); - if (rArgs.mpStr != mpTextSrc->getLayoutArgs().mpStr || - rArgs.mnMinCharPos != mpTextSrc->getLayoutArgs().mnMinCharPos || - rArgs.mnEndCharPos != mpTextSrc->getLayoutArgs().mnEndCharPos || - (SAL_LAYOUT_FOR_FALLBACK & rArgs.mnFlags) ) - { - (*pSegRecord)->clearVectors(); - } - mpTextSrc->switchLayoutArgs(rArgs); - if (limit > rArgs.mnMinCharPos && limit == rArgs.mnEndCharPos - && pSegment->stopCharacter() != limit) - { - // check that the last character is not part of a ligature - glyph_set_range_t aGlyphSet = pSegment->charToGlyphs(limit - 1); - if (aGlyphSet.first == aGlyphSet.second) - { - // no glyphs associated with this glyph - occurs mid ligature - pSegment = NULL; - *pSegRecord = NULL; - } - else - { - while (aGlyphSet.first != aGlyphSet.second) - { - int lastChar = static_cast<int>((*aGlyphSet.first).lastChar()); - if (lastChar >= limit) - { - pSegment = NULL; - *pSegRecord = NULL; - break; - } - aGlyphSet.first++; - } - } - } - if (pSegment) - return pSegment; + int sameDirEnd = findSameDirLimit(rArgs.mpStr + nSegCharMin, + rArgs.mnEndCharPos - nSegCharMin, bRtl); + if (sameDirEnd == rArgs.mnEndCharPos) + mnSegCharOffset = nSegCharMin; + } + if (nSegCharLimit > limit) + { + limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos, + nSegCharLimit - rArgs.mnEndCharPos, bRtl); } } -#endif - // Create a new TextSource object for the engine. - mpTextSrc = new TextSourceAdaptor(rArgs, limit); - if (mpFeatures) mpTextSrc->setFeatures(mpFeatures); + if (mpFeatures) + pSegment = gr_make_seg(mpFont, mpFace, 0, mpFeatures->values(), gr_utf16, + rArgs.mpStr + mnSegCharOffset, limit - mnSegCharOffset, bRtl); + else + pSegment = gr_make_seg(mpFont, mpFace, 0, NULL, gr_utf16, + rArgs.mpStr + mnSegCharOffset, limit - mnSegCharOffset, bRtl); - pSegment = new gr::RangeSegment((gr::Font *)&mrFont, mpTextSrc, &maLayout, mnMinCharPos, limit); + //pSegment = new gr::RangeSegment((gr::Font *)&mrFont, mpTextSrc, &maLayout, mnMinCharPos, limit); if (pSegment != NULL) { #ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"Gr::LayoutText %d-%d, context %d,len%d rtl%d/%d scaling %f\n", rArgs.mnMinCharPos, - rArgs.mnEndCharPos, limit, rArgs.mnLength, maLayout.rightToLeft(), pSegment->rightToLeft(), mfScaling); -#endif -#ifdef GRCACHE - // on a new segment rightToLeft should be correct - *pSegRecord = pCache->cacheSegment(mpTextSrc, pSegment, pSegment->rightToLeft()); + fprintf(grLog(),"Gr::LayoutText %d-%d, context %d,len%d rtl%d scaling %f\n", rArgs.mnMinCharPos, + rArgs.mnEndCharPos, limit, rArgs.mnLength, bRtl, mfScaling); #endif } else @@ -824,47 +634,20 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) return pSegment; } -#ifdef GRCACHE -bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment, GrSegRecord * pSegRecord) -#else -bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment) -#endif +bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr_segment * pSegment) { -#ifdef GRCACHE -#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(); - mvGlyphs = pSegRecord->glyphs(); - mvCharDxs = pSegRecord->charDxs(); - mvChar2BaseGlyph = pSegRecord->char2BaseGlyph(); - mvGlyph2Char = pSegRecord->glyph2Char(); - return true; - } -#endif -#endif // Calculate the initial character dxs. mvCharDxs.assign(mnEndCharPos - mnMinCharPos, -1); mvChar2BaseGlyph.assign(mnEndCharPos - mnMinCharPos, -1); + mvCharBreaks.assign(mnEndCharPos - mnMinCharPos, 0); mnWidth = 0; if (mvCharDxs.size() > 0) { // Discover all the clusters. try { - // Note: we use the layout rightToLeft() because in cached segments - // rightToLeft() may no longer be valid if the engine has been run - // ltr since the segment was created. -#ifdef GRCACHE - bool bRtl = pSegRecord? pSegRecord->isRtl() : pSegment->rightToLeft(); -#else - bool bRtl = pSegment->rightToLeft(); -#endif - mvGlyphs.fill_from(*pSegment, rArgs, bRtl, - mnWidth, mfScaling, mvChar2BaseGlyph, mvGlyph2Char, mvCharDxs); + bool bRtl = mnLayoutFlags & SAL_LAYOUT_BIDI_RTL; + fillFrom(pSegment, rArgs, mfScaling); if (bRtl) { @@ -874,19 +657,8 @@ bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment) // fixup last dx to ensure it always equals the width mvCharDxs[mvCharDxs.size() - 1] = mnWidth; } -#ifdef GRCACHE -#ifdef GRCACHE_REUSE_VECTORS - if (pSegRecord && rArgs.maReruns.IsEmpty() && - !(SAL_LAYOUT_FOR_FALLBACK & rArgs.mnFlags)) - { - pSegRecord->setGlyphVectors(mnWidth, mvGlyphs, mvCharDxs, - mvChar2BaseGlyph, mvGlyph2Char, - mfScaling); - } -#endif -#endif } - catch (std::exception e) + catch (std::exception &e) { #ifdef GRLAYOUT_DEBUG fprintf(grLog(),"LayoutGlyphs failed %s\n", e.what()); @@ -920,24 +692,36 @@ int GraphiteLayout::GetTextBreak(long maxmnWidth, long char_extra, int factor) c return STRING_LEN; long nWidth = mvCharDxs[0] * factor; + long wLastBreak = 0; int nLastBreak = -1; + int nEmergency = -1; for (size_t i = 1; i < mvCharDxs.size(); i++) { nWidth += char_extra; if (nWidth > maxmnWidth) break; if (mvChar2BaseGlyph[i] != -1) { - if (mvChar2BaseGlyph[i] & (WORD_BREAK_BEFORE | HYPHEN_BREAK_BEFORE)) + if ( + (mvCharBreaks[i] > -25 || (mvCharBreaks[i-1] > 0 && mvCharBreaks[i-1] < 25)) && + (mvCharBreaks[i-1] < 25 || (mvCharBreaks[i] < 0 && mvCharBreaks[i] > -25)) + ) + { nLastBreak = static_cast<int>(i); + wLastBreak = nWidth; + } + nEmergency = static_cast<int>(i); } nWidth += (mvCharDxs[i] - mvCharDxs[i-1]) * factor; } int nBreak = mnMinCharPos; - if (nLastBreak > -1) + if (wLastBreak > 9 * maxmnWidth / 10) nBreak += nLastBreak; + else + if (nEmergency > -1) + nBreak += nEmergency; #ifdef GRLAYOUT_DEBUG - fprintf(grLog(), "Gr::GetTextBreak break after %d\n", nBreak - mnMinCharPos); + fprintf(grLog(), "Gr::GetTextBreak break after %d, weights(%d, %d)\n", nBreak - mnMinCharPos, mvCharBreaks[nBreak - mnMinCharPos], mvCharBreaks[nBreak - mnMinCharPos - 1]); #endif if (nBreak > mnEndCharPos) nBreak = STRING_LEN; @@ -945,7 +729,6 @@ int GraphiteLayout::GetTextBreak(long maxmnWidth, long char_extra, int factor) c return nBreak; } - long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const { if (mnEndCharPos == mnMinCharPos) @@ -957,9 +740,9 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const for (size_t i = 0; i < mvCharDxs.size(); i++) { assert( (mvChar2BaseGlyph[i] == -1) || - ((signed)(mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK) < (signed)mvGlyphs.size())); + ((signed)(mvChar2BaseGlyph[i]) < (signed)mvGlyphs.size())); if (mvChar2BaseGlyph[i] != -1 && - mvGlyphs[mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK].mnGlyphIndex == GF_DROPPED) + mvGlyphs[mvChar2BaseGlyph[i]].mnGlyphIndex == GF_DROPPED) { // when used in MultiSalLayout::GetTextBreak dropped glyphs // must have zero width @@ -980,12 +763,11 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const //fprintf(grLog(),"FillDX %ld,%d\n", mnWidth, std::accumulate(pDXArray, pDXArray + mvCharDxs.size(), 0)); } #ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"FillDXArray %d-%d,%d=%ld\n", mnMinCharPos, mnEndCharPos, (int)mpTextSrc->getLength(), mnWidth); + fprintf(grLog(),"FillDXArray %d-%d=%ld\n", mnMinCharPos, mnEndCharPos, mnWidth); #endif return mnWidth; } - void GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs) { SalLayout::AdjustLayout(rArgs); @@ -1031,6 +813,9 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs) int nDeltaWidth = rArgs.mnLayoutWidth - mnWidth; if (nDeltaWidth > 0) // expand, just expand between clusters { + // NOTE: for expansion we can use base glyphs (which have IsClusterStart set) + // even though they may have been reordered in which case they will have + // been placed in a bigger cluster for other purposes. int nClusterCount = 0; for (size_t j = 0; j < mvGlyphs.size(); j++) { @@ -1048,15 +833,18 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs) { if (mvGlyphs[i].IsClusterStart()) { - nOffset = FRound( fExtraPerCluster * nCluster ); - size_t nCharIndex = mvGlyph2Char[i]; - mvCharDxs[nCharIndex] += nOffset; + nOffset = static_cast<int>(fExtraPerCluster * nCluster); + int nCharIndex = mvGlyph2Char[i]; + assert(nCharIndex > -1); + mvCharDxs[nCharIndex-mnMinCharPos] += nOffset; // adjust char dxs for rest of characters in cluster - while (++nCharIndex < mvGlyph2Char.size()) + while (++nCharIndex < static_cast<int>(mvGlyph2Char.size())) { - int nChar2Base = (mvChar2BaseGlyph[nCharIndex] == -1)? -1 : (int)(mvChar2BaseGlyph[nCharIndex] & GLYPH_INDEX_MASK); + int nChar2Base = mvChar2BaseGlyph[nCharIndex-mnMinCharPos]; if (nChar2Base == -1 || nChar2Base == static_cast<int>(i)) - mvCharDxs[nCharIndex] += nOffset; + mvCharDxs[nCharIndex-mnMinCharPos] += nOffset; + else + break; } ++nCluster; } @@ -1064,25 +852,27 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs) } } } - else // condense - apply a factor to all glyph positions + else if (nDeltaWidth < 0)// condense - apply a factor to all glyph positions { if (mvGlyphs.size() == 0) return; Glyphs::iterator iLastGlyph = mvGlyphs.begin() + (mvGlyphs.size() - 1); // position last glyph using original width float fXFactor = static_cast<float>(rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth) / static_cast<float>(iLastGlyph->maLinearPos.X()); #ifdef GRLAYOUT_DEBUG - fprintf(grLog(), "Condense by factor %f\n", fXFactor); + fprintf(grLog(), "Condense by factor %f last x%ld\n", fXFactor, iLastGlyph->maLinearPos.X()); #endif + if (fXFactor < 0) + return; // probably a bad mnOrigWidth value iLastGlyph->maLinearPos.X() = rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth; Glyphs::iterator iGlyph = mvGlyphs.begin(); while (iGlyph != iLastGlyph) { - iGlyph->maLinearPos.X() = FRound( fXFactor * iGlyph->maLinearPos.X() ); + iGlyph->maLinearPos.X() = static_cast<int>(static_cast<float>(iGlyph->maLinearPos.X()) * fXFactor); ++iGlyph; } for (size_t i = 0; i < mvCharDxs.size(); i++) { - mvCharDxs[i] = FRound( fXFactor * mvCharDxs[i] ); + mvCharDxs[i] = static_cast<int>(fXFactor * static_cast<float>(mvCharDxs[i])); } } mnWidth = rArgs.mnLayoutWidth; @@ -1108,7 +898,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt int nPrevClusterLastChar = -1; for (size_t i = 0; i < nChars; i++) { - int nChar2Base = (mvChar2BaseGlyph[i] == -1)? -1 : (int)(mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK); + int nChar2Base = mvChar2BaseGlyph[i]; if ((nChar2Base > -1) && (nChar2Base != nPrevClusterGlyph)) { assert((nChar2Base > -1) && (nChar2Base < (signed)mvGlyphs.size())); @@ -1120,11 +910,12 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt size_t j = i + 1; int nLastChar = i; int nLastGlyph = nChar2Base; + int nChar2BaseJ = -1; for (; j < nChars; j++) { - int nChar2BaseJ = (mvChar2BaseGlyph[j] == -1)? -1 : (int)(mvChar2BaseGlyph[j] & GLYPH_INDEX_MASK); + nChar2BaseJ = mvChar2BaseGlyph[j]; assert((nChar2BaseJ >= -1) && (nChar2BaseJ < (signed)mvGlyphs.size())); - if (nChar2BaseJ != -1 && mvGlyphs[nChar2BaseJ].IsClusterStart()) + if (nChar2BaseJ != -1 ) { nLastGlyph = nChar2BaseJ + ((bRtl)? +1 : -1); nLastChar = j - 1; @@ -1152,6 +943,12 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt nLastChar = nChars - 1; if (!bRtl) nLastGlyph = mvGlyphs.size() - 1; } + int nBaseCount = 0; + // count bases within cluster - may be more than 1 with reordering + for (int k = nChar2Base; k <= nLastGlyph; k++) + { + if (mvGlyphs[k].IsClusterStart()) ++nBaseCount; + } assert((nLastChar > -1) && (nLastChar < (signed)nChars)); long nNewClusterWidth = args.mpDXArray[nLastChar]; long nOrigClusterWidth = mvCharDxs[nLastChar]; @@ -1173,21 +970,25 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt mvGlyphs[nLastGlyph].mnNewWidth += nDWidth; else nDGlyphOrigin += nDWidth; + long nDOriginPerBase = (nBaseCount > 0)? nDWidth / nBaseCount : 0; + nBaseCount = -1; // update glyph positions if (bRtl) { for (int n = nChar2Base; n <= nLastGlyph; n++) { + if (mvGlyphs[n].IsClusterStart()) ++nBaseCount; assert((n > - 1) && (n < (signed)mvGlyphs.size())); - mvGlyphs[n].maLinearPos.X() += -nDGlyphOrigin + nXOffset; + mvGlyphs[n].maLinearPos.X() += -(nDGlyphOrigin + nDOriginPerBase * nBaseCount) + nXOffset; } } else { for (int n = nChar2Base; n <= nLastGlyph; n++) { + if (mvGlyphs[n].IsClusterStart()) ++nBaseCount; assert((n > - 1) && (n < (signed)mvGlyphs.size())); - mvGlyphs[n].maLinearPos.X() += nDGlyphOrigin + nXOffset; + mvGlyphs[n].maLinearPos.X() += nDGlyphOrigin + (nDOriginPerBase * nBaseCount) + nXOffset; } } rDeltaWidth[nChar2Base] = nDWidth; @@ -1262,7 +1063,7 @@ void GraphiteLayout::kashidaJustify(std::vector<int>& rDeltaWidths, sal_GlyphId { (*(i)).maLinearPos.X() -= nGapWidth; nGapWidth -= nKashidaWidth; - i++; + ++i; } // fixup rightmost kashida for gap remainder @@ -1290,15 +1091,15 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray std::fill(pCaretXArray, pCaretXArray + nArraySize, -1); // the layout method doesn't modify the layout even though it isn't // const in the interface - bool bRtl = const_cast<GraphiteLayout*>(this)->maLayout.rightToLeft(); + bool bRtl = (mnLayoutFlags & SAL_LAYOUT_BIDI_RTL);//const_cast<GraphiteLayout*>(this)->maLayout.rightToLeft(); int prevBase = -1; long prevClusterWidth = 0; for (int i = 0, nCharSlot = 0; i < nArraySize && nCharSlot < static_cast<int>(mvCharDxs.size()); ++nCharSlot, i+=2) { if (mvChar2BaseGlyph[nCharSlot] != -1) { - int nChar2Base = mvChar2BaseGlyph[nCharSlot] & GLYPH_INDEX_MASK; - assert((mvChar2BaseGlyph[nCharSlot] > -1) && (nChar2Base < (signed)mvGlyphs.size())); + int nChar2Base = mvChar2BaseGlyph[nCharSlot]; + assert((nChar2Base > -1) && (nChar2Base < (signed)mvGlyphs.size())); GlyphItem gi = mvGlyphs[nChar2Base]; if (gi.mnGlyphIndex == GF_DROPPED) { @@ -1315,8 +1116,8 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray origClusterWidth += mvGlyphs[nCluster].mnNewWidth; if (mvGlyph2Char[nCluster] == nCharSlot) { - nMin = std::min(nMin, mvGlyphs[nCluster].maLinearPos.X()); - nMax = std::min(nMax, mvGlyphs[nCluster].maLinearPos.X() + mvGlyphs[nCluster].mnNewWidth); + nMin = minimum(nMin, mvGlyphs[nCluster].maLinearPos.X()); + nMax = maximum(nMax, mvGlyphs[nCluster].maLinearPos.X() + mvGlyphs[nCluster].mnNewWidth); } } if (bRtl) @@ -1348,12 +1149,10 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray break; } } - long nGWidth = gi.mnNewWidth; // if no match position at end of cluster if (nGlyph == static_cast<int>(mvGlyphs.size()) || mvGlyphs[nGlyph].IsClusterStart()) { - nGWidth = prevClusterWidth; if (bRtl) { pCaretXArray[i+1] = gi.maLinearPos.X(); @@ -1392,7 +1191,6 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray #endif } - // GetNextGlyphs returns a contiguous sequence of glyphs that can be // rendered together. It should never return a dropped glyph. // The glyph_slot returned should be the index of the next visible @@ -1420,7 +1218,7 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out, ++glyph_slot) {}; // Update the length - const int nGlyphSlotEnd = std::min(size_t(glyph_slot + length), mvGlyphs.size()); + const int nGlyphSlotEnd = minimum(size_t(glyph_slot + length), mvGlyphs.size()); // We're all out of glyphs here. if (glyph_slot == nGlyphSlotEnd) @@ -1438,17 +1236,23 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out, //aPosOut = glyph_itr->maLinearPos; aPosOut = GetDrawPosition(aStartPos); - for (;;) // Forever { // last index of the range from glyph_to_chars does not include this glyph if (char_index) { - assert((glyph_slot >= -1) && (glyph_slot < (signed)mvGlyph2Char.size())); - if (mvGlyph2Char[glyph_slot] == -1) - *char_index++ = mvCharDxs.size(); - else - *char_index++ = mvGlyph2Char[glyph_slot]; + if (glyph_slot >= (signed)mvGlyph2Char.size()) + { + *char_index++ = mnMinCharPos + mvCharDxs.size(); + } + else + { + assert(glyph_slot > -1); + if (mvGlyph2Char[glyph_slot] == -1) + *char_index++ = mnMinCharPos + mvCharDxs.size(); + else + *char_index++ = mvGlyph2Char[glyph_slot]; + } } // Copy out this glyphs data. ++glyph_slot; @@ -1461,8 +1265,9 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out, ((glyph_itr+1)->maLinearPos.X() - glyph_itr->maLinearPos.X()); #ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"GetNextGlyphs g%d c%d x%ld,%ld adv%ld, pos %ld,%ld\n", glyph_slot - 1, - GLYPH_INDEX_MASK&mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance, + fprintf(grLog(),"GetNextGlyphs g%d gid%d c%d x%ld,%ld adv%ld, pos %ld,%ld\n", + glyph_slot - 1, glyph_itr->mnGlyphIndex, + mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance, aPosOut.X(), aPosOut.Y()); #endif @@ -1492,7 +1297,6 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out, return numGlyphs; } - void GraphiteLayout::MoveGlyph( int nGlyphIndex, long nNewPos ) { // TODO it might be better to actualy implement simplify properly, but this @@ -1519,7 +1323,6 @@ void GraphiteLayout::MoveGlyph( int nGlyphIndex, long nNewPos ) mnWidth += dx; } - void GraphiteLayout::DropGlyph( int nGlyphIndex ) { if(nGlyphIndex >= signed(mvGlyphs.size())) @@ -1551,7 +1354,6 @@ void GraphiteLayout::Simplify( bool isBaseLayout ) { deltaX = 0; } - //mvCharDxs[mvGlyph2Char[gi->mnCharPos]] -= deltaX; ++gi; } #ifdef GRLAYOUT_DEBUG @@ -1560,3 +1362,5 @@ void GraphiteLayout::Simplify( bool isBaseLayout ) // discard width from trailing dropped glyphs, but not those in the middle mnWidth -= deltaX; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/glyphs/graphite_serverfont.cxx b/vcl/source/glyphs/graphite_serverfont.cxx index ceba4dd4f6c8..1f9ee322455a 100644 --- a/vcl/source/glyphs/graphite_serverfont.cxx +++ b/vcl/source/glyphs/graphite_serverfont.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,44 +36,120 @@ // // Platform +#include <i18npool/mslangid.hxx> #include <sallayout.hxx> // Module #include "gcach_ftyp.hxx" +#include <glyphcache.hxx> #include <graphite_features.hxx> -#include "graphite_textsrc.hxx" +//#include "graphite_textsrc.hxx" #include <graphite_serverfont.hxx> #ifndef WNT +float freetypeServerFontAdvance(const void* appFontHandle, gr_uint16 glyphId) +{ + FreetypeServerFont * pServerFont = + const_cast<FreetypeServerFont*> + (reinterpret_cast<const FreetypeServerFont*>(appFontHandle)); + if (pServerFont) + { + return static_cast<float>(pServerFont->GetGlyphMetric(glyphId).GetCharWidth()); + } + return .0f; +} + // // An implementation of the GraphiteLayout interface to enable Graphite enabled fonts to be used. // -GraphiteServerFontLayout::GraphiteServerFontLayout(GraphiteFontAdaptor * pFont) throw() - : ServerFontLayout(pFont->font()), mpFont(pFont), - maImpl(*mpFont, mpFont->features(), pFont) +GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont & rServerFont) throw() + : ServerFontLayout(rServerFont), + maImpl(dynamic_cast<FreetypeServerFont&>(rServerFont).GetGraphiteFace()->face(), + rServerFont), + mpFeatures(NULL) { - // Nothing needed here + FreetypeServerFont& rFTServerFont = dynamic_cast<FreetypeServerFont&>(rServerFont); + gr_font * pFont = rFTServerFont.GetGraphiteFace()->font(rServerFont.GetFontSelData().mnHeight); + if (!pFont) + { + pFont = gr_make_font_with_advance_fn( + // need to use mnHeight here, mfExactHeight can give wrong values + static_cast<float>(rServerFont.GetFontSelData().mnHeight), + &rFTServerFont, + freetypeServerFontAdvance, + rFTServerFont.GetGraphiteFace()->face()); + rFTServerFont.GetGraphiteFace()->addFont(rServerFont.GetFontSelData().mnHeight, pFont); + } + maImpl.SetFont(pFont); + rtl::OString aLang(""); + if (rServerFont.GetFontSelData().meLanguage != LANGUAGE_DONTKNOW) + { + aLang = MsLangId::convertLanguageToIsoByteString( + rServerFont.GetFontSelData().meLanguage ); + } + rtl::OString name = rtl::OUStringToOString( + rServerFont.GetFontSelData().maTargetName, RTL_TEXTENCODING_UTF8 ); +#ifdef DEBUG + printf("GraphiteServerFontLayout %lx %s size %d %f\n", (long unsigned int)this, name.getStr(), + rFTServerFont.GetMetricsFT().x_ppem, + rServerFont.GetFontSelData().mfExactHeight); +#endif + sal_Int32 nFeat = name.indexOf(grutils::GrFeatureParser::FEAT_PREFIX) + 1; + if (nFeat > 0) + { + rtl::OString aFeat = name.copy(nFeat, name.getLength() - nFeat); + mpFeatures = new grutils::GrFeatureParser( + rFTServerFont.GetGraphiteFace()->face(), aFeat, aLang); +#ifdef DEBUG + if (mpFeatures) + printf("GraphiteServerFontLayout %s/%s/%s %x language %d features %d errors\n", + rtl::OUStringToOString( rServerFont.GetFontSelData().maName, + RTL_TEXTENCODING_UTF8 ).getStr(), + rtl::OUStringToOString( rServerFont.GetFontSelData().maTargetName, + RTL_TEXTENCODING_UTF8 ).getStr(), + rtl::OUStringToOString( rServerFont.GetFontSelData().maSearchName, + RTL_TEXTENCODING_UTF8 ).getStr(), + rServerFont.GetFontSelData().meLanguage, + (int)mpFeatures->numFeatures(), mpFeatures->parseErrors()); +#endif + } + else + { + mpFeatures = new grutils::GrFeatureParser( + rFTServerFont.GetGraphiteFace()->face(), aLang); + } + maImpl.SetFeatures(mpFeatures); } GraphiteServerFontLayout::~GraphiteServerFontLayout() throw() { - delete mpFont; - mpFont = NULL; + delete mpFeatures; + mpFeatures = NULL; } -const sal_Unicode* GraphiteServerFontLayout::getTextPtr() const +bool GraphiteServerFontLayout::IsGraphiteEnabledFont(ServerFont * pServerFont) { - return maImpl.textSrc()->getLayoutArgs().mpStr + - maImpl.textSrc()->getLayoutArgs().mnMinCharPos; + FreetypeServerFont * pFtServerFont = dynamic_cast<FreetypeServerFont*>(pServerFont); + if (pFtServerFont) + { + if (pFtServerFont->GetGraphiteFace()) + { +#ifdef DEBUG + printf("IsGraphiteEnabledFont\n"); +#endif + return true; + } + } + return false; } sal_GlyphId GraphiteLayoutImpl::getKashidaGlyph(int & width) { - int nKashidaIndex = mpFont->font().GetGlyphIndex( 0x0640 ); + int nKashidaIndex = mrServerFont.GetGlyphIndex( 0x0640 ); if( nKashidaIndex != 0 ) { - const GlyphMetric& rGM = mpFont->font().GetGlyphMetric( nKashidaIndex ); + const GlyphMetric& rGM = mrServerFont.GetGlyphMetric( nKashidaIndex ); width = rGM.GetCharWidth(); } else @@ -83,3 +160,5 @@ sal_GlyphId GraphiteLayoutImpl::getKashidaGlyph(int & width) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/glyphs/graphite_textsrc.cxx b/vcl/source/glyphs/graphite_textsrc.cxx deleted file mode 100644 index ac5fd0c558af..000000000000 --- a/vcl/source/glyphs/graphite_textsrc.cxx +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" - -// We need this to enable namespace support in libgrengine headers. -#define GR_NAMESPACE - -// Header files -// -// Standard Library -#include <string> -#include <cassert> -#include "graphite_textsrc.hxx" -#include <graphite_features.hxx> - -// class TextSourceAdaptor implementation. -// -TextSourceAdaptor::~TextSourceAdaptor() -{ - delete mpFeatures; -} - -gr::UtfType TextSourceAdaptor::utfEncodingForm() { - return gr::kutf16; -} - - -size_t TextSourceAdaptor::getLength() -{ - return maLayoutArgs.mnLength; -} - - -size_t TextSourceAdaptor::fetch(gr::toffset, size_t, gr::utf32 *) -{ - assert(false); - return 0; -} - - -size_t TextSourceAdaptor::fetch(gr::toffset offset, size_t char_count, gr::utf16 * char_buffer) -{ - assert(char_buffer); - - size_t copy_count = std::min(size_t(maLayoutArgs.mnLength), char_count); - std::copy(maLayoutArgs.mpStr + offset, maLayoutArgs.mpStr + offset + copy_count, char_buffer); - - return copy_count; -} - - -size_t TextSourceAdaptor::fetch(gr::toffset, size_t, gr::utf8 *) -{ - assert(false); - return 0; -} - - -inline void TextSourceAdaptor::getCharProperties(const int nCharIdx, int & min, int & lim, size_t & depth) -{ - maLayoutArgs.ResetPos(); - bool rtl = maLayoutArgs.mnFlags & SAL_LAYOUT_BIDI_RTL; - for(depth = ((rtl)? 1:0); maLayoutArgs.maRuns.GetRun(&min, &lim, &rtl); maLayoutArgs.maRuns.NextRun()) - { - if (min > nCharIdx) - break; - // Only increase the depth when a change of direction occurs. - depth += int(rtl ^ bool(depth & 0x1)); - if (min <= nCharIdx && nCharIdx < lim) - break; - } - // If there is no run for this position increment the depth, but don't - // change if this is out of bounds context - if (lim > 0 && nCharIdx >= lim && nCharIdx < maLayoutArgs.mnEndCharPos) - depth++; -} - - -bool TextSourceAdaptor::getRightToLeft(gr::toffset nCharIdx) -{ - size_t depth; - int min, lim = 0; - getCharProperties(nCharIdx, min, lim, depth); - //printf("getRtl %d,%x=%d\n", nCharIdx, maLayoutArgs.mpStr[nCharIdx], depth & 0x1); - return depth & 0x1; -} - - -unsigned int TextSourceAdaptor::getDirectionDepth(gr::toffset nCharIdx) -{ - size_t depth; - int min, lim; - getCharProperties(nCharIdx, min, lim, depth); - //printf("getDirectionDepth %d,%x=%d\n", nCharIdx, maLayoutArgs.mpStr[nCharIdx], depth); - return depth; -} - - -float TextSourceAdaptor::getVerticalOffset(gr::toffset) -{ - return 0.0f; //TODO: Implement correctly -} - -gr::isocode TextSourceAdaptor::getLanguage(gr::toffset) -{ - if (mpFeatures && mpFeatures->hasLanguage()) - return mpFeatures->getLanguage(); - gr::isocode unknown = {{0,0,0,0}}; - return unknown; -} - -ext_std::pair<gr::toffset, gr::toffset> TextSourceAdaptor::propertyRange(gr::toffset nCharIdx) -{ - - if (nCharIdx < unsigned(maLayoutArgs.mnMinCharPos)) - return ext_std::make_pair(0, maLayoutArgs.mnMinCharPos); - - if (nCharIdx < mnEnd) - return ext_std::make_pair(maLayoutArgs.mnMinCharPos, mnEnd); - - return ext_std::make_pair(mnEnd, maLayoutArgs.mnLength); -} - -size_t TextSourceAdaptor::getFontFeatures(gr::toffset, gr::FeatureSetting * settings) -{ - if (mpFeatures) return mpFeatures->getFontFeatures(settings); - return 0; -} - - -bool TextSourceAdaptor::sameSegment(gr::toffset char_idx1, gr::toffset char_idx2) -{ - const ext_std::pair<gr::toffset, gr::toffset> - range1 = propertyRange(char_idx1), - range2 = propertyRange(char_idx2); - - return range1 == range2; -} - -void TextSourceAdaptor::setFeatures(const grutils::GrFeatureParser * pFeatures) -{ - mpFeatures = new grutils::GrFeatureParser(*pFeatures); -} diff --git a/vcl/source/glyphs/graphite_textsrc.hxx b/vcl/source/glyphs/graphite_textsrc.hxx deleted file mode 100644 index ece01cc1a532..000000000000 --- a/vcl/source/glyphs/graphite_textsrc.hxx +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_GRAPHITETEXTSRC_HXX -#define _SV_GRAPHITETEXTSRC_HXX -// Description: Implements the Graphite interfaces IGrTextSource and -// IGrGraphics which provide Graphite with access to the -// app's text storage system and the platform's font and -// graphics systems. - -// We need this to enable namespace support in libgrengine headers. -#define GR_NAMESPACE - -// Standard Library -#include <stdexcept> -// Platform - -#ifndef _SVWIN_H -#include <tools/svwin.h> -#endif - -#include <svsys.h> -#include <salgdi.hxx> -#include <sallayout.hxx> - -// Module -#include "vcl/dllapi.h" - -// Libraries -#include <preextstl.h> -#include <graphite/GrClient.h> -#include <graphite/Font.h> -#include <graphite/ITextSource.h> -#include <postextstl.h> - -// Module type definitions and forward declarations. -// -namespace grutils -{ - class GrFeatureParser; -} -// Implements the Adaptor pattern to adapt the LayoutArgs and the ServerFont interfaces to the -// gr::IGrTextSource interface. -// @author tse -// -class TextSourceAdaptor : public gr::ITextSource -{ -public: - TextSourceAdaptor(ImplLayoutArgs &layout_args, const int nContextLen) throw(); - ~TextSourceAdaptor(); - virtual gr::UtfType utfEncodingForm(); - virtual size_t getLength(); - virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf32 * prgchBuffer); - virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer); - virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf8 * prgchsBuffer); - virtual bool getRightToLeft(gr::toffset ich); - virtual unsigned int getDirectionDepth(gr::toffset ich); - virtual float getVerticalOffset(gr::toffset ich); - virtual gr::isocode getLanguage(gr::toffset ich); - - virtual ext_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); - virtual bool featureVariations() { return false; } - - operator ImplLayoutArgs & () throw(); - void setFeatures(const grutils::GrFeatureParser * pFeatures); - const ImplLayoutArgs & getLayoutArgs() const { return maLayoutArgs; } - size_t getContextLength() const { return mnEnd; }; - inline void switchLayoutArgs(ImplLayoutArgs & newArgs); -private: - // Prevent the generation of a default assignment operator. - TextSourceAdaptor & operator=(const TextSourceAdaptor &); - - void getCharProperties(const int, int &, int &, size_t &); - - ImplLayoutArgs maLayoutArgs; - size_t mnEnd; - const grutils::GrFeatureParser * mpFeatures; -}; - -inline TextSourceAdaptor::TextSourceAdaptor(ImplLayoutArgs &la, const int nContextLen) throw() - : maLayoutArgs(la), - mnEnd(std::min(la.mnLength, nContextLen)), - mpFeatures(NULL) -{ -} - -inline TextSourceAdaptor::operator ImplLayoutArgs & () throw() { - return maLayoutArgs; -} - -inline void TextSourceAdaptor::switchLayoutArgs(ImplLayoutArgs & aNewArgs) -{ - mnEnd += aNewArgs.mnMinCharPos - maLayoutArgs.mnMinCharPos; - maLayoutArgs = aNewArgs; -} - -#endif diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx index f541ad92b552..d86a0a07bedf 100644 --- a/vcl/source/helper/canvasbitmap.cxx +++ b/vcl/source/helper/canvasbitmap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,7 @@ #include <com/sun/star/rendering/RenderingIntent.hpp> #include <rtl/instance.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/diagnose_ex.h> #include <canvasbitmap.hxx> @@ -367,7 +368,7 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : break; default: - DBG_ERROR( "unsupported bitmap format" ); + OSL_FAIL( "unsupported bitmap format" ); break; } @@ -445,20 +446,20 @@ VclCanvasBitmap::~VclCanvasBitmap() // XBitmap geometry::IntegerSize2D SAL_CALL VclCanvasBitmap::getSize() throw (uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return integerSize2DFromSize( m_aBitmap.GetSizePixel() ); } ::sal_Bool SAL_CALL VclCanvasBitmap::hasAlpha() throw (uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return m_aBmpEx.IsTransparent(); } uno::Reference< rendering::XBitmap > SAL_CALL VclCanvasBitmap::getScaledBitmap( const geometry::RealSize2D& newSize, sal_Bool beFast ) throw (uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; BitmapEx aNewBmp( m_aBitmap ); aNewBmp.Scale( sizeFromRealSize2D( newSize ), beFast ? BMP_SCALE_FAST : BMP_SCALE_INTERPOLATE ); @@ -471,7 +472,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB rendering::VolatileContentDestroyedException, uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; bitmapLayout = getMemoryLayout(); @@ -576,7 +577,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getPixel( rendering::Integer rendering::VolatileContentDestroyedException, uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; bitmapLayout = getMemoryLayout(); @@ -642,7 +643,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getPixel( rendering::Integer uno::Reference< rendering::XBitmapPalette > SAL_CALL VclCanvasBitmap::getPalette() throw (uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Reference< XBitmapPalette > aRet; if( m_bPalette ) @@ -653,7 +654,7 @@ uno::Reference< rendering::XBitmapPalette > SAL_CALL VclCanvasBitmap::getPalette rendering::IntegerBitmapLayout SAL_CALL VclCanvasBitmap::getMemoryLayout() throw (uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; rendering::IntegerBitmapLayout aLayout( m_aLayout ); @@ -670,7 +671,7 @@ rendering::IntegerBitmapLayout SAL_CALL VclCanvasBitmap::getMemoryLayout() throw sal_Int32 SAL_CALL VclCanvasBitmap::getNumberOfEntries() throw (uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( !m_pBmpAcc ) return 0; @@ -680,13 +681,13 @@ sal_Int32 SAL_CALL VclCanvasBitmap::getNumberOfEntries() throw (uno::RuntimeExce sal_Bool SAL_CALL VclCanvasBitmap::getIndex( uno::Sequence< double >& o_entry, sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_uInt16 nCount( m_pBmpAcc ? (m_pBmpAcc->HasPalette() ? m_pBmpAcc->GetPaletteEntryCount() : 0 ) : 0 ); OSL_ENSURE(nIndex >= 0 && nIndex < nCount,"Palette index out of range"); if( nIndex < 0 || nIndex >= nCount ) - throw lang::IndexOutOfBoundsException(::rtl::OUString::createFromAscii("Palette index out of range"), + throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Palette index out of range")), static_cast<rendering::XBitmapPalette*>(this)); const BitmapColor aCol = m_pBmpAcc->GetPaletteColor(sal::static_int_cast<sal_uInt16>(nIndex)); @@ -701,14 +702,14 @@ sal_Bool SAL_CALL VclCanvasBitmap::getIndex( uno::Sequence< double >& o_entry, s sal_Bool SAL_CALL VclCanvasBitmap::setIndex( const uno::Sequence< double >&, sal_Bool, sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, lang::IllegalArgumentException, uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_uInt16 nCount( m_pBmpAcc ? (m_pBmpAcc->HasPalette() ? m_pBmpAcc->GetPaletteEntryCount() : 0 ) : 0 ); OSL_ENSURE(nIndex >= 0 && nIndex < nCount,"Palette index out of range"); if( nIndex < 0 || nIndex >= nCount ) - throw lang::IndexOutOfBoundsException(::rtl::OUString::createFromAscii("Palette index out of range"), + throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Palette index out of range")), static_cast<rendering::XBitmapPalette*>(this)); return sal_False; // read-only implementation @@ -740,7 +741,7 @@ sal_Int8 SAL_CALL VclCanvasBitmap::getType( ) throw (uno::RuntimeException) uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::getComponentTags( ) throw (uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return m_aComponentTags; } @@ -766,7 +767,7 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertColorSpace( const uno:: uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertToRGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_Size nLen( deviceColor.getLength() ); const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength()); @@ -815,7 +816,7 @@ uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertToRGB( const uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_Size nLen( deviceColor.getLength() ); const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength()); @@ -868,7 +869,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToARGB( con uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToPARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_Size nLen( deviceColor.getLength() ); const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength()); @@ -921,7 +922,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToPARGB( co uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromRGB( const uno::Sequence<rendering::RGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_Size nLen( rgbColor.getLength() ); const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength()); @@ -961,7 +962,7 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromRGB( const uno::Seq uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_Size nLen( rgbColor.getLength() ); const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength()); @@ -1001,7 +1002,7 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromARGB( const uno::Se uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromPARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_Size nLen( rgbColor.getLength() ); const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength()); @@ -1043,19 +1044,19 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromPARGB( const uno::S sal_Int32 SAL_CALL VclCanvasBitmap::getBitsPerPixel( ) throw (uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return m_nBitsPerOutputPixel; } uno::Sequence< ::sal_Int32 > SAL_CALL VclCanvasBitmap::getComponentBitCounts( ) throw (uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return m_aComponentBitCounts; } sal_Int8 SAL_CALL VclCanvasBitmap::getEndianness( ) throw (uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return m_nEndianness; } @@ -1064,7 +1065,7 @@ uno::Sequence<double> SAL_CALL VclCanvasBitmap::convertFromIntegerColorSpace( co { if( dynamic_cast<VclCanvasBitmap*>(targetColorSpace.get()) ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_Size nLen( deviceColor.getLength() ); const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength()); @@ -1143,7 +1144,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertToIntegerColorSpace uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) ); const sal_Size nLen( deviceColor.getLength() ); @@ -1198,7 +1199,7 @@ uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToRGB uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) ); const sal_Size nLen( deviceColor.getLength() ); @@ -1256,7 +1257,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToAR uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) ); const sal_Size nLen( deviceColor.getLength() ); @@ -1315,7 +1316,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToPA uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( const uno::Sequence<rendering::RGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_Size nLen( rgbColor.getLength() ); const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8); @@ -1364,7 +1365,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( con uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_Size nLen( rgbColor.getLength() ); const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8); @@ -1413,7 +1414,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( co uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromPARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_Size nLen( rgbColor.getLength() ); const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8); @@ -1465,3 +1466,5 @@ BitmapEx VclCanvasBitmap::getBitmapEx() const { return m_aBmpEx; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx index 1ab4f9a619d0..ac8e658f7bd8 100644 --- a/vcl/source/helper/canvastools.cxx +++ b/vcl/source/helper/canvastools.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,7 +72,7 @@ #include <canvasbitmap.hxx> #include <vcl/canvastools.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> using namespace ::com::sun::star; @@ -186,8 +187,8 @@ namespace vcl const uno::Sequence< sal_Int8 > getTunnelIdentifier( TunnelIdentifierType eType ) { - static std::hash_map< int, uno::Sequence< sal_Int8 > > aIds; - std::hash_map< int, uno::Sequence< sal_Int8 > >::iterator it = + static boost::unordered_map< int, uno::Sequence< sal_Int8 > > aIds; + boost::unordered_map< int, uno::Sequence< sal_Int8 > >::iterator it = aIds.find( eType ); if( it == aIds.end() ) { @@ -219,8 +220,8 @@ namespace vcl sal_Int32 nHeight, const rendering::IntegerBitmapLayout& rLayout, const uno::Reference< rendering::XIntegerReadOnlyBitmap >& xInputBitmap, - ScopedBitmapWriteAccess& rWriteAcc, - ScopedBitmapWriteAccess& rAlphaAcc ) + Bitmap::ScopedWriteAccess& rWriteAcc, + Bitmap::ScopedWriteAccess& rAlphaAcc ) { rendering::IntegerBitmapLayout aCurrLayout; geometry::IntegerRectangle2D aRect; @@ -432,9 +433,8 @@ namespace vcl sal::static_int_cast<sal_uInt16>(1L << nAlphaDepth)) ); { // limit scoped access - ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(), - aBitmap ); - ScopedBitmapWriteAccess pAlphaWriteAccess( nAlphaDepth ? aAlpha.AcquireWriteAccess() : NULL, + Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); + Bitmap::ScopedWriteAccess pAlphaWriteAccess( nAlphaDepth ? aAlpha.AcquireWriteAccess() : NULL, aAlpha ); ENSURE_OR_THROW(pWriteAccess.get() != NULL, @@ -819,13 +819,13 @@ namespace vcl const uno::Sequence< double > rColor, const uno::Reference< rendering::XColorSpace >& xColorSpace ) { - const rendering::ARGBColor& rARGBColor( + const rendering::ARGBColor aARGBColor( xColorSpace->convertToARGB(rColor)[0]); - return Color( 255-toByteColor(rARGBColor.Alpha), - toByteColor(rARGBColor.Red), - toByteColor(rARGBColor.Green), - toByteColor(rARGBColor.Blue) ); + return Color( 255-toByteColor(aARGBColor.Alpha), + toByteColor(aARGBColor.Red), + toByteColor(aARGBColor.Green), + toByteColor(aARGBColor.Blue) ); } //--------------------------------------------------------------------------------------- @@ -835,3 +835,5 @@ namespace vcl } // namespace canvas // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/helper/evntpost.cxx b/vcl/source/helper/evntpost.cxx index 9e200a3136c3..a8a68640ec36 100644 --- a/vcl/source/helper/evntpost.cxx +++ b/vcl/source/helper/evntpost.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,3 +64,5 @@ IMPL_LINK_INLINE_START( EventPoster, DoEvent_Impl, UserEvent*, pEvent ) IMPL_LINK_INLINE_END( EventPoster, DoEvent_Impl, UserEvent*, pEvent ) } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/helper/lazydelete.cxx b/vcl/source/helper/lazydelete.cxx index b8ede1b5220a..3fa046bc076c 100644 --- a/vcl/source/helper/lazydelete.cxx +++ b/vcl/source/helper/lazydelete.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -123,3 +124,4 @@ void DeleteOnDeinitBase::ImplDeleteOnDeInit() #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx index b1da78ebbf23..c8b5cc7fbf22 100644 --- a/vcl/source/helper/strhelper.cxx +++ b/vcl/source/helper/strhelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -440,3 +441,5 @@ ByteString WhitespaceToSpace( const ByteString& rLine, sal_Bool bProtect ) } } // namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx index cff1ec4a7d82..ad351410e2c2 100644 --- a/vcl/source/helper/threadex.cxx +++ b/vcl/source/helper/threadex.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -101,7 +102,7 @@ IMPL_LINK( SolarThreadExecutor, worker, void*, EMPTYARG ) long SolarThreadExecutor::impl_execute( const TimeValue* _pTimeout ) { - if( ::vos::OThread::getCurrentIdentifier() == Application::GetMainThreadIdentifier() ) + if( ::osl::Thread::getCurrentIdentifier() == Application::GetMainThreadIdentifier() ) { osl_setCondition( m_aStart ); m_nReturn = doIt(); @@ -125,3 +126,5 @@ long SolarThreadExecutor::impl_execute( const TimeValue* _pTimeout ) } return m_nReturn; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx index d8bd96cfd0cf..5250cc067b25 100644 --- a/vcl/source/helper/xconnection.cxx +++ b/vcl/source/helper/xconnection.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,31 +41,12 @@ namespace css = com::sun::star; } -namespace vcl -{ - class SolarMutexReleaser - { - sal_uLong mnReleased; - public: - SolarMutexReleaser() - { - mnReleased = Application::ReleaseSolarMutex(); - } - - ~SolarMutexReleaser() - { - if( mnReleased ) - Application::AcquireSolarMutex( mnReleased ); - } - }; -} - -using namespace rtl; using namespace osl; using namespace vcl; using namespace com::sun::star::uno; using namespace com::sun::star::awt; +using ::rtl::OUString; DisplayConnection::DisplayConnection() { @@ -178,3 +160,5 @@ bool DisplayConnection::dispatchErrorEvent( void* pData, int nBytes ) return false; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/salmain/salmain.cxx b/vcl/source/salmain/salmain.cxx index 56f197966276..80e853b3b654 100644 --- a/vcl/source/salmain/salmain.cxx +++ b/vcl/source/salmain/salmain.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,5 +38,7 @@ SAL_IMPLEMENT_MAIN() { tools::extendApplicationEnvironment(); - return SVMain() ? EXIT_SUCCESS : EXIT_FAILURE; + return SVMain(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/src/btntext.src b/vcl/source/src/btntext.src index a8962044b47d..c0303aac0f1f 100644 --- a/vcl/source/src/btntext.src +++ b/vcl/source/src/btntext.src @@ -66,7 +66,7 @@ String SV_BUTTONTEXT_MORE String SV_BUTTONTEXT_LESS { - Text [ en-US ] = "~More"; + Text [ en-US ] = "~Less"; }; String SV_BUTTONTEXT_IGNORE @@ -78,4 +78,3 @@ String SV_BUTTONTEXT_ABORT { Text [ en-US ] = "~Abort"; }; - diff --git a/vcl/source/src/helptext.src b/vcl/source/src/helptext.src index f66683bfd5dc..1f3def6f8cd4 100644 --- a/vcl/source/src/helptext.src +++ b/vcl/source/src/helptext.src @@ -136,26 +136,3 @@ String SV_SHORTCUT_SPLITTER { Text [ en-US ] = "Split window separator" ; }; - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src index 987ee29277c7..f836306cba45 100644 --- a/vcl/source/src/images.src +++ b/vcl/source/src/images.src @@ -33,7 +33,7 @@ Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_STDOFFSET) { - File = "check.bmp"; + File = "check.png"; }; @@ -44,19 +44,19 @@ Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_MONOOFFSET) Bitmap (SV_RESID_BITMAP_SCROLLBMP) { - File = "scrbmp.bmp"; + File = "scrbmp.png"; }; Bitmap (SV_RESID_BITMAP_SCROLLMSK) { - File = "scrmsk.bmp"; + File = "scrmsk.png"; }; // ----------------------------------------------------------------------- Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_STDOFFSET) { - File = "radio.bmp"; + File = "radio.png"; }; Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_MONOOFFSET) @@ -64,63 +64,41 @@ Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_MONOOFFSET) File = "radiomono.bmp"; }; -// ----------------------------------------------------------------------- - Bitmap SV_RESID_BITMAP_MSGBOX { File = "msgbox.png"; }; -// ----------------------------------------------------------------------- - -Bitmap SV_RESID_BITMAP_MSGBOX_HC -{ - File = "msgbox_hc.png"; -}; - -// ----------------------------------------------------------------------- - Bitmap SV_RESID_BITMAP_PIN { - File = "pin.bmp"; + File = "pin.png"; }; -// ----------------------------------------------------------------------- - Bitmap SV_RESID_BITMAP_CLOSEDOC { - File = "closedoc.bmp"; -}; - -Bitmap SV_RESID_BITMAP_CLOSEDOCHC -{ - File = "closedochc.bmp"; + File = "closedoc.png"; }; -// ----------------------------------------------------------------------- - Bitmap SV_RESID_BITMAP_SPLITHPIN { - File = "splhpin.bmp"; + File = "splhpin.png"; }; Bitmap SV_RESID_BITMAP_SPLITVPIN { - File = "splvpin.bmp"; + File = "splvpin.png"; }; Bitmap SV_RESID_BITMAP_SPLITHARW { - File = "splharw.bmp"; + File = "splharw.png"; }; Bitmap SV_RESID_BITMAP_SPLITVARW { - File = "splvarw.bmp"; + File = "splvarw.png"; }; -// ----------------------------------------------------------------------- - Bitmap (SV_ICON_SIZE48_START) { File = "mainapp_48_8.png" ; @@ -419,16 +397,6 @@ Bitmap (SV_ICON_SMALL_START) File = "mainapp_16.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START) -{ - File = "mainapp_32_h.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START) -{ - File = "mainapp_16_h.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_OFFICE) { File = "mainapp_32.png" ; @@ -439,16 +407,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_OFFICE) File = "mainapp_16.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_OFFICE) -{ - File = "mainapp_32_h.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_OFFICE) -{ - File = "mainapp_16_h" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_TEXT) { File = "lx03251.png" ; @@ -459,16 +417,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_TEXT) File = "sx03251.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_TEXT) -{ - File = "lxh03251.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_TEXT) -{ - File = "sxh03251.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_TEXT_TEMPLATE) { File = "lx03255.png" ; @@ -479,16 +427,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_TEXT_TEMPLATE) File = "sx03255.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_TEXT_TEMPLATE) -{ - File = "lxh03255.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_TEXT_TEMPLATE) -{ - File = "sxh03255.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_SPREADSHEET) { File = "lx03250.png" ; @@ -499,16 +437,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_SPREADSHEET) File = "sx03250.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_SPREADSHEET) -{ - File = "lxh03250.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_SPREADSHEET) -{ - File = "sxh03250.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_SPREADSHEET_TEMPLATE) { File = "lx03254.png" ; @@ -519,16 +447,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_SPREADSHEET_TEMPLATE) File = "sx03254.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_SPREADSHEET_TEMPLATE) -{ - File = "lxh03254.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_SPREADSHEET_TEMPLATE) -{ - File = "sxh03254.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_DRAWING) { File = "lx03246.png" ; @@ -539,16 +457,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_DRAWING) File = "sx03246.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_DRAWING) -{ - File = "lxh03246.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_DRAWING) -{ - File = "sxh03246.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_DRAWING_TEMPLATE) { File = "lx03252.png" ; @@ -559,16 +467,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_DRAWING_TEMPLATE) File = "sx03252.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_DRAWING_TEMPLATE) -{ - File = "lxh03252.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_DRAWING_TEMPLATE) -{ - File = "sxh03252.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_PRESENTATION) { File = "lx03249.png" ; @@ -579,16 +477,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_PRESENTATION) File = "sx03249.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_PRESENTATION) -{ - File = "lxh03249.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_PRESENTATION) -{ - File = "sxh03249.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_PRESENTATION_TEMPLATE) { File = "lx03253.png" ; @@ -599,16 +487,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_PRESENTATION_TEMPLATE) File = "sx03253.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_PRESENTATION_TEMPLATE) -{ - File = "lxh03253.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_PRESENTATION_TEMPLATE) -{ - File = "sxh03253.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_PRESENTATION_COMPRESSED) { File = "lx03241.png" ; @@ -619,16 +497,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_PRESENTATION_COMPRESSED) File = "sx03241.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_PRESENTATION_COMPRESSED) -{ - File = "lxh03241.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_PRESENTATION_COMPRESSED) -{ - File = "sxh03241.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_MASTER_DOCUMENT) { File = "lx03248.png" ; @@ -639,16 +507,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_MASTER_DOCUMENT) File = "sx03248.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_MASTER_DOCUMENT) -{ - File = "lxh03248.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_MASTER_DOCUMENT) -{ - File = "sxh03248.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_HTML_DOCUMENT) { File = "lx03139.png" ; @@ -659,16 +517,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_HTML_DOCUMENT) File = "sx03139.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_HTML_DOCUMENT) -{ - File = "lxh03139.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_HTML_DOCUMENT) -{ - File = "sxh03139.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_CHART) { File = "lx03128.png" ; @@ -679,16 +527,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_CHART) File = "sx03128.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_CHART) -{ - File = "lxh03128.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_CHART) -{ - File = "sxh03128.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_DATABASE) { File = "lx03245.png" ; @@ -699,16 +537,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_DATABASE) File = "sx03245.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_DATABASE) -{ - File = "lxh03245.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_DATABASE) -{ - File = "sxh03245.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_FORMULA) { File = "lx03247.png" ; @@ -719,16 +547,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_FORMULA) File = "sx03247.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_FORMULA) -{ - File = "lxh03247.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_FORMULA) -{ - File = "sxh03247.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_TEMPLATE) { File = "lx03242.png" ; @@ -739,16 +557,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_TEMPLATE) File = "sx03242.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_TEMPLATE) -{ - File = "lxh03242.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_TEMPLATE) -{ - File = "sxh03242.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_MACRO) { File = "lx03216.png" ; @@ -759,16 +567,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_MACRO) File = "sx03216.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_MACRO) -{ - File = "lxh03216.png" ; -}; - -Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_MACRO) -{ - File = "sxh03216.png" ; -}; - Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_PRINTERADMIN) { File = "printeradmin_32.png" ; @@ -779,33 +577,13 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_PRINTERADMIN) File = "printeradmin_16.png" ; }; -Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_PRINTERADMIN) -{ - File = "printeradmin_32_h.png" ; -}; - -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/print.src b/vcl/source/src/print.src index 82b0c00c2e15..e1dab9679bda 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -403,16 +403,6 @@ ModalDialog SV_DLG_PRINT 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" ; }; - }; - CheckBox SV_PRINT_OPT_REVERSE { HelpID = ".HelpID:vcl:PrintDialog:OptPage:ToReverse"; diff --git a/vcl/source/src/throbber.src b/vcl/source/src/throbber.src index d3c5ea44035c..d3c5ea44035c 100755..100644 --- a/vcl/source/src/throbber.src +++ b/vcl/source/src/throbber.src diff --git a/vcl/source/src/units.src b/vcl/source/src/units.src index ea5f6ecad2ce..24023569aaeb 100644 --- a/vcl/source/src/units.src +++ b/vcl/source/src/units.src @@ -28,6 +28,7 @@ #include <svids.hrc> +// Amelia : adds two units , 'ch' and 'line' StringArray SV_FUNIT_STRINGS { ItemList [ en-US ] = @@ -39,7 +40,7 @@ StringArray SV_FUNIT_STRINGS < "twips" ; FUNIT_TWIP ; > ; < "twip" ; FUNIT_TWIP ; > ; < "pt" ; FUNIT_POINT ; > ; - < "pi" ; FUNIT_PICA ; > ; + < "pc" ; FUNIT_PICA ; > ; < "\"" ; FUNIT_INCH ; > ; < "in" ; FUNIT_INCH ; > ; < "inch" ; FUNIT_INCH ; > ; @@ -49,6 +50,8 @@ StringArray SV_FUNIT_STRINGS < "feet" ; FUNIT_FOOT ; > ; < "miles" ; FUNIT_MILE ; > ; < "mile" ; FUNIT_MILE ; > ; + < "ch" ; FUNIT_CHAR ; > ; + < "line" ; FUNIT_LINE ; > ; < "%" ; FUNIT_PERCENT ; > ; }; }; diff --git a/vcl/source/window/abstdlg.cxx b/vcl/source/window/abstdlg.cxx index 58f235bea25e..19b12b78ba17 100644 --- a/vcl/source/window/abstdlg.cxx +++ b/vcl/source/window/abstdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,9 +42,10 @@ VclAbstractDialogFactory* VclAbstractDialogFactory::Create() { FuncPtrCreateDialogFactory fp = 0; static ::osl::Module aDialogLibrary; - if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( RTL_CONSTASCII_USTRINGPARAM( CUI_DLL_NAME ) ) ) ) + if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( RTL_CONSTASCII_USTRINGPARAM( CUI_DLL_NAME ) ), + SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ) ) fp = ( VclAbstractDialogFactory* (__LOADONCALLAPI*)() ) - aDialogLibrary.getFunctionSymbol( ::rtl::OUString::createFromAscii("CreateDialogFactory") ); + aDialogLibrary.getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDialogFactory")) ); if ( fp ) return fp(); return 0; @@ -61,3 +63,5 @@ VclAbstractDialog2::~VclAbstractDialog2() VclAbstractDialogFactory::~VclAbstractDialogFactory() { } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx index 29f6cc16a176..525c8ad5a76a 100644 --- a/vcl/source/window/accel.cxx +++ b/vcl/source/window/accel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <tools/list.hxx> + #include <tools/table.hxx> #include <tools/debug.hxx> #include <tools/rc.h> @@ -35,13 +36,12 @@ #include <vcl/svapp.hxx> #include <accel.h> #include <vcl/accel.hxx> - - +#include <vector> // ======================================================================= DECLARE_TABLE( ImplAccelTable, ImplAccelEntry* ) -DECLARE_LIST( ImplAccelList, ImplAccelEntry* ) +typedef ::std::vector< ImplAccelEntry* > ImplAccelList; #define ACCELENTRY_NOTFOUND ((sal_uInt16)0xFFFF) @@ -63,14 +63,14 @@ DBG_NAME( Accelerator ) sal_uInt16 ImplAccelEntryGetIndex( ImplAccelList* pList, sal_uInt16 nId, sal_uInt16* pIndex = NULL ) { - sal_uLong nLow; - sal_uLong nHigh; - sal_uLong nMid; - sal_uLong nCount = pList->Count(); + size_t nLow; + size_t nHigh; + size_t nMid; + size_t nCount = pList->size(); sal_uInt16 nCompareId; // Abpruefen, ob der erste Key groesser als der Vergleichskey ist - if ( !nCount || (nId < pList->GetObject( 0 )->mnId) ) + if ( !nCount || (nId < (*pList)[ 0 ]->mnId) ) { if ( pIndex ) *pIndex = 0; @@ -83,7 +83,7 @@ sal_uInt16 ImplAccelEntryGetIndex( ImplAccelList* pList, sal_uInt16 nId, do { nMid = (nLow + nHigh) / 2; - nCompareId = pList->GetObject( nMid )->mnId; + nCompareId = (*pList)[ nMid ]->mnId; if ( nId < nCompareId ) nHigh = nMid-1; else @@ -119,16 +119,31 @@ static void ImplAccelEntryInsert( ImplAccelList* pList, ImplAccelEntry* pEntry ) do { nIndex++; - ImplAccelEntry* pTempEntry = pList->GetObject( nIndex ); + ImplAccelEntry* pTempEntry = NULL; + if ( nIndex < pList->size() ) + pTempEntry = (*pList)[ nIndex ]; if ( !pTempEntry || (pTempEntry->mnId != pEntry->mnId) ) break; } - while ( nIndex < pList->Count() ); - - pList->Insert( pEntry, (sal_uLong)nIndex ); + while ( nIndex < pList->size() ); + + if ( nIndex < pList->size() ) { + ImplAccelList::iterator it = pList->begin(); + ::std::advance( it, nIndex ); + pList->insert( it, pEntry ); + } else { + pList->push_back( pEntry ); + } + } + else { + if ( nInsIndex < pList->size() ) { + ImplAccelList::iterator it = pList->begin(); + ::std::advance( it, nInsIndex ); + pList->insert( it, pEntry ); + } else { + pList->push_back( pEntry ); + } } - else - pList->Insert( pEntry, (sal_uLong)nInsIndex ); } // ----------------------------------------------------------------------- @@ -141,11 +156,11 @@ static sal_uInt16 ImplAccelEntryGetFirstPos( ImplAccelList* pList, sal_uInt16 nI while ( nIndex ) { nIndex--; - if ( pList->GetObject( nIndex )->mnId != nId ) + if ( (*pList)[ nIndex ]->mnId != nId ) break; } - if ( pList->GetObject( nIndex )->mnId != nId ) + if ( (*pList)[ nIndex ]->mnId != nId ) nIndex++; } @@ -174,10 +189,9 @@ ImplAccelEntry* Accelerator::ImplGetAccelData( const KeyCode& rKeyCode ) const void Accelerator::ImplCopyData( ImplAccelData& rAccelData ) { // Tabellen kopieren - ImplAccelEntry* pEntry = rAccelData.maIdList.First(); - while ( pEntry ) + for ( size_t i = 0, n = rAccelData.maIdList.size(); i < n; ++i ) { - pEntry = new ImplAccelEntry( *pEntry ); + ImplAccelEntry* pEntry = new ImplAccelEntry( *rAccelData.maIdList[ i ] ); // Folge-Accelerator, dann auch kopieren if ( pEntry->mpAccel ) @@ -189,9 +203,7 @@ void Accelerator::ImplCopyData( ImplAccelData& rAccelData ) pEntry->mpAutoAccel = NULL; mpData->maKeyTable.Insert( (sal_uLong)pEntry->maKeyCode.GetFullKeyCode(), pEntry ); - mpData->maIdList.Insert( pEntry, LIST_APPEND ); - - pEntry = rAccelData.maIdList.Next(); + mpData->maIdList.push_back( pEntry ); } } @@ -200,16 +212,14 @@ void Accelerator::ImplCopyData( ImplAccelData& rAccelData ) void Accelerator::ImplDeleteData() { // Accelerator-Eintraege ueber die Id-Tabelle loeschen - ImplAccelEntry* pEntry = mpData->maIdList.First(); - while ( pEntry ) - { - // AutoResAccel zerstoeren - if ( pEntry->mpAutoAccel ) + for ( size_t i = 0, n = mpData->maIdList.size(); i < n; ++i ) { + ImplAccelEntry* pEntry = mpData->maIdList[ i ]; + if ( pEntry->mpAutoAccel ) { delete pEntry->mpAutoAccel; + } delete pEntry; - - pEntry = mpData->maIdList.Next(); } + mpData->maIdList.clear(); } // ----------------------------------------------------------------------- @@ -256,12 +266,12 @@ void Accelerator::ImplInsertAccel( sal_uInt16 nItemId, const KeyCode& rKeyCode, sal_uLong nCode = rKeyCode.GetFullKeyCode(); if ( !nCode ) { - DBG_ERROR( "Accelerator::InsertItem(): KeyCode with KeyCode 0 not allowed" ); + OSL_FAIL( "Accelerator::InsertItem(): KeyCode with KeyCode 0 not allowed" ); delete pEntry; } else if ( !mpData->maKeyTable.Insert( nCode, pEntry ) ) { - DBG_ERROR1( "Accelerator::InsertItem(): KeyCode (Key: %lx) already exists", nCode ); + OSL_TRACE( "Accelerator::InsertItem(): KeyCode (Key: %lx) already exists", nCode ); delete pEntry; } else @@ -411,11 +421,14 @@ void Accelerator::RemoveItem( sal_uInt16 nItemId ) sal_uInt16 nItemCount = GetItemCount(); do { - ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nIndex ); + ImplAccelEntry* pEntry = ( nIndex < mpData->maIdList.size() ) ? mpData->maIdList[ nIndex ] : NULL; if ( pEntry && pEntry->mnId == nItemId ) { mpData->maKeyTable.Remove( pEntry->maKeyCode.GetFullKeyCode() ); - mpData->maIdList.Remove( (sal_uLong)nIndex ); + + ImplAccelList::iterator it = mpData->maIdList.begin(); + ::std::advance( it, nIndex ); + mpData->maIdList.erase( it ); // AutoResAccel zerstoeren if ( pEntry->mpAutoAccel ) @@ -444,14 +457,17 @@ void Accelerator::RemoveItem( const KeyCode rKeyCode ) sal_uInt16 nItemCount = GetItemCount(); do { - if ( mpData->maIdList.GetObject( (sal_uLong)nIndex ) == pEntry ) + if ( mpData->maIdList[ nIndex ] == pEntry ) break; nIndex++; } while ( nIndex < nItemCount ); mpData->maKeyTable.Remove( rKeyCode.GetFullKeyCode() ); - mpData->maIdList.Remove( (sal_uLong)nIndex ); + + ImplAccelList::iterator it = mpData->maIdList.begin(); + ::std::advance( it, nIndex ); + mpData->maIdList.erase( it ); // AutoResAccel zerstoeren if ( pEntry->mpAutoAccel ) @@ -469,7 +485,6 @@ void Accelerator::Clear() ImplDeleteData(); mpData->maKeyTable.Clear(); - mpData->maIdList.Clear(); } // ----------------------------------------------------------------------- @@ -478,7 +493,7 @@ sal_uInt16 Accelerator::GetItemCount() const { DBG_CHKTHIS( Accelerator, NULL ); - return (sal_uInt16)mpData->maIdList.Count(); + return (sal_uInt16)mpData->maIdList.size(); } // ----------------------------------------------------------------------- @@ -487,7 +502,7 @@ sal_uInt16 Accelerator::GetItemId( sal_uInt16 nPos ) const { DBG_CHKTHIS( Accelerator, NULL ); - ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nPos ); + ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL; if ( pEntry ) return pEntry->mnId; else @@ -500,7 +515,7 @@ KeyCode Accelerator::GetItemKeyCode( sal_uInt16 nPos ) const { DBG_CHKTHIS( Accelerator, NULL ); - ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nPos ); + ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL; if ( pEntry ) return pEntry->maKeyCode; else @@ -528,7 +543,7 @@ KeyCode Accelerator::GetKeyCode( sal_uInt16 nItemId ) const sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); if ( nIndex != ACCELENTRY_NOTFOUND ) - return mpData->maIdList.GetObject( (sal_uLong)nIndex )->maKeyCode; + return mpData->maIdList[ nIndex ]->maKeyCode; else return KeyCode(); } @@ -596,7 +611,7 @@ void Accelerator::SetAccel( sal_uInt16 nItemId, Accelerator* pAccel ) sal_uInt16 nItemCount = GetItemCount(); do { - ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nIndex ); + ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ]; if ( pEntry->mnId != nItemId ) break; @@ -615,7 +630,7 @@ Accelerator* Accelerator::GetAccel( sal_uInt16 nItemId ) const sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); if ( nIndex != ACCELENTRY_NOTFOUND ) - return mpData->maIdList.GetObject( (sal_uLong)nIndex )->mpAccel; + return mpData->maIdList[ nIndex ]->mpAccel; else return NULL; } @@ -656,7 +671,7 @@ void Accelerator::EnableItem( sal_uInt16 nItemId, sal_Bool bEnable ) sal_uInt16 nItemCount = GetItemCount(); do { - ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nIndex ); + ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ]; if ( pEntry->mnId != nItemId ) break; @@ -675,7 +690,7 @@ sal_Bool Accelerator::IsItemEnabled( sal_uInt16 nItemId ) const sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); if ( nIndex != ACCELENTRY_NOTFOUND ) - return mpData->maIdList.GetObject( (sal_uLong)nIndex )->mbEnabled; + return mpData->maIdList[ nIndex ]->mbEnabled; else return sal_False; } @@ -721,8 +736,9 @@ Accelerator& Accelerator::operator=( const Accelerator& rAccel ) // Tabellen loeschen und kopieren ImplDeleteData(); mpData->maKeyTable.Clear(); - mpData->maIdList.Clear(); ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) ); return *this; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx index 0781b50eb37b..43c78d55adc1 100644 --- a/vcl/source/window/accmgr.cxx +++ b/vcl/source/window/accmgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,19 +28,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <tools/list.hxx> + #include <tools/debug.hxx> #include <accel.h> #include <vcl/accel.hxx> #include <accmgr.hxx> - - -// ======================================================================= - -DECLARE_LIST( ImplAccelList, Accelerator* ) - // ======================================================================= DBG_NAMEEX( Accelerator ) @@ -58,18 +53,17 @@ ImplAccelManager::~ImplAccelManager() sal_Bool ImplAccelManager::InsertAccel( Accelerator* pAccel ) { - if ( !mpAccelList ) + if ( !mpAccelList ) { mpAccelList = new ImplAccelList; - else - { - // Gibts den schon ? - if ( mpAccelList->GetPos( pAccel ) != LIST_ENTRY_NOTFOUND ) - return sal_False; + } else { + for ( size_t i = 0, n = mpAccelList->size(); i < n; ++i ) { + if ( (*mpAccelList)[ i ] == pAccel ) { + return sal_False; + } + } } - // Am Anfang der Liste einfuegen - mpAccelList->Insert( pAccel, (sal_uLong)0 ); - + mpAccelList->insert( mpAccelList->begin(), pAccel ); return sal_True; } @@ -85,21 +79,29 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel ) //end it, and then closes the dialog, deleting the accelerators. So if //we're removing an accelerator that a sub-accelerator which is in the //sequence list, throw away the entire sequence - if ( mpSequenceList ) - { - for (sal_uInt16 i = 0; i < pAccel->GetItemCount(); ++i) - { - Accelerator* pSubAccel = pAccel->GetAccel(pAccel->GetItemId(i)); - if ( mpSequenceList->GetPos( pSubAccel ) != LIST_ENTRY_NOTFOUND ) - { - EndSequence( true ); - break; + if ( mpSequenceList ) { + for (sal_uInt16 i = 0; i < pAccel->GetItemCount(); ++i) { + Accelerator* pSubAccel = pAccel->GetAccel( pAccel->GetItemId(i) ); + for ( size_t j = 0, n = mpSequenceList->size(); j < n; ++j ) { + if ( (*mpSequenceList)[ j ] == pSubAccel ) { + EndSequence( true ); + i = pAccel->GetItemCount(); + break; + } } } } // Raus damit - mpAccelList->Remove( pAccel ); + for ( ImplAccelList::iterator it = mpAccelList->begin(); + it < mpAccelList->end(); + ++it + ) { + if ( *it == pAccel ) { + mpAccelList->erase( it ); + break; + } + } } // ----------------------------------------------------------------------- @@ -111,9 +113,9 @@ void ImplAccelManager::EndSequence( sal_Bool bCancel ) return; // Alle Deactivate-Handler der Acceleratoren in der Sequenz rufen - Accelerator* pTempAccel = mpSequenceList->First(); - while( pTempAccel ) + for ( size_t i = 0, n = mpSequenceList->size(); i < n; ++i ) { + Accelerator* pTempAccel = (*mpSequenceList)[ i ]; sal_Bool bDel = sal_False; pTempAccel->mbIsCancel = bCancel; pTempAccel->mpDel = &bDel; @@ -123,8 +125,6 @@ void ImplAccelManager::EndSequence( sal_Bool bCancel ) pTempAccel->mbIsCancel = sal_False; pTempAccel->mpDel = NULL; } - - pTempAccel = mpSequenceList->Next(); } // Sequenz-Liste loeschen @@ -141,13 +141,13 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe // Haben wir ueberhaupt Acceleratoren ?? if ( !mpAccelList ) return sal_False; - if ( !mpAccelList->Count() ) + if ( mpAccelList->empty() ) return sal_False; // Sind wir in einer Sequenz ? if ( mpSequenceList ) { - pAccel = mpSequenceList->GetObject( 0 ); + pAccel = mpSequenceList->empty() ? NULL : (*mpSequenceList)[ 0 ]; DBG_CHKOBJ( pAccel, Accelerator, NULL ); // Nicht Gefunden ? @@ -169,7 +169,7 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe { DBG_CHKOBJ( pNextAccel, Accelerator, NULL ); - mpSequenceList->Insert( pNextAccel, (sal_uLong)0 ); + mpSequenceList->insert( mpSequenceList->begin(), pNextAccel ); // Activate-Handler vom Neuen rufen pNextAccel->Activate(); @@ -222,9 +222,9 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe } // Durch die Liste der Acceleratoren wuehlen - pAccel = mpAccelList->First(); - while ( pAccel ) + for ( size_t i = 0, n = mpAccelList->size(); i < n; ++i ) { + pAccel = (*mpAccelList)[ i ]; DBG_CHKOBJ( pAccel, Accelerator, NULL ); // Ist der Eintrag da drin ? @@ -240,8 +240,8 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe // Sequenz-Liste erzeugen mpSequenceList = new ImplAccelList; - mpSequenceList->Insert( pAccel, (sal_uLong)0 ); - mpSequenceList->Insert( pNextAccel, (sal_uLong)0 ); + mpSequenceList->insert( mpSequenceList->begin(), pAccel ); + mpSequenceList->insert( mpSequenceList->begin(), pNextAccel ); // Activate-Handler vom Neuen rufen pNextAccel->Activate(); @@ -282,10 +282,9 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe return sal_False; } } - - // Nicht gefunden, vielleicht im naechsten Accelerator - pAccel = mpAccelList->Next(); } return sal_False; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/arrange.cxx b/vcl/source/window/arrange.cxx index 90f8bc9a4c1e..0d5be0d2b625 100644 --- a/vcl/source/window/arrange.cxx +++ b/vcl/source/window/arrange.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1073,3 +1074,4 @@ void MatrixArranger::remove( boost::shared_ptr<WindowArranger> const &i_pChild ) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 3a00b522952e..d048b3ab6fba 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" - #include <svids.hrc> #include <svdata.hxx> #include <brdwin.hxx> @@ -212,7 +212,7 @@ void ImplBorderWindowView::ImplInitTitle( ImplBorderFrameData* pData ) { ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; - if ( !(pBorderWindow->GetStyle() & WB_MOVEABLE) || + if ( !(pBorderWindow->GetStyle() & (WB_MOVEABLE | WB_POPUP)) || (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) ) { pData->mnTitleType = BORDERWINDOW_TITLE_NONE; @@ -277,7 +277,7 @@ sal_uInt16 ImplBorderWindowView::ImplHitTest( ImplBorderFrameData* pData, const // no corner resize for floating toolbars, which would lead to jumps while formatting // setting nSizeWidth = 0 will only return pure left,top,right,bottom - if( pBorderWindow->GetStyle() & WB_OWNERDRAWDECORATION ) + if( pBorderWindow->GetStyle() & (WB_OWNERDRAWDECORATION | WB_POPUP) ) nSizeWidth = 0; if ( rPos.X() < pData->mnLeftBorder ) @@ -373,9 +373,9 @@ sal_Bool ImplBorderWindowView::ImplMouseButtonDown( ImplBorderFrameData* pData, { pData->maMouseOff = rMEvt.GetPosPixel(); pData->mnHitTest = ImplHitTest( pData, pData->maMouseOff ); - sal_uInt16 nDragFullTest = 0; if ( pData->mnHitTest ) { + sal_uInt16 nDragFullTest = 0; sal_Bool bTracking = sal_True; sal_Bool bHitTest = sal_True; @@ -1497,7 +1497,7 @@ void ImplStdBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeigh pData->mnTitleType = pBorderWindow->mnTitleType; pData->mbFloatWindow = pBorderWindow->mbFloatWindow; - if ( !(pBorderWindow->GetStyle() & WB_MOVEABLE) || (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) ) + if ( !(pBorderWindow->GetStyle() & (WB_MOVEABLE | WB_POPUP)) || (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) ) pData->mnBorderSize = 0; else if ( pData->mnTitleType == BORDERWINDOW_TITLE_TEAROFF ) pData->mnBorderSize = 0; @@ -1522,7 +1522,7 @@ void ImplStdBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeigh // set a proper background for drawing // highlighted buttons in the title - pBorderWindow->SetBackground( rStyleSettings.GetWindowColor() ); + pBorderWindow->SetBackground( rStyleSettings.GetFaceColor() ); pData->maTitleRect.Left() = pData->mnLeftBorder; pData->maTitleRect.Right() = nWidth-pData->mnRightBorder-1; @@ -1665,19 +1665,43 @@ void ImplStdBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* p Rectangle aInRect( aTmpPoint, Size( pData->mnWidth, pData->mnHeight ) ); const StyleSettings& rStyleSettings = pData->mpOutDev->GetSettings().GetStyleSettings(); DecorationView aDecoView( pDev ); - Color aFrameColor( rStyleSettings.GetFaceColor() ); + Color aFaceColor( rStyleSettings.GetFaceColor() ); + Color aFrameColor( aFaceColor ); aFrameColor.DecreaseContrast( (sal_uInt8) (0.50 * 255)); // Draw Frame if ( nDrawFlags & BORDERWINDOW_DRAW_FRAME ) { + Region oldClipRgn( pDev->GetClipRegion( ) ); + + // for popups, don't draw part of the frame + if ( pData->mnTitleType == BORDERWINDOW_TITLE_POPUP ) + { + FloatingWindow *pWin = dynamic_cast< FloatingWindow* >( pData->mpBorderWindow->GetWindow( WINDOW_CLIENT ) ); + if ( pWin ) + { + Region aClipRgn( aInRect ); + Rectangle aItemClipRect( pWin->ImplGetItemEdgeClipRect() ); + if( !aItemClipRect.IsEmpty() ) + { + aItemClipRect.SetPos( pData->mpBorderWindow->AbsoluteScreenToOutputPixel( aItemClipRect.TopLeft() ) ); + aClipRgn.Exclude( aItemClipRect ); + pDev->SetClipRegion( aClipRgn ); + } + } + } + // single line frame pDev->SetLineColor( aFrameColor ); pDev->SetFillColor(); pDev->DrawRect( aInRect ); aInRect.nLeft++; aInRect.nRight--; aInRect.nTop++; aInRect.nBottom--; + + // restore + if ( pData->mnTitleType == BORDERWINDOW_TITLE_POPUP ) + pDev->SetClipRegion( oldClipRgn ); } else aInRect = aDecoView.DrawFrame( aInRect, FRAME_DRAW_DOUBLEOUT | FRAME_DRAW_NODRAW); @@ -1704,7 +1728,11 @@ void ImplStdBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* p aInRect = pData->maTitleRect; // use no gradient anymore, just a static titlecolor - pDev->SetFillColor( aFrameColor ); + if ( pData->mnTitleType != BORDERWINDOW_TITLE_POPUP ) + pDev->SetFillColor( aFrameColor ); + else + pDev->SetFillColor( aFaceColor ); + pDev->SetTextColor( rStyleSettings.GetButtonTextColor() ); Rectangle aTitleRect( pData->maTitleRect ); if( pOffset ) @@ -1839,7 +1867,7 @@ void ImplBorderWindow::ImplInit( Window* pParent, { // Alle WindowBits entfernen, die wir nicht haben wollen WinBits nOrgStyle = nStyle; - WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_PINABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_SYSTEMFLOATWIN | WB_INTROWIN | WB_DEFAULTWIN | WB_TOOLTIPWIN | WB_NOSHADOW | WB_OWNERDRAWDECORATION | WB_SYSTEMCHILDWINDOW | WB_NEEDSFOCUS); + WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_PINABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_SYSTEMFLOATWIN | WB_INTROWIN | WB_DEFAULTWIN | WB_TOOLTIPWIN | WB_NOSHADOW | WB_OWNERDRAWDECORATION | WB_SYSTEMCHILDWINDOW | WB_NEEDSFOCUS | WB_POPUP); if ( nTypeStyle & BORDERWINDOW_STYLE_APP ) nTestStyle |= WB_APP; nStyle &= nTestStyle; @@ -1854,7 +1882,7 @@ void ImplBorderWindow::ImplInit( Window* pParent, mpWindowImpl->mbFrame = sal_True; mbFrameBorder = sal_False; } - else if( (nStyle & WB_OWNERDRAWDECORATION) ) + else if( (nStyle & (WB_OWNERDRAWDECORATION | WB_POPUP)) ) { mpWindowImpl->mbOverlapWin = sal_True; mpWindowImpl->mbFrame = sal_True; @@ -2106,7 +2134,7 @@ void ImplBorderWindow::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - if ( !mpWindowImpl->mbFrame || (GetStyle() & WB_OWNERDRAWDECORATION) ) + if ( !mpWindowImpl->mbFrame || (GetStyle() & (WB_OWNERDRAWDECORATION | WB_POPUP)) ) UpdateView( sal_True, ImplGetWindow()->GetOutputSizePixel() ); } @@ -2354,3 +2382,5 @@ Rectangle ImplBorderWindow::GetMenuRect() const { return mpBorderView->GetMenuRect(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/btndlg.cxx b/vcl/source/window/btndlg.cxx index 08132496dc36..add12e4427bb 100644 --- a/vcl/source/window/btndlg.cxx +++ b/vcl/source/window/btndlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <tools/ref.hxx> #include <tools/debug.hxx> #include <tools/rc.h> @@ -37,42 +37,32 @@ #include <vcl/button.hxx> #include <vcl/btndlg.hxx> - - -// ======================================================================= +typedef boost::ptr_vector<ImplBtnDlgItem>::iterator btn_iterator; +typedef boost::ptr_vector<ImplBtnDlgItem>::const_iterator btn_const_iterator; struct ImplBtnDlgItem { sal_uInt16 mnId; - sal_Bool mbOwnButton; - sal_Bool mbDummyAlign; + bool mbOwnButton; + bool mbDummyAlign; long mnSepSize; PushButton* mpPushButton; }; -DECLARE_LIST( ImplBtnDlgItemList, ImplBtnDlgItem* ) - -// ======================================================================= - void ButtonDialog::ImplInitButtonDialogData() { - mpItemList = new ImplBtnDlgItemList( 8, 8 ); mnButtonSize = 0; mnCurButtonId = 0; mnFocusButtonId = BUTTONDIALOG_BUTTON_NOTFOUND; mbFormat = sal_True; } -// ----------------------------------------------------------------------- - ButtonDialog::ButtonDialog( WindowType nType ) : Dialog( nType ) { ImplInitButtonDialogData(); } -// ----------------------------------------------------------------------- - ButtonDialog::ButtonDialog( Window* pParent, WinBits nStyle ) : Dialog( WINDOW_BUTTONDIALOG ) { @@ -80,8 +70,6 @@ ButtonDialog::ButtonDialog( Window* pParent, WinBits nStyle ) : ImplInit( pParent, nStyle ); } -// ----------------------------------------------------------------------- - ButtonDialog::ButtonDialog( Window* pParent, const ResId& rResId ) : Dialog( WINDOW_BUTTONDIALOG ) { @@ -91,24 +79,15 @@ ButtonDialog::ButtonDialog( Window* pParent, const ResId& rResId ) : ImplLoadRes( rResId ); } -// ----------------------------------------------------------------------- - ButtonDialog::~ButtonDialog() { - ImplBtnDlgItem* pItem = mpItemList->First(); - while ( pItem ) + for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it) { - if ( pItem->mpPushButton && pItem->mbOwnButton ) - delete pItem->mpPushButton; - delete pItem; - pItem = mpItemList->Next(); + if ( it->mpPushButton && it->mbOwnButton ) + delete it->mpPushButton; } - - delete mpItemList; } -// ----------------------------------------------------------------------- - PushButton* ButtonDialog::ImplCreatePushButton( sal_uInt16 nBtnFlags ) { PushButton* pBtn; @@ -131,60 +110,53 @@ PushButton* ButtonDialog::ImplCreatePushButton( sal_uInt16 nBtnFlags ) return pBtn; } -// ----------------------------------------------------------------------- - ImplBtnDlgItem* ButtonDialog::ImplGetItem( sal_uInt16 nId ) const { - ImplBtnDlgItem* pItem = mpItemList->First(); - while ( pItem ) + for ( btn_const_iterator it = maItemList.begin(); it != maItemList.end(); ++it) { - if ( pItem->mnId == nId ) - return pItem; - - pItem = mpItemList->Next(); + if (it->mnId == nId) + return const_cast<ImplBtnDlgItem*>(&(*it)); } return NULL; } -// ----------------------------------------------------------------------- - long ButtonDialog::ImplGetButtonSize() { if ( !mbFormat ) return mnButtonSize; // Calculate ButtonSize - long nLastSepSize = 0; - long nSepSize = 0; - long nButtonCount = 0; + long nLastSepSize = 0; + long nSepSize = 0; maCtrlSize = Size( IMPL_MINSIZE_BUTTON_WIDTH, IMPL_MINSIZE_BUTTON_HEIGHT ); - ImplBtnDlgItem* pItem = mpItemList->First(); - while ( pItem ) + + for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it) { nSepSize += nLastSepSize; - long nTxtWidth = pItem->mpPushButton->GetCtrlTextWidth( pItem->mpPushButton->GetText() ); + long nTxtWidth = it->mpPushButton->GetCtrlTextWidth(it->mpPushButton->GetText()); nTxtWidth += IMPL_EXTRA_BUTTON_WIDTH; + if ( nTxtWidth > maCtrlSize.Width() ) maCtrlSize.Width() = nTxtWidth; - long nTxtHeight = pItem->mpPushButton->GetTextHeight(); + + long nTxtHeight = it->mpPushButton->GetTextHeight(); nTxtHeight += IMPL_EXTRA_BUTTON_HEIGHT; + if ( nTxtHeight > maCtrlSize.Height() ) maCtrlSize.Height() = nTxtHeight; - nSepSize += pItem->mnSepSize; + nSepSize += it->mnSepSize; if ( GetStyle() & WB_HORZ ) nLastSepSize = IMPL_SEP_BUTTON_X; else nLastSepSize = IMPL_SEP_BUTTON_Y; - - nButtonCount++; - - pItem = mpItemList->Next(); } + long nButtonCount = maItemList.size(); + if ( GetStyle() & WB_HORZ ) mnButtonSize = nSepSize + (nButtonCount*maCtrlSize.Width()); else @@ -193,8 +165,6 @@ long ButtonDialog::ImplGetButtonSize() return mnButtonSize; } -// ----------------------------------------------------------------------- - void ButtonDialog::ImplPosControls() { if ( !mbFormat ) @@ -204,7 +174,6 @@ void ButtonDialog::ImplPosControls() ImplGetButtonSize(); // determine dialog size - ImplBtnDlgItem* pItem; Size aDlgSize = maPageSize; long nX; long nY; @@ -238,21 +207,20 @@ void ButtonDialog::ImplPosControls() } // Arrange PushButtons - pItem = mpItemList->First(); - while ( pItem ) + for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it) { if ( GetStyle() & WB_HORZ ) - nX += pItem->mnSepSize; + nX += it->mnSepSize; else - nY += pItem->mnSepSize; - pItem->mpPushButton->SetPosSizePixel( Point( nX, nY ), maCtrlSize ); - pItem->mpPushButton->Show(); + nY += it->mnSepSize; + + it->mpPushButton->SetPosSizePixel( Point( nX, nY ), maCtrlSize ); + it->mpPushButton->Show(); + if ( GetStyle() & WB_HORZ ) nX += maCtrlSize.Width()+IMPL_SEP_BUTTON_X; else nY += maCtrlSize.Height()+IMPL_SEP_BUTTON_Y; - - pItem = mpItemList->Next(); } SetOutputSizePixel( aDlgSize ); @@ -260,54 +228,43 @@ void ButtonDialog::ImplPosControls() mbFormat = sal_False; } -// ----------------------------------------------------------------------- - IMPL_LINK( ButtonDialog, ImplClickHdl, PushButton*, pBtn ) { - ImplBtnDlgItem* pItem = mpItemList->First(); - while ( pItem ) + for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it) { - if ( pItem->mpPushButton == pBtn ) + if ( it->mpPushButton == pBtn ) { - mnCurButtonId = pItem->mnId; + mnCurButtonId = it->mnId; Click(); break; } - - pItem = mpItemList->Next(); } return 0; } -// ----------------------------------------------------------------------- - void ButtonDialog::Resize() { } -// ----------------------------------------------------------------------- - void ButtonDialog::StateChanged( StateChangedType nType ) { if ( nType == STATE_CHANGE_INITSHOW ) { ImplPosControls(); - // Focus evt. auf den entsprechenden Button setzen + // Set focus on default button. if ( mnFocusButtonId != BUTTONDIALOG_BUTTON_NOTFOUND ) { - ImplBtnDlgItem* pItem = mpItemList->First(); - while ( pItem ) + for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it) { - if ( pItem->mnId == mnFocusButtonId ) + if (it->mnId == mnFocusButtonId ) { - if ( pItem->mpPushButton->IsVisible() ) - pItem->mpPushButton->GrabFocus(); + if (it->mpPushButton->IsVisible()) + it->mpPushButton->GrabFocus(); + break; } - - pItem = mpItemList->Next(); } } } @@ -315,8 +272,6 @@ void ButtonDialog::StateChanged( StateChangedType nType ) Dialog::StateChanged( nType ); } -// ----------------------------------------------------------------------- - void ButtonDialog::Click() { if ( !maClickHdl ) @@ -328,8 +283,6 @@ void ButtonDialog::Click() maClickHdl.Call( this ); } -// ----------------------------------------------------------------------- - void ButtonDialog::AddButton( const XubString& rText, sal_uInt16 nId, sal_uInt16 nBtnFlags, long nSepPixel ) { @@ -339,11 +292,11 @@ void ButtonDialog::AddButton( const XubString& rText, sal_uInt16 nId, pItem->mbOwnButton = sal_True; pItem->mnSepSize = nSepPixel; pItem->mpPushButton = ImplCreatePushButton( nBtnFlags ); + if ( rText.Len() ) pItem->mpPushButton->SetText( rText ); - // In die Liste eintragen - mpItemList->Insert( pItem, LIST_APPEND ); + maItemList.push_back(pItem); if ( nBtnFlags & BUTTONDIALOG_FOCUSBUTTON ) mnFocusButtonId = nId; @@ -351,8 +304,6 @@ void ButtonDialog::AddButton( const XubString& rText, sal_uInt16 nId, mbFormat = sal_True; } -// ----------------------------------------------------------------------- - void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId, sal_uInt16 nBtnFlags, long nSepPixel ) { @@ -382,14 +333,11 @@ void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId, if ( nBtnFlags & BUTTONDIALOG_FOCUSBUTTON ) mnFocusButtonId = nId; - // In die Liste eintragen - mpItemList->Insert( pItem, LIST_APPEND ); + maItemList.push_back(pItem); mbFormat = sal_True; } -// ----------------------------------------------------------------------- - void ButtonDialog::AddButton( PushButton* pBtn, sal_uInt16 nId, sal_uInt16 nBtnFlags, long nSepPixel ) { @@ -403,73 +351,59 @@ void ButtonDialog::AddButton( PushButton* pBtn, sal_uInt16 nId, if ( nBtnFlags & BUTTONDIALOG_FOCUSBUTTON ) mnFocusButtonId = nId; - // In die View-Liste eintragen - mpItemList->Insert( pItem, LIST_APPEND ); + maItemList.push_back(pItem); mbFormat = sal_True; } -// ----------------------------------------------------------------------- - void ButtonDialog::RemoveButton( sal_uInt16 nId ) { - ImplBtnDlgItem* pItem = mpItemList->First(); - while ( pItem ) + btn_iterator it; + for (it = maItemList.begin(); it != maItemList.end(); ++it) { - if ( pItem->mnId == nId ) + if (it->mnId == nId) { - pItem->mpPushButton->Hide(); - if ( pItem->mbOwnButton ) - delete pItem->mpPushButton; - delete pItem; - mpItemList->Remove(); - mbFormat = sal_True; + it->mpPushButton->Hide(); + + if (it->mbOwnButton ) + delete it->mpPushButton; + + maItemList.erase(it); break; } - - pItem = mpItemList->Next(); } - DBG_ERRORFILE( "ButtonDialog::RemoveButton(): ButtonId invalid" ); + if (it == maItemList.end()) + DBG_ERRORFILE( "ButtonDialog::RemoveButton(): ButtonId invalid" ); } -// ----------------------------------------------------------------------- - void ButtonDialog::Clear() { - ImplBtnDlgItem* pItem = mpItemList->First(); - while ( pItem ) + for (btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it) { - pItem->mpPushButton->Hide(); - if ( pItem->mbOwnButton ) - delete pItem->mpPushButton; - delete pItem; - pItem = mpItemList->Next(); + it->mpPushButton->Hide(); + + if (it->mbOwnButton ) + delete it->mpPushButton; } - mpItemList->Clear(); + maItemList.clear(); mbFormat = sal_True; } -// ----------------------------------------------------------------------- - sal_uInt16 ButtonDialog::GetButtonCount() const { - return (sal_uInt16)mpItemList->Count(); + return (sal_uInt16)maItemList.size(); } -// ----------------------------------------------------------------------- - sal_uInt16 ButtonDialog::GetButtonId( sal_uInt16 nButton ) const { - if ( nButton < mpItemList->Count() ) - return (sal_uInt16)mpItemList->GetObject( nButton )->mnId; + if ( nButton < maItemList.size() ) + return maItemList[nButton].mnId; else return BUTTONDIALOG_BUTTON_NOTFOUND; } -// ----------------------------------------------------------------------- - PushButton* ButtonDialog::GetPushButton( sal_uInt16 nId ) const { ImplBtnDlgItem* pItem = ImplGetItem( nId ); @@ -480,8 +414,6 @@ PushButton* ButtonDialog::GetPushButton( sal_uInt16 nId ) const return NULL; } -// ----------------------------------------------------------------------- - void ButtonDialog::SetButtonText( sal_uInt16 nId, const XubString& rText ) { ImplBtnDlgItem* pItem = ImplGetItem( nId ); @@ -493,8 +425,6 @@ void ButtonDialog::SetButtonText( sal_uInt16 nId, const XubString& rText ) } } -// ----------------------------------------------------------------------- - XubString ButtonDialog::GetButtonText( sal_uInt16 nId ) const { ImplBtnDlgItem* pItem = ImplGetItem( nId ); @@ -505,8 +435,6 @@ XubString ButtonDialog::GetButtonText( sal_uInt16 nId ) const return ImplGetSVEmptyStr(); } -// ----------------------------------------------------------------------- - void ButtonDialog::SetButtonHelpText( sal_uInt16 nId, const XubString& rText ) { ImplBtnDlgItem* pItem = ImplGetItem( nId ); @@ -515,8 +443,6 @@ void ButtonDialog::SetButtonHelpText( sal_uInt16 nId, const XubString& rText ) pItem->mpPushButton->SetHelpText( rText ); } -// ----------------------------------------------------------------------- - XubString ButtonDialog::GetButtonHelpText( sal_uInt16 nId ) const { ImplBtnDlgItem* pItem = ImplGetItem( nId ); @@ -527,8 +453,6 @@ XubString ButtonDialog::GetButtonHelpText( sal_uInt16 nId ) const return ImplGetSVEmptyStr(); } -// ----------------------------------------------------------------------- - void ButtonDialog::SetButtonHelpId( sal_uInt16 nId, const rtl::OString& rHelpId ) { ImplBtnDlgItem* pItem = ImplGetItem( nId ); @@ -537,11 +461,11 @@ void ButtonDialog::SetButtonHelpId( sal_uInt16 nId, const rtl::OString& rHelpId pItem->mpPushButton->SetHelpId( rHelpId ); } -// ----------------------------------------------------------------------- - rtl::OString ButtonDialog::GetButtonHelpId( sal_uInt16 nId ) const { ImplBtnDlgItem* pItem = ImplGetItem( nId ); return pItem ? rtl::OString( pItem->mpPushButton->GetHelpId() ) : rtl::OString(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/cmdevt.cxx b/vcl/source/window/cmdevt.cxx index e10d33028fbc..1fa77a3621cd 100644 --- a/vcl/source/window/cmdevt.cxx +++ b/vcl/source/window/cmdevt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,13 +29,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#ifndef _STRING_H #include <string.h> -#endif -#ifndef _SV_CMDEVT_HXX #include <vcl/cmdevt.hxx> -#endif // ======================================================================= @@ -99,3 +96,5 @@ CommandExtTextInputData::~CommandExtTextInputData() if ( mpTextAttr ) delete [] mpTextAttr; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx index 03648a078193..89bfe4f2d067 100644 --- a/vcl/source/window/cursor.cxx +++ b/vcl/source/window/cursor.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,7 +52,7 @@ struct ImplCursorData short mnOrientation; // Pixel-Orientation unsigned char mnDirection; // indicates writing direction sal_uInt16 mnStyle; // Cursor-Style - sal_Bool mbCurVisible; // Ist Cursor aktuell sichtbar + bool mbCurVisible; // Ist Cursor aktuell sichtbar Window* mpWindow; // Zugeordnetes Windows }; @@ -60,8 +61,8 @@ struct ImplCursorData static void ImplCursorInvert( ImplCursorData* pData ) { Window* pWindow = pData->mpWindow; - sal_Bool bMapMode = pWindow->IsMapModeEnabled(); - pWindow->EnableMapMode( sal_False ); + bool bMapMode = pWindow->IsMapModeEnabled(); + pWindow->EnableMapMode( false ); sal_uInt16 nInvertStyle; if ( pData->mnStyle & CURSOR_SHADOW ) nInvertStyle = INVERT_50; @@ -157,7 +158,7 @@ void Cursor::ImplDraw() // Ausgabeflaeche berechnen und ausgeben ImplCursorInvert( mpData ); - mpData->mbCurVisible = sal_True; + mpData->mbCurVisible = true; } } @@ -168,13 +169,11 @@ void Cursor::ImplRestore() if ( mpData && mpData->mbCurVisible ) { ImplCursorInvert( mpData ); - mpData->mbCurVisible = sal_False; + mpData->mbCurVisible = false; } } -// ----------------------------------------------------------------------- - -void Cursor::ImplShow( bool bDrawDirect, bool bRestore ) +void Cursor::ImplDoShow( bool bDrawDirect, bool bRestore ) { if ( mbVisible ) { @@ -196,7 +195,7 @@ void Cursor::ImplShow( bool bDrawDirect, bool bRestore ) if ( !mpData ) { mpData = new ImplCursorData; - mpData->mbCurVisible = sal_False; + mpData->mbCurVisible = false; mpData->maTimer.SetTimeoutHdl( LINK( this, Cursor, ImplTimerHdl ) ); } @@ -217,9 +216,7 @@ void Cursor::ImplShow( bool bDrawDirect, bool bRestore ) } } -// ----------------------------------------------------------------------- - -bool Cursor::ImplHide( bool i_bStopTimer ) +bool Cursor::ImplDoHide( bool bSuspend ) { bool bWasCurVisible = false; if ( mpData && mpData->mpWindow ) @@ -227,18 +224,35 @@ bool Cursor::ImplHide( bool i_bStopTimer ) bWasCurVisible = mpData->mbCurVisible; if ( mpData->mbCurVisible ) ImplRestore(); - } - if( mpData && i_bStopTimer ) - { - mpData->maTimer.Stop(); - mpData->mpWindow = NULL; + if ( !bSuspend ) + { + mpData->maTimer.Stop(); + mpData->mpWindow = NULL; + } } - return bWasCurVisible; } -// ----------------------------------------------------------------------- +void Cursor::ImplShow( bool bDrawDirect ) +{ + ImplDoShow( bDrawDirect, false ); +} + +void Cursor::ImplHide() +{ + ImplDoHide( false ); +} + +void Cursor::ImplResume( bool bRestore ) +{ + ImplDoShow( false, bRestore ); +} + +bool Cursor::ImplSuspend() +{ + return ImplDoHide( true ); +} void Cursor::ImplNew() { @@ -278,7 +292,7 @@ Cursor::Cursor() mnOrientation = 0; mnDirection = 0; mnStyle = 0; - mbVisible = sal_False; + mbVisible = false; } // ----------------------------------------------------------------------- @@ -326,7 +340,7 @@ void Cursor::Show() { if ( !mbVisible ) { - mbVisible = sal_True; + mbVisible = true; ImplShow(); } } @@ -337,8 +351,8 @@ void Cursor::Hide() { if ( mbVisible ) { - mbVisible = sal_False; - ImplHide( true ); + mbVisible = false; + ImplHide(); } } @@ -458,15 +472,16 @@ Cursor& Cursor::operator=( const Cursor& rCursor ) // ----------------------------------------------------------------------- -sal_Bool Cursor::operator==( const Cursor& rCursor ) const +bool Cursor::operator==( const Cursor& rCursor ) const { - if ( (maPos == rCursor.maPos) && + return + ((maPos == rCursor.maPos) && (maSize == rCursor.maSize) && (mnSlant == rCursor.mnSlant) && (mnOrientation == rCursor.mnOrientation) && (mnDirection == rCursor.mnDirection) && - (mbVisible == rCursor.mbVisible) ) - return sal_True; - else - return sal_False; + (mbVisible == rCursor.mbVisible)) + ; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index b82f029370c7..125c927bf673 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1286,3 +1287,4 @@ void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, boo mpOutDev->Pop(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 031e947cbf13..5c4c786a1f39 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #include <tools/debug.hxx> #include <tools/rc.h> - #include <svdata.hxx> #include <window.h> #include <brdwin.hxx> @@ -559,7 +559,18 @@ sal_Bool Dialog::Close() { ImplDelData aDelData; ImplAddDel( &aDelData ); + //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event + mnCancelClose = 0; ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE ); + // basic boolean ( and what the user might use in the event handler) can + // be ambiguous ( e.g. basic true = -1 ) + // test agains 0 ( false ) and assume anything else is true + // ( Note: ) this used to work ( something changes somewhere ) + if (mnCancelClose != 0) + { + return sal_False; + } + //liuchen 2009-7-22 if ( aDelData.IsDelete() ) return sal_False; ImplRemoveDel( &aDelData ); @@ -612,7 +623,7 @@ sal_Bool Dialog::ImplStartExecuteModal() #ifdef DBG_UTIL ByteString aErrorStr( "Dialog::StartExecuteModal() is called in Dialog::StartExecuteModal(): " ); aErrorStr += ImplGetDialogText( this ); - DBG_ERROR( aErrorStr.GetBuffer() ); + OSL_FAIL( aErrorStr.GetBuffer() ); #endif return sal_False; } @@ -622,7 +633,7 @@ sal_Bool Dialog::ImplStartExecuteModal() #ifdef DBG_UTIL ByteString aErrorStr( "Dialog::StartExecuteModal() is called in a none UI application: " ); aErrorStr += ImplGetDialogText( this ); - DBG_ERROR( aErrorStr.GetBuffer() ); + OSL_FAIL( aErrorStr.GetBuffer() ); #endif return sal_False; } @@ -712,7 +723,7 @@ short Dialog::Execute() if( ! aParentDelData.IsDelete() ) pDialogParent->ImplRemoveDel( &aParentDelData ); else - DBG_ERROR( "Dialog::Execute() - Parent of dialog destroyed in Execute()" ); + OSL_FAIL( "Dialog::Execute() - Parent of dialog destroyed in Execute()" ); } #endif if ( !aDelData.IsDelete() ) @@ -720,7 +731,7 @@ short Dialog::Execute() #ifdef DBG_UTIL else { - DBG_ERROR( "Dialog::Execute() - Dialog destroyed in Execute()" ); + OSL_FAIL( "Dialog::Execute() - Dialog destroyed in Execute()" ); } #endif @@ -1026,3 +1037,5 @@ ModalDialog::ModalDialog( Window* pParent, const ResId& rResId ) : ImplInit( pParent, ImplInitRes( rResId ) ); ImplLoadRes( rResId ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index cf49dad4173a..24468089e88a 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -898,10 +899,8 @@ sal_Bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput ) sal_Bool Window::ImplHasDlgCtrl() { Window* pDlgCtrlParent; - Window* pDlgCtrl; // lookup window for dialog control - pDlgCtrl = this; pDlgCtrlParent = ImplGetParent(); while ( pDlgCtrlParent && !pDlgCtrlParent->ImplIsOverlapWindow() && @@ -1335,3 +1334,5 @@ KeyEvent Window::GetActivationKey() const } return aKeyEvent; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/dndevdis.cxx b/vcl/source/window/dndevdis.cxx index 70453d6c4f9a..5d6a309e838e 100644 --- a/vcl/source/window/dndevdis.cxx +++ b/vcl/source/window/dndevdis.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,11 +34,9 @@ #include <window.h> #include <svdata.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> -using namespace ::osl; -using namespace ::vos; using namespace ::cppu; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -62,20 +61,11 @@ DNDEventDispatcher::~DNDEventDispatcher() { } -//================================================================================================== -// DNDEventDispatcher::drop -//================================================================================================== - -void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde ) - throw(RuntimeException) +Window* DNDEventDispatcher::findTopLevelWindow(Point location) { - MutexGuard aImplGuard( m_aMutex ); - - Point location( dtde.LocationX, dtde.LocationY ); + SolarMutexGuard aSolarGuard; // find the window that is toplevel for this coordinates - OClearableGuard aSolarGuard( Application::GetSolarMutex() ); - // because those coordinates come from outside, they must be mirrored if RTL layout is active if( Application::GetSettings().GetLayoutRTL() ) m_pTopWindow->ImplMirrorFramePos( location ); @@ -90,7 +80,21 @@ void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde ) if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); - aSolarGuard.clear(); + return pChildWindow; +} + +//================================================================================================== +// DNDEventDispatcher::drop +//================================================================================================== + +void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde ) + throw(RuntimeException) +{ + osl::MutexGuard aImplGuard( m_aMutex ); + + Point location( dtde.LocationX, dtde.LocationY ); + + Window* pChildWindow = findTopLevelWindow(location); // handle the case that drop is in an other vcl window than the last dragOver if( pChildWindow != m_pCurrentWindow ) @@ -126,27 +130,10 @@ void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde ) void SAL_CALL DNDEventDispatcher::dragEnter( const DropTargetDragEnterEvent& dtdee ) throw(RuntimeException) { - MutexGuard aImplGuard( m_aMutex ); + osl::MutexGuard aImplGuard( m_aMutex ); Point location( dtdee.LocationX, dtdee.LocationY ); - // find the window that is toplevel for this coordinates - OClearableGuard aSolarGuard( Application::GetSolarMutex() ); - - // because those coordinates come from outside, they must be mirrored if RTL layout is active - if( Application::GetSettings().GetLayoutRTL() ) - m_pTopWindow->ImplMirrorFramePos( location ); - Window * pChildWindow = m_pTopWindow->ImplFindWindow( location ); - - if( NULL == pChildWindow ) - pChildWindow = m_pTopWindow; - - while( pChildWindow->ImplGetClientWindow() ) - pChildWindow = pChildWindow->ImplGetClientWindow(); - - if( pChildWindow->ImplIsAntiparallel() ) - pChildWindow->ImplReMirror( location ); - - aSolarGuard.clear(); + Window * pChildWindow = findTopLevelWindow(location); // assume pointer write operation to be atomic m_pCurrentWindow = pChildWindow; @@ -171,7 +158,7 @@ void SAL_CALL DNDEventDispatcher::dragEnter( const DropTargetDragEnterEvent& dtd void SAL_CALL DNDEventDispatcher::dragExit( const DropTargetEvent& /*dte*/ ) throw(RuntimeException) { - MutexGuard aImplGuard( m_aMutex ); + osl::MutexGuard aImplGuard( m_aMutex ); fireDragExitEvent( m_pCurrentWindow ); @@ -187,29 +174,12 @@ void SAL_CALL DNDEventDispatcher::dragExit( const DropTargetEvent& /*dte*/ ) void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde ) throw(RuntimeException) { - MutexGuard aImplGuard( m_aMutex ); + osl::MutexGuard aImplGuard( m_aMutex ); Point location( dtde.LocationX, dtde.LocationY ); sal_Int32 nListeners; - // find the window that is toplevel for this coordinates - OClearableGuard aSolarGuard( Application::GetSolarMutex() ); - - // because those coordinates come from outside, they must be mirrored if RTL layout is active - if( Application::GetSettings().GetLayoutRTL() ) - m_pTopWindow->ImplMirrorFramePos( location ); - Window * pChildWindow = m_pTopWindow->ImplFindWindow( location ); - - if( NULL == pChildWindow ) - pChildWindow = m_pTopWindow; - - while( pChildWindow->ImplGetClientWindow() ) - pChildWindow = pChildWindow->ImplGetClientWindow(); - - if( pChildWindow->ImplIsAntiparallel() ) - pChildWindow->ImplReMirror( location ); - - aSolarGuard.clear(); + Window * pChildWindow = findTopLevelWindow(location); if( pChildWindow != m_pCurrentWindow ) { @@ -245,29 +215,12 @@ void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde ) void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent& dtde ) throw(RuntimeException) { - MutexGuard aImplGuard( m_aMutex ); + osl::MutexGuard aImplGuard( m_aMutex ); Point location( dtde.LocationX, dtde.LocationY ); sal_Int32 nListeners; - // find the window that is toplevel for this coordinates - OClearableGuard aSolarGuard( Application::GetSolarMutex() ); - - // because those coordinates come from outside, they must be mirrored if RTL layout is active - if( Application::GetSettings().GetLayoutRTL() ) - m_pTopWindow->ImplMirrorFramePos( location ); - Window * pChildWindow = m_pTopWindow->ImplFindWindow( location ); - - if( NULL == pChildWindow ) - pChildWindow = m_pTopWindow; - - while( pChildWindow->ImplGetClientWindow() ) - pChildWindow = pChildWindow->ImplGetClientWindow(); - - if( pChildWindow->ImplIsAntiparallel() ) - pChildWindow->ImplReMirror( location ); - - aSolarGuard.clear(); + Window* pChildWindow = findTopLevelWindow(location); if( pChildWindow != m_pCurrentWindow ) { @@ -303,28 +256,12 @@ void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent& void SAL_CALL DNDEventDispatcher::dragGestureRecognized( const DragGestureEvent& dge ) throw(RuntimeException) -{ MutexGuard aImplGuard( m_aMutex ); +{ + osl::MutexGuard aImplGuard( m_aMutex ); Point origin( dge.DragOriginX, dge.DragOriginY ); - // find the window that is toplevel for this coordinates - OClearableGuard aSolarGuard( Application::GetSolarMutex() ); - - // because those coordinates come from outside, they must be mirrored if RTL layout is active - if( Application::GetSettings().GetLayoutRTL() ) - m_pTopWindow->ImplMirrorFramePos( origin ); - Window * pChildWindow = m_pTopWindow->ImplFindWindow( origin ); - - if( NULL == pChildWindow ) - pChildWindow = m_pTopWindow; - - while( pChildWindow->ImplGetClientWindow() ) - pChildWindow = pChildWindow->ImplGetClientWindow(); - - if( pChildWindow->ImplIsAntiparallel() ) - pChildWindow->ImplReMirror( origin ); - - aSolarGuard.clear(); + Window* pChildWindow = findTopLevelWindow(origin); fireDragGestureEvent( pChildWindow, dge.DragSource, dge.Event, origin, dge.DragAction ); } @@ -368,7 +305,7 @@ sal_Int32 DNDEventDispatcher::fireDragEnterEvent( Window *pWindow, if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() ) { - OClearableGuard aGuard( Application::GetSolarMutex() ); + SolarMutexClearableGuard aSolarGuard; // set an UI lock pWindow->IncrementLockCount(); @@ -380,7 +317,7 @@ sal_Int32 DNDEventDispatcher::fireDragEnterEvent( Window *pWindow, { // retrieve relative mouse position Point relLoc = pWindow->ImplFrameToOutput( rLocation ); - aGuard.clear(); + aSolarGuard.clear(); n = static_cast < DNDListenerContainer * > ( xDropTarget.get() )->fireDragEnterEvent( xContext, nDropAction, relLoc.X(), relLoc.Y(), nSourceActions, aFlavorList ); @@ -404,7 +341,7 @@ sal_Int32 DNDEventDispatcher::fireDragOverEvent( Window *pWindow, if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() ) { - OClearableGuard aGuard( Application::GetSolarMutex() ); + SolarMutexClearableGuard aSolarGuard; // query DropTarget from window Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget(); @@ -413,7 +350,7 @@ sal_Int32 DNDEventDispatcher::fireDragOverEvent( Window *pWindow, { // retrieve relative mouse position Point relLoc = pWindow->ImplFrameToOutput( rLocation ); - aGuard.clear(); + aSolarGuard.clear(); n = static_cast < DNDListenerContainer * > ( xDropTarget.get() )->fireDragOverEvent( xContext, nDropAction, relLoc.X(), relLoc.Y(), nSourceActions ); @@ -433,7 +370,7 @@ sal_Int32 DNDEventDispatcher::fireDragExitEvent( Window *pWindow ) throw(Runtime if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() ) { - OClearableGuard aGuard( Application::GetSolarMutex() ); + SolarMutexClearableGuard aGuard; // query DropTarget from window Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget(); @@ -464,7 +401,7 @@ sal_Int32 DNDEventDispatcher::fireDropActionChangedEvent( Window *pWindow, if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() ) { - OClearableGuard aGuard( Application::GetSolarMutex() ); + SolarMutexClearableGuard aGuard; // query DropTarget from window Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget(); @@ -497,7 +434,7 @@ sal_Int32 DNDEventDispatcher::fireDropEvent( Window *pWindow, if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() ) { - OClearableGuard aGuard( Application::GetSolarMutex() ); + SolarMutexClearableGuard aGuard; // query DropTarget from window Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget(); @@ -542,7 +479,7 @@ sal_Int32 DNDEventDispatcher::fireDragGestureEvent( Window *pWindow, if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() ) { - OClearableGuard aGuard( Application::GetSolarMutex() ); + SolarMutexClearableGuard aGuard; // query DropTarget from window Reference< XDragGestureRecognizer > xDragGestureRecognizer = pWindow->GetDragGestureRecognizer(); @@ -563,3 +500,5 @@ sal_Int32 DNDEventDispatcher::fireDragGestureEvent( Window *pWindow, return n; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/dndlcon.cxx b/vcl/source/window/dndlcon.cxx index 9d768ad49ac9..977e8611e70a 100644 --- a/vcl/source/window/dndlcon.cxx +++ b/vcl/source/window/dndlcon.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -193,7 +194,7 @@ sal_uInt32 DNDListenerContainer::fireDropEvent( const Reference< XDropTargetDrop } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } @@ -253,7 +254,7 @@ sal_uInt32 DNDListenerContainer::fireDragExitEvent() } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } @@ -305,7 +306,7 @@ sal_uInt32 DNDListenerContainer::fireDragOverEvent( const Reference< XDropTarget } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } @@ -373,7 +374,7 @@ sal_uInt32 DNDListenerContainer::fireDragEnterEvent( const Reference< XDropTarge } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } @@ -440,7 +441,7 @@ sal_uInt32 DNDListenerContainer::fireDropActionChangedEvent( const Reference< XD } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } @@ -502,7 +503,7 @@ sal_uInt32 DNDListenerContainer::fireDragGestureEvent( sal_Int8 dragAction, sal_ } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } @@ -565,3 +566,5 @@ void SAL_CALL DNDListenerContainer::dropComplete( sal_Bool success ) throw (Runt m_xDropTargetDropContext.clear(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx index 4d1c77ab09b5..df29d9e3a07a 100644 --- a/vcl/source/window/dockingarea.cxx +++ b/vcl/source/window/dockingarea.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -247,3 +248,4 @@ void DockingAreaWindow::Resize() // ----------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 314aa67597b2..6186514d2b88 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,9 +30,7 @@ #include "precompiled_vcl.hxx" #include <tools/time.hxx> -#ifndef _SV_RC_H #include <tools/rc.h> -#endif #include <brdwin.hxx> #include <svdata.hxx> @@ -370,7 +369,7 @@ ImplDockingWindowWrapper* DockingManager::GetDockingWindowWrapper( const Window if( (*p)->mpDockingWindow == pWindow ) return (*p); else - p++; + ++p; } return NULL; } @@ -484,7 +483,7 @@ void DockingManager::RemoveWindow( const Window *pWindow ) break; } else - p++; + ++p; } } @@ -1686,3 +1685,5 @@ sal_Bool ImplDockingWindowWrapper::IsLocked() const { return mbLocked; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index a3caabce0c5c..6440d118fe54 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #include <tools/time.hxx> #include <tools/rc.h> - #include <vcl/event.hxx> #include <vcl/floatwin.hxx> #include <vcl/dockwin.hxx> @@ -1115,3 +1115,5 @@ const Size& DockingWindow::GetMaxOutputSizePixel() const return mpFloatWin->GetMaxOutputSizePixel(); return mpImplData->maMaxOutSize; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index f8bf9a97d6dd..118c60f214cc 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -135,7 +136,7 @@ void FloatingWindow::ImplInit( Window* pParent, WinBits nStyle ) mpNextFloat = NULL; mpFirstPopupModeWin = NULL; mnPostId = 0; - mnTitle = (nStyle & WB_MOVEABLE) ? FLOATWIN_TITLE_NORMAL : FLOATWIN_TITLE_NONE; + mnTitle = (nStyle & (WB_MOVEABLE | WB_POPUP)) ? FLOATWIN_TITLE_NORMAL : FLOATWIN_TITLE_NONE; mnOldTitle = mnTitle; mnPopupModeFlags = 0; mbInPopupMode = sal_False; @@ -649,6 +650,8 @@ void FloatingWindow::SetTitleType( sal_uInt16 nTitle ) nTitleStyle = BORDERWINDOW_TITLE_SMALL; else if ( nTitle == FLOATWIN_TITLE_TEAROFF ) nTitleStyle = BORDERWINDOW_TITLE_TEAROFF; + else if ( nTitle == FLOATWIN_TITLE_POPUP ) + nTitleStyle = BORDERWINDOW_TITLE_POPUP; else // nTitle == FLOATWIN_TITLE_NONE nTitleStyle = BORDERWINDOW_TITLE_NONE; ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetTitleType( nTitleStyle, aOutSize ); @@ -669,7 +672,9 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags ) // remove title mnOldTitle = mnTitle; - if ( nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF ) + if ( ( mpWindowImpl->mnStyle & WB_POPUP ) && GetText().Len() ) + SetTitleType( FLOATWIN_TITLE_POPUP ); + else if ( nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF ) SetTitleType( FLOATWIN_TITLE_TEAROFF ); else SetTitleType( FLOATWIN_TITLE_NONE ); @@ -873,3 +878,4 @@ void FloatingWindow::RemovePopupModeWindow( Window* pWindow ) mpFirstPopupModeWin = NULL; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/introwin.cxx b/vcl/source/window/introwin.cxx index 4ed808852336..538bd6bf25a6 100644 --- a/vcl/source/window/introwin.cxx +++ b/vcl/source/window/introwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -83,3 +84,5 @@ void IntroWindow::SetBackgroundBitmap( const BitmapEx& rBitmapEx ) ImplGetFrame()->SetBackgroundBitmap( pBmp ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/javachild.cxx b/vcl/source/window/javachild.cxx index aa198c85c138..1f15019999e5 100644 --- a/vcl/source/window/javachild.cxx +++ b/vcl/source/window/javachild.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,3 +62,5 @@ sal_IntPtr JavaChildWindow::getParentWindowHandleForJava() { return SystemChildWindow::GetParentWindowHandle( sal_True ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/keycod.cxx b/vcl/source/window/keycod.cxx index 44c0a8b79d0b..466ebbb41ebf 100644 --- a/vcl/source/window/keycod.cxx +++ b/vcl/source/window/keycod.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -151,3 +152,5 @@ KeyFuncType KeyCode::GetFunction() const return KEYFUNC_DONTKNOW; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/keyevent.cxx b/vcl/source/window/keyevent.cxx index 9d6854430611..db8144c3d648 100644 --- a/vcl/source/window/keyevent.cxx +++ b/vcl/source/window/keyevent.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -114,3 +115,4 @@ const Point& HelpEvent::GetMousePosPixel() const return maPos; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 72715139f699..d4e16ed6c121 100755..100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1,3 +1,5 @@ + +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +30,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include "tools/list.hxx" #include "tools/debug.hxx" #include "tools/diagnose_ex.h" #include "tools/rc.h" @@ -102,35 +103,6 @@ DBG_NAME( Menu ) // document closer #define IID_DOCUMENTCLOSE 1 -#ifdef OS2 - -#include <xwphook.h> - -// return sal_True if hilite should be executed: left mouse button down -// or xwp mouse hook enabled -static sal_Bool ImplHilite( const MouseEvent& rMEvt ) -{ - static sal_Bool init = sal_False; - static HOOKCONFIG hc; - - // read XWP settings at program startup - if (init == sal_False) { - sal_Bool rc; - sal_uLong cb = sizeof(HOOKCONFIG); - memset(&hc, 0, sizeof(HOOKCONFIG)); - rc = PrfQueryProfileData( HINI_USER, INIAPP_XWPHOOK, INIKEY_HOOK_CONFIG, - &hc, &cb); - init = sal_True; - } - // check mouse left button - if (rMEvt.GetButtons() == MOUSE_LEFT) - return sal_True; - // return xwp flag - return hc.fSlidingMenus; -} - -#endif - static sal_Bool ImplAccelDisabled() { // display of accelerator strings may be suppressed via configuration @@ -561,7 +533,6 @@ public: Size getMinSize(); Image maImage; - Image maImageHC; }; DecoToolBox::DecoToolBox( Window* pParent, WinBits nStyle ) : @@ -639,8 +610,7 @@ void DecoToolBox::SetImages( long nMaxHeight, bool bForce ) Color aEraseColor( 255, 255, 255, 255 ); BitmapEx aBmpExDst( maImage.GetBitmapEx() ); - BitmapEx aBmpExSrc( GetSettings().GetStyleSettings().GetHighContrastMode() ? - maImageHC.GetBitmapEx() : aBmpExDst ); + BitmapEx aBmpExSrc( aBmpExDst ); aEraseColor.SetTransparency( 255 ); aBmpExDst.Erase( aEraseColor ); @@ -965,7 +935,7 @@ void Menu::ImplInit() { mnHighlightedItemPos = ITEMPOS_INVALID; mpSalMenu = NULL; - nMenuFlags = MENU_FLAG_SHOWCHECKIMAGES; + nMenuFlags = 0; nDefaultItem = 0; //bIsMenuBar = sal_False; // this is now set in the ctor, must not be changed here!!! nSelectedId = 0; @@ -1102,9 +1072,6 @@ void Menu::Deactivate() if( !aDelData.isDeleted() ) { bInCallback = sal_False; - - if ( this == pStartMenu ) - GetpApp()->HideHelpStatusText(); } } @@ -1118,9 +1085,6 @@ void Menu::Highlight() if ( pStartMenu && ( pStartMenu != this ) ) pStartMenu->aHighlightHdl.Call( this ); } - - if ( !aDelData.isDeleted() && GetCurItemId() ) - GetpApp()->ShowHelpStatusText( GetHelpText( GetCurItemId() ) ); } void Menu::ImplSelect() @@ -1190,7 +1154,7 @@ void Menu::ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos ) ImplGetSVData()->mpApp->ImplCallEventListeners( &aEvent ); } - if ( !aDelData.isDeleted() && !maEventListeners.empty() ) + if ( !aDelData.isDeleted() ) maEventListeners.Call( &aEvent ); if( !aDelData.isDeleted() ) @@ -1198,8 +1162,7 @@ void Menu::ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos ) Menu* pMenu = this; while ( pMenu ) { - if ( !maChildEventListeners.empty() ) - maChildEventListeners.Call( &aEvent ); + maChildEventListeners.Call( &aEvent ); if( aDelData.isDeleted() ) break; @@ -1211,12 +1174,12 @@ void Menu::ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos ) void Menu::AddEventListener( const Link& rEventListener ) { - maEventListeners.push_back( rEventListener ); + maEventListeners.addListener( rEventListener ); } void Menu::RemoveEventListener( const Link& rEventListener ) { - maEventListeners.remove( rEventListener ); + maEventListeners.removeListener( rEventListener ); } // ----------------------------------------------------------------------- @@ -2314,6 +2277,37 @@ long Menu::ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lon return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight; } +sal_Bool Menu::ImplGetNativeSubmenuArrowSize( Window* pWin, Size& rArrowSize, long& rArrowSpacing ) const +{ + ImplControlValue aVal; + Rectangle aNativeBounds; + Rectangle aNativeContent; + Point tmp( 0, 0 ); + Rectangle aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) ); + if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, + PART_MENU_SUBMENU_ARROW ) ) + { + if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP), + ControlPart(PART_MENU_SUBMENU_ARROW), + aCtrlRegion, + ControlState(CTRL_STATE_ENABLED), + aVal, + OUString(), + aNativeBounds, + aNativeContent ) + ) + { + Size aSize( Size ( aNativeContent.GetWidth(), + aNativeContent.GetHeight() ) ); + rArrowSize = aSize; + rArrowSpacing = aNativeBounds.GetWidth() - aNativeContent.GetWidth(); + + return sal_True; + } + } + return sal_False; +} + // ----------------------------------------------------------------------- void Menu::ImplAddDel( ImplMenuDelData& rDel ) @@ -2369,6 +2363,10 @@ Size Menu::ImplCalcSize( Window* pWin ) if( nMax > nMinMenuItemHeight ) nMinMenuItemHeight = nMax; + // When no native rendering of the checkbox & no image in the menu, we + // have to add some extra space even in the MENU_FLAG_SHOWCHECKIMAGES case + bool bSpaceForCheckbox = ( nMax == 0 ); + const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings(); if ( rSettings.GetUseImagesInMenus() ) { @@ -2378,6 +2376,9 @@ Size Menu::ImplCalcSize( Window* pWin ) MenuItemData* pData = pItemList->GetDataFromPos( --i ); if ( ImplIsVisible( i ) && (( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ))) { + // we have an icon, don't add the extra space + bSpaceForCheckbox = false; + Size aImgSz = pData->aImage.GetSizePixel(); if ( aImgSz.Height() > aMaxImgSz.Height() ) aMaxImgSz.Height() = aImgSz.Height(); @@ -2424,7 +2425,7 @@ Size Menu::ImplCalcSize( Window* pWin ) if ( !bIsMenuBar && pData->HasCheck() ) { nCheckWidth = nMaxCheckWidth; - if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) + if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox ) { // checks / images take the same place if( ! ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) ) @@ -2498,7 +2499,7 @@ Size Menu::ImplCalcSize( Window* pWin ) sal_uInt16 gfxExtra = (sal_uInt16) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text nCheckPos = (sal_uInt16)nExtra; - if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) + if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox ) { long nImgOrChkWidth = 0; nImagePos = nCheckPos; @@ -2855,21 +2856,57 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa // SubMenu? if ( !bLayout && !bIsMenuBar && pData->pSubMenu ) { - aTmpPos.X() = aOutSz.Width() - nFontHeight + nExtra - nOuterSpace; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nExtra/2; - aTmpPos.Y() += ( pData->aSz.Height() / 2 ) - ( nFontHeight/4 ); - if ( pData->nBits & MIB_POPUPSELECT ) + bool bNativeOk = false; + if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, + PART_MENU_SUBMENU_ARROW ) ) { - pWin->SetTextColor( rSettings.GetMenuTextColor() ); - Point aTmpPos2( aPos ); - aTmpPos2.X() = aOutSz.Width() - nFontHeight - nFontHeight/4; - aDecoView.DrawFrame( - Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pData->aSz.Height() ) ), FRAME_DRAW_GROUP ); + ControlState nState = 0; + Size aTmpSz( 0, 0 ); + long aSpacing = 0; + + if( !ImplGetNativeSubmenuArrowSize( pWin, + aTmpSz, aSpacing ) ) + { + aTmpSz = Size( nFontHeight, nFontHeight ); + aSpacing = nOuterSpace; + } + + if ( pData->bEnabled ) + nState |= CTRL_STATE_ENABLED; + if ( bHighlighted ) + nState |= CTRL_STATE_SELECTED; + + aTmpPos.X() = aOutSz.Width() - aTmpSz.Width() - aSpacing - nOuterSpace; + aTmpPos.Y() = aPos.Y() + ( pData->aSz.Height() - aTmpSz.Height() ) / 2; + aTmpPos.Y() += nExtra/2; + + Rectangle aItemRect( aTmpPos, aTmpSz ); + MenupopupValue aVal( nTextPos-GUTTERBORDER, aItemRect ); + bNativeOk = pWin->DrawNativeControl( CTRL_MENU_POPUP, + PART_MENU_SUBMENU_ARROW, + aItemRect, + nState, + aVal, + OUString() ); + } + if( ! bNativeOk ) + { + aTmpPos.X() = aOutSz.Width() - nFontHeight + nExtra - nOuterSpace; + aTmpPos.Y() = aPos.Y(); + aTmpPos.Y() += nExtra/2; + aTmpPos.Y() += ( pData->aSz.Height() / 2 ) - ( nFontHeight/4 ); + if ( pData->nBits & MIB_POPUPSELECT ) + { + pWin->SetTextColor( rSettings.GetMenuTextColor() ); + Point aTmpPos2( aPos ); + aTmpPos2.X() = aOutSz.Width() - nFontHeight - nFontHeight/4; + aDecoView.DrawFrame( + Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pData->aSz.Height() ) ), FRAME_DRAW_GROUP ); + } + aDecoView.DrawSymbol( + Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ), + SYMBOL_SPIN_RIGHT, pWin->GetTextColor(), nSymbolStyle ); } - aDecoView.DrawSymbol( - Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ), - SYMBOL_SPIN_RIGHT, pWin->GetTextColor(), nSymbolStyle ); } if ( pThisItemOnly && bHighlighted ) @@ -4500,10 +4537,6 @@ void MenuFloatingWindow::MouseMove( const MouseEvent& rMEvt ) if ( rMEvt.IsLeaveWindow() ) { -#ifdef OS2 - if ( ImplHilite(rMEvt) ) - { -#endif // #102461# do not remove highlight if a popup menu is open at this position MenuItemData* pData = pMenu ? pMenu->pItemList->GetDataFromPos( nHighlightedItem ) : NULL; // close popup with some delayed if we leave somewhere else @@ -4512,17 +4545,11 @@ void MenuFloatingWindow::MouseMove( const MouseEvent& rMEvt ) if( !pActivePopup || (pData && pData->pSubMenu != pActivePopup ) ) ChangeHighlightItem( ITEMPOS_INVALID, sal_False ); -#ifdef OS2 - } -#endif if ( IsScrollMenu() ) ImplScroll( rMEvt.GetPosPixel() ); } else -#ifdef OS2 - if ( ImplHilite(rMEvt) ) -#endif { aSubmenuCloseTimer.Stop(); if( bIgnoreFirstMove ) @@ -5220,18 +5247,14 @@ MenuBarWindow::MenuBarWindow( Window* pParent ) : if( pResMgr ) { BitmapEx aBitmap( ResId( SV_RESID_BITMAP_CLOSEDOC, *pResMgr ) ); - BitmapEx aBitmapHC( ResId( SV_RESID_BITMAP_CLOSEDOCHC, *pResMgr ) ); - aCloser.maImage = Image( aBitmap ); - aCloser.maImageHC = Image( aBitmapHC ); aCloser.SetOutStyle( TOOLBOX_STYLE_FLAT ); aCloser.SetBackground(); aCloser.SetPaintTransparent( sal_True ); aCloser.SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - aCloser.InsertItem( IID_DOCUMENTCLOSE, - GetSettings().GetStyleSettings().GetHighContrastMode() ? aCloser.maImageHC : aCloser.maImage, 0 ); + aCloser.InsertItem( IID_DOCUMENTCLOSE, aCloser.maImage, 0 ); aCloser.SetSelectHdl( LINK( this, MenuBarWindow, CloserHdl ) ); aCloser.AddEventListener( LINK( this, MenuBarWindow, ToolboxEventHdl ) ); aCloser.SetQuickHelpText( IID_DOCUMENTCLOSE, XubString( ResId( SV_HELPTEXT_CLOSEDOCUMENT, *pResMgr ) ) ); @@ -5489,9 +5512,6 @@ void MenuBarWindow::MouseMove( const MouseEvent& rMEvt ) sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() ); if ( ( nEntry != ITEMPOS_INVALID ) -#ifdef OS2 - && ( ImplHilite(rMEvt) ) -#endif && ( nEntry != nHighlightedItem ) ) ChangeHighlightItem( nEntry, sal_False ); } @@ -6160,3 +6180,5 @@ ImplMenuDelData::~ImplMenuDelData() if( mpMenu ) const_cast< Menu* >( mpMenu )->ImplRemoveDel( *this ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx index c6d6afa4a2d2..ca8bcf3c2917 100644 --- a/vcl/source/window/mnemonic.cxx +++ b/vcl/source/window/mnemonic.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -417,3 +418,5 @@ String MnemonicGenerator::EraseAllMnemonicChars( const String& rStr ) return aStr; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/mnemonicengine.cxx b/vcl/source/window/mnemonicengine.cxx index f277ee0c1265..1ca9f2c22d57 100644 --- a/vcl/source/window/mnemonicengine.cxx +++ b/vcl/source/window/mnemonicengine.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -128,3 +129,5 @@ namespace vcl //........................................................................ } // namespace vcl //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/mouseevent.cxx b/vcl/source/window/mouseevent.cxx index afb0b5f68a07..2e76750e1cf5 100644 --- a/vcl/source/window/mouseevent.cxx +++ b/vcl/source/window/mouseevent.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -90,3 +91,5 @@ void MouseEvent::InitMouseEvent( ::com::sun::star::awt::MouseEvent& rEvent ) con rEvent.ClickCount = GetClicks(); rEvent.PopupTrigger = sal_False; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index 9f36b9ed5109..3f8c5683458f 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -55,14 +56,11 @@ static void ImplInitMsgBoxImageList() { ResMgr* pResMgr = ImplGetResMgr(); pSVData->maWinData.mpMsgBoxImgList = new ImageList(4); - pSVData->maWinData.mpMsgBoxHCImgList = new ImageList(4); if( pResMgr ) { Color aNonAlphaMask( 0xC0, 0xC0, 0xC0 ); pSVData->maWinData.mpMsgBoxImgList->InsertFromHorizontalBitmap ( ResId( SV_RESID_BITMAP_MSGBOX, *pResMgr ), 4, &aNonAlphaMask ); - pSVData->maWinData.mpMsgBoxHCImgList->InsertFromHorizontalBitmap - ( ResId( SV_RESID_BITMAP_MSGBOX_HC, *pResMgr ), 4, &aNonAlphaMask ); } } } @@ -209,7 +207,7 @@ MessBox::MessBox( Window* pParent, const ResId& rResId ) : void MessBox::ImplLoadRes( const ResId& ) { - SetText( ReadStringRes() ); + SetText( ReadStringRes() ); SetMessText( ReadStringRes() ); SetHelpText( ReadStringRes() ); } @@ -312,9 +310,6 @@ void MessBox::ImplPosControls() IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_Y ), aImageSize ); mpFixedImage->SetImage( maImage ); - // forward the HC image - if( !!maImageHC ) - mpFixedImage->SetModeImage( maImageHC, BMP_COLOR_HIGHCONTRAST ); mpFixedImage->Show(); nMaxWidth -= aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE; } @@ -467,37 +462,41 @@ void MessBox::SetDefaultCheckBoxText() // ----------------------------------------------------------------------- -sal_Bool MessBox::SetModeImage( const Image& rImage, BmpColorMode eMode ) +sal_Bool MessBox::SetModeImage( const Image& rImage ) { - if( eMode == BMP_COLOR_NORMAL ) - SetImage( rImage ); - else if( eMode == BMP_COLOR_HIGHCONTRAST ) - maImageHC = rImage; - else - return sal_False; + SetImage( rImage ); return sal_True; } // ----------------------------------------------------------------------- -const Image& MessBox::GetModeImage( BmpColorMode eMode ) const +const Image& MessBox::GetModeImage( ) const { - if( eMode == BMP_COLOR_HIGHCONTRAST ) - return maImageHC; - else - return maImage; + return maImage; } // ----------------------------------------------------------------------- +Size MessBox::GetOptimalSize(WindowSizeType eType) const +{ + switch( eType ) { + case WINDOWSIZE_MINIMUM: + // FIXME: base me on the font size ? + return Size( 250, 100 ); + default: + return Window::GetOptimalSize( eType ); + } +} + +// ============================================================================ + void InfoBox::ImplInitInfoBoxData() { // Default Text is the display title from the application if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? - InfoBox::GetStandardImageHC() : InfoBox::GetStandardImage() ); + SetImage( InfoBox::GetStandardImage() ); mnSoundType = ((sal_uInt16)SOUND_INFO)+1; } @@ -525,15 +524,7 @@ Image InfoBox::GetStandardImage() return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 4 ); } -// ----------------------------------------------------------------------- - -Image InfoBox::GetStandardImageHC() -{ - ImplInitMsgBoxImageList(); - return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 4 ); -} - -// ----------------------------------------------------------------------- +// ============================================================================ void WarningBox::ImplInitWarningBoxData() { @@ -579,7 +570,7 @@ Image WarningBox::GetStandardImage() return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 3 ); } -// ----------------------------------------------------------------------- +// ============================================================================ void ErrorBox::ImplInitErrorBoxData() { @@ -587,8 +578,7 @@ void ErrorBox::ImplInitErrorBoxData() if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? - ErrorBox::GetStandardImageHC() : ErrorBox::GetStandardImage() ); + SetImage( ErrorBox::GetStandardImage() ); mnSoundType = ((sal_uInt16)SOUND_ERROR)+1; } @@ -617,15 +607,7 @@ Image ErrorBox::GetStandardImage() return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 1 ); } -// ----------------------------------------------------------------------- - -Image ErrorBox::GetStandardImageHC() -{ - ImplInitMsgBoxImageList(); - return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 1 ); -} - -// ----------------------------------------------------------------------- +// ============================================================================ void QueryBox::ImplInitQueryBoxData() { @@ -633,8 +615,7 @@ void QueryBox::ImplInitQueryBoxData() if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? - QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() ); + SetImage( QueryBox::GetStandardImage() ); mnSoundType = ((sal_uInt16)SOUND_QUERY)+1; } @@ -671,23 +652,4 @@ Image QueryBox::GetStandardImage() return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 2 ); } -// ----------------------------------------------------------------------- - -Image QueryBox::GetStandardImageHC() -{ - ImplInitMsgBoxImageList(); - return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 2 ); -} - -// ----------------------------------------------------------------------- - -Size MessBox::GetOptimalSize(WindowSizeType eType) const -{ - switch( eType ) { - case WINDOWSIZE_MINIMUM: - // FIXME: base me on the font size ? - return Size( 250, 100 ); - default: - return Window::GetOptimalSize( eType ); - } -} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/popupmenuwindow.cxx b/vcl/source/window/popupmenuwindow.cxx index 78ef0bcf1068..46fc51d8176d 100644 --- a/vcl/source/window/popupmenuwindow.cxx +++ b/vcl/source/window/popupmenuwindow.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -77,3 +78,4 @@ bool PopupMenuFloatingWindow::IsPopupMenu() const return mpImplData->mnMenuStackLevel != ::std::numeric_limits<sal_uInt16>::max(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 094567c7f15c..36293298172c 100755..100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -72,10 +73,7 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const Re { SetPaintTransparent( sal_True ); SetBackground(); - if( useHCColorReplacement() ) - maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); - else - maPageVDev.SetBackground( Color( COL_WHITE ) ); + maPageVDev.SetBackground( Color( COL_WHITE ) ); maHorzDim.Show(); maVertDim.Show(); @@ -87,79 +85,12 @@ PrintDialog::PrintPreviewWindow::~PrintPreviewWindow() { } -bool PrintDialog::PrintPreviewWindow::useHCColorReplacement() const -{ - bool bRet = false; - if( GetSettings().GetStyleSettings().GetHighContrastMode() ) - { - try - { - // get service provider - Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); - // create configuration hierachical access name - if( xSMgr.is() ) - { - try - { - Reference< XMultiServiceFactory > xConfigProvider( - Reference< XMultiServiceFactory >( - xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationProvider" ))), - UNO_QUERY ) - ); - if( xConfigProvider.is() ) - { - Sequence< Any > aArgs(1); - PropertyValue aVal; - aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); - aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Accessibility" ) ); - aArgs.getArray()[0] <<= aVal; - Reference< XNameAccess > xConfigAccess( - Reference< XNameAccess >( - xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationAccess" )), - aArgs ), - UNO_QUERY ) - ); - if( xConfigAccess.is() ) - { - try - { - sal_Bool bValue = sal_False; - Any aAny = xConfigAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsForPagePreviews" ) ) ); - if( aAny >>= bValue ) - bRet = bool(bValue); - } - catch( NoSuchElementException& ) - { - } - catch( WrappedTargetException& ) - { - } - } - } - } - catch( Exception& ) - { - } - } - } - catch( WrappedTargetException& ) - { - } - } - return bRet; -} - void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDCEvt ) { // react on settings changed if( i_rDCEvt.GetType() == DATACHANGED_SETTINGS ) { - if( useHCColorReplacement() ) - maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); - else - maPageVDev.SetBackground( Color( COL_WHITE ) ); + maPageVDev.SetBackground( Color( COL_WHITE ) ); } Window::DataChanged( i_rDCEvt ); } @@ -322,10 +253,6 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi aBuf.append( maToolTipString ); SetQuickHelpText( aBuf.makeStringAndClear() ); maMtf = i_rNewPreview; - if( useHCColorReplacement() ) - { - maMtf.ReplaceColors( Color( COL_BLACK ), Color( COL_WHITE ), 30 ); - } maOrigSize = i_rOrigSize; maReplacementString = i_rReplacement; @@ -623,13 +550,12 @@ PrintDialog::JobTabPage::JobTabPage( Window* i_pParent, const ResId& rResId ) , maCollateImage( this, VclResId( SV_PRINT_COLLATE_IMAGE ) ) , maReverseOrderBox( this, VclResId( SV_PRINT_OPT_REVERSE ) ) , 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 ) { FreeResource(); + maCopySpacer.Show(); maStatusTxt.Show(); maCommentTxt.Show(); @@ -707,15 +633,6 @@ 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" ) ) @@ -742,7 +659,8 @@ void PrintDialog::JobTabPage::storeToSettings() maCopyCountField.GetText() ); pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ), - rtl::OUString::createFromAscii( maCollateBox.IsChecked() ? "true" : "false" ) ); + maCollateBox.IsChecked() ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true")) : + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false")) ); } PrintDialog::OutputOptPage::OutputOptPage( Window* i_pParent, const ResId& i_rResId ) @@ -777,14 +695,6 @@ void PrintDialog::OutputOptPage::setupLayout() 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() @@ -792,7 +702,8 @@ 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" ) ); + maToFileBox.IsChecked() ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true")) + : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false")) ); } PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterController>& i_rController ) @@ -842,6 +753,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont // init reverse print maJobPage.maReverseOrderBox.Check( maPController->getReversePrint() ); + // fill printer listbox const std::vector< rtl::OUString >& rQueues( Printer::GetPrinterQueues() ); for( std::vector< rtl::OUString >::const_iterator it = rQueues.begin(); @@ -1146,7 +1058,7 @@ void PrintDialog::setupOptionalUI() boost::shared_ptr< vcl::RowOrColumn > pCurColumn; Window* pCurParent = 0, *pDynamicPageParent = 0; - sal_uInt16 nOptPageId = 9, nCurSubGroup = 0; + sal_uInt16 nOptPageId = 9; bool bOnStaticPage = false; bool bSubgroupOnStaticPage = false; @@ -1159,7 +1071,6 @@ void PrintDialog::setupOptionalUI() rOptions[i].Value >>= aOptProp; // extract ui element - bool bEnabled = true; rtl::OUString aCtrlType; rtl::OUString aText; rtl::OUString aPropertyName; @@ -1168,7 +1079,6 @@ void PrintDialog::setupOptionalUI() Sequence< rtl::OUString > aHelpTexts; Sequence< rtl::OUString > aHelpIds; sal_Int64 nMinValue = 0, nMaxValue = 0; - sal_Int32 nCurHelpText = 0; rtl::OUString aGroupingHint; rtl::OUString aDependsOnName; sal_Int32 nDependsOnValue = 0; @@ -1177,59 +1087,58 @@ void PrintDialog::setupOptionalUI() for( int n = 0; n < aOptProp.getLength(); n++ ) { const beans::PropertyValue& rEntry( aOptProp[ n ] ); - if( rEntry.Name.equalsAscii( "Text" ) ) + if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Text" ) ) ) { rEntry.Value >>= aText; } - else if( rEntry.Name.equalsAscii( "ControlType" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ControlType" ) ) ) { rEntry.Value >>= aCtrlType; } - else if( rEntry.Name.equalsAscii( "Choices" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Choices" ) ) ) { rEntry.Value >>= aChoices; } - else if( rEntry.Name.equalsAscii( "ChoicesDisabled" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ChoicesDisabled" ) ) ) { rEntry.Value >>= aChoicesDisabled; } - else if( rEntry.Name.equalsAscii( "Property" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Property" ) ) ) { PropertyValue aVal; rEntry.Value >>= aVal; aPropertyName = aVal.Name; } - else if( rEntry.Name.equalsAscii( "Enabled" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Enabled" ) ) ) { sal_Bool bValue = sal_True; rEntry.Value >>= bValue; - bEnabled = bValue; } - else if( rEntry.Name.equalsAscii( "GroupingHint" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GroupingHint" ) ) ) { rEntry.Value >>= aGroupingHint; } - else if( rEntry.Name.equalsAscii( "DependsOnName" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnName" ) ) ) { rEntry.Value >>= aDependsOnName; } - else if( rEntry.Name.equalsAscii( "DependsOnEntry" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnEntry" ) ) ) { rEntry.Value >>= nDependsOnValue; } - else if( rEntry.Name.equalsAscii( "AttachToDependency" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "AttachToDependency" ) ) ) { rEntry.Value >>= bUseDependencyRow; } - else if( rEntry.Name.equalsAscii( "MinValue" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MinValue" ) ) ) { rEntry.Value >>= nMinValue; } - else if( rEntry.Name.equalsAscii( "MaxValue" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MaxValue" ) ) ) { rEntry.Value >>= nMaxValue; } - else if( rEntry.Name.equalsAscii( "HelpText" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HelpText" ) ) ) { if( ! (rEntry.Value >>= aHelpTexts) ) { @@ -1241,7 +1150,7 @@ void PrintDialog::setupOptionalUI() } } } - else if( rEntry.Name.equalsAscii( "HelpId" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HelpId" ) ) ) { if( ! (rEntry.Value >>= aHelpIds ) ) { @@ -1253,7 +1162,7 @@ void PrintDialog::setupOptionalUI() } } } - else if( rEntry.Name.equalsAscii( "HintNoLayoutPage" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HintNoLayoutPage" ) ) ) { sal_Bool bNoLayoutPage = sal_False; rEntry.Value >>= bNoLayoutPage; @@ -1268,7 +1177,7 @@ void PrintDialog::setupOptionalUI() bool bSwitchPage = false; if( aGroupingHint.getLength() ) bSwitchPage = true; - else if( aCtrlType.equalsAscii( "Subgroup" ) || (bOnStaticPage && ! bSubgroupOnStaticPage ) ) + else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Subgroup" ) ) || (bOnStaticPage && ! bSubgroupOnStaticPage ) ) bSwitchPage = true; if( bSwitchPage ) { @@ -1281,25 +1190,25 @@ void PrintDialog::setupOptionalUI() bOnStaticPage = false; bSubgroupOnStaticPage = false; - if( aGroupingHint.equalsAscii( "PrintRange" ) ) + if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintRange" ) ) ) { pCurColumn = maJobPage.mxPrintRange; pCurParent = &maJobPage; // set job page as current parent bOnStaticPage = true; } - else if( aGroupingHint.equalsAscii( "OptionsPage" ) ) + else if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OptionsPage" ) ) ) { pCurColumn = boost::dynamic_pointer_cast<vcl::RowOrColumn>(maOptionsPage.getLayout()); pCurParent = &maOptionsPage; // set options page as current parent bOnStaticPage = true; } - else if( aGroupingHint.equalsAscii( "OptionsPageOptGroup" ) ) + else if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OptionsPageOptGroup" ) ) ) { pCurColumn = maOptionsPage.mxOptGroup; pCurParent = &maOptionsPage; // set options page as current parent bOnStaticPage = true; } - else if( aGroupingHint.equalsAscii( "LayoutPage" ) ) + else if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LayoutPage" ) ) ) { pCurColumn = boost::dynamic_pointer_cast<vcl::RowOrColumn>(maNUpPage.getLayout()); pCurParent = &maNUpPage; // set layout page as current parent @@ -1313,7 +1222,7 @@ void PrintDialog::setupOptionalUI() } } - if( aCtrlType.equalsAscii( "Group" ) || + if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Group" ) ) || ( ! pCurParent && ! (bOnStaticPage || aGroupingHint.getLength() ) ) ) { // add new tab page @@ -1329,25 +1238,22 @@ void PrintDialog::setupOptionalUI() // set help text setHelpText( pNewGroup, aHelpTexts, 0 ); - // reset subgroup counter - nCurSubGroup = 0; - aDynamicColumns.push_back( boost::dynamic_pointer_cast<vcl::RowOrColumn>(pNewGroup->getLayout()) ); pCurColumn = aDynamicColumns.back(); pCurColumn->setParentWindow( pNewGroup ); bSubgroupOnStaticPage = false; bOnStaticPage = false; } - else if( aCtrlType.equalsAscii( "Subgroup" ) && (pCurParent || aGroupingHint.getLength() ) ) + else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Subgroup" ) ) && (pCurParent || aGroupingHint.getLength() ) ) { bSubgroupOnStaticPage = (aGroupingHint.getLength() != 0); // create group FixedLine - if( ! aGroupingHint.equalsAscii( "PrintRange" ) || + if( ! aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintRange" ) ) || ! pCurColumn->countElements() == 0 ) { Window* pNewSub = NULL; - if( aGroupingHint.equalsAscii( "PrintRange" ) ) + if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintRange" ) ) ) pNewSub = new FixedText( pCurParent, WB_VCENTER ); else pNewSub = new FixedLine( pCurParent ); @@ -1371,9 +1277,9 @@ void PrintDialog::setupOptionalUI() pIndent->setChild( pCurColumn ); } // EVIL - else if( aCtrlType.equalsAscii( "Bool" ) && - aGroupingHint.equalsAscii( "LayoutPage" ) && - aPropertyName.equalsAscii( "PrintProspect" ) + else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Bool" ) ) && + aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LayoutPage" ) ) && + aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintProspect" ) ) ) { maNUpPage.maBrochureBtn.SetText( aText ); @@ -1417,7 +1323,7 @@ void PrintDialog::setupOptionalUI() } } } - if( aCtrlType.equalsAscii( "Bool" ) && pCurParent ) + if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Bool" ) ) && pCurParent ) { // add a check box CheckBox* pNewBox = new CheckBox( pCurParent ); @@ -1447,8 +1353,9 @@ void PrintDialog::setupOptionalUI() // add checkbox to current column pDependencyRow->addWindow( pNewBox ); } - else if( aCtrlType.equalsAscii( "Radio" ) && pCurParent ) + else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Radio" ) ) && pCurParent ) { + sal_Int32 nCurHelpText = 0; boost::shared_ptr<vcl::RowOrColumn> pRadioColumn( pCurColumn ); if( aText.getLength() ) { @@ -1506,9 +1413,9 @@ void PrintDialog::setupOptionalUI() pLabel->setLabel( pBtn ); } } - else if( ( aCtrlType.equalsAscii( "List" ) || - aCtrlType.equalsAscii( "Range" ) || - aCtrlType.equalsAscii( "Edit" ) + else if( ( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "List" ) ) || + aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Range" ) ) || + aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Edit" ) ) ) && pCurParent ) { // create a row in the current column @@ -1525,13 +1432,14 @@ void PrintDialog::setupOptionalUI() pHeading->SetText( aText ); pHeading->Show(); + // add to row pLabel = new vcl::LabeledElement( pFieldColumn.get(), 2 ); pFieldColumn->addChild( pLabel ); pLabel->setLabel( pHeading ); } - if( aCtrlType.equalsAscii( "List" ) ) + if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "List" ) ) ) { ListBox* pList = new ListBox( pCurParent, WB_DROPDOWN | WB_BORDER ); maControls.push_front( pList ); @@ -1564,7 +1472,7 @@ void PrintDialog::setupOptionalUI() else pFieldColumn->addWindow( pList ); } - else if( aCtrlType.equalsAscii( "Range" ) ) + else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Range" ) ) ) { NumericField* pField = new NumericField( pCurParent, WB_BORDER | WB_SPIN ); maControls.push_front( pField ); @@ -1597,7 +1505,7 @@ void PrintDialog::setupOptionalUI() else pFieldColumn->addWindow( pField ); } - else if( aCtrlType.equalsAscii( "Edit" ) ) + else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Edit" ) ) ) { Edit* pField = new Edit( pCurParent, WB_BORDER ); maControls.push_front( pField ); @@ -1627,7 +1535,11 @@ void PrintDialog::setupOptionalUI() } else { - DBG_ERROR( "Unsupported UI option" ); + rtl::OStringBuffer sMessage; + sMessage.append(RTL_CONSTASCII_STRINGPARAM("Unsupported UI option: \"")); + sMessage.append(rtl::OUStringToOString(aCtrlType, RTL_TEXTENCODING_UTF8)); + sMessage.append('"'); + OSL_FAIL( sMessage.getStr() ); } pCurColumn = pSaveCurColumn; @@ -1720,6 +1632,7 @@ void PrintDialog::setupOptionalUI() } Size aSz = getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED ); + SetOutputSizePixel( aSz ); } @@ -1739,21 +1652,12 @@ void PrintDialog::checkControlDependencies() maJobPage.maCollateBox.Enable( sal_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 ); + maJobPage.maCollateImage.SetImage( aImg ); maJobPage.getLayout()->resize(); // enable setup button only for printers that can be setup @@ -2283,7 +2187,7 @@ PropertyValue* PrintDialog::getValueForWindow( Window* i_pWindow ) const } else { - DBG_ERROR( "changed control not in property map" ); + OSL_FAIL( "changed control not in property map" ); } return pVal; } @@ -2307,7 +2211,7 @@ void PrintDialog::updateWindowFromProperty( const rtl::OUString& i_rProperty ) { pBox->Check( bVal ); } - else if( i_rProperty.equalsAscii( "PrintProspect" ) ) + else if( i_rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintProspect" ) ) ) { // EVIL special case if( bVal ) @@ -2611,3 +2515,4 @@ void PrintProgressDialog::Paint( const Rectangle& ) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx index 178692ff45c2..5882ef3999ba 100644 --- a/vcl/source/window/scrwnd.cxx +++ b/vcl/source/window/scrwnd.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -// #include <math.h> #include <limits.h> #include <tools/time.hxx> #include <tools/debug.hxx> @@ -400,7 +400,7 @@ IMPL_LINK( ImplWheelWindow, ImplScrollHdl, Timer*, EMPTYARG ) pWindow->Command( aCEvt ); if( aDel.IsDead() ) return 0; - mnRepaintTime = Max( Time::GetSystemTicks() - nTime, 1UL ); + mnRepaintTime = Max( Time::GetSystemTicks() - nTime, (sal_uLong)1 ); ImplRecalcScrollValues(); } } @@ -411,3 +411,5 @@ IMPL_LINK( ImplWheelWindow, ImplScrollHdl, Timer*, EMPTYARG ) return 0L; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/scrwnd.hxx b/vcl/source/window/scrwnd.hxx index 1b9011aa7859..ccc38c778c99 100644 --- a/vcl/source/window/scrwnd.hxx +++ b/vcl/source/window/scrwnd.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -90,3 +91,5 @@ public: void ImplSetWheelMode( sal_uLong nWheelMode ); sal_uLong ImplGetWheelMode() const { return mnWheelMode; } }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx index c92d9dd4130a..0c323c37f0f6 100644 --- a/vcl/source/window/seleng.cxx +++ b/vcl/source/window/seleng.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,14 +50,12 @@ inline sal_Bool SelectionEngine::ShouldDeselect( sal_Bool bModifierKey1 ) const |* |* SelectionEngine::SelectionEngine() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 10.10.94 -|* Letzte Aenderung OV 10.10.94 -|* *************************************************************************/ -SelectionEngine::SelectionEngine( Window* pWindow, FunctionSet* pFuncSet ) : - pWin( pWindow ) +SelectionEngine::SelectionEngine( Window* pWindow, FunctionSet* pFuncSet, + sal_uLong nAutoRepeatInterval ) : + pWin( pWindow ), + nUpdateInterval( nAutoRepeatInterval ) { eSelMode = SINGLE_SELECTION; pFunctionSet = pFuncSet; @@ -64,17 +63,13 @@ SelectionEngine::SelectionEngine( Window* pWindow, FunctionSet* pFuncSet ) : nLockedMods = 0; aWTimer.SetTimeoutHdl( LINK( this, SelectionEngine, ImpWatchDog ) ); - aWTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL ); + aWTimer.SetTimeout( nUpdateInterval ); } /************************************************************************* |* |* SelectionEngine::~SelectionEngine() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 10.10.94 -|* Letzte Aenderung OV 10.10.94 -|* *************************************************************************/ SelectionEngine::~SelectionEngine() @@ -86,10 +81,6 @@ SelectionEngine::~SelectionEngine() |* |* SelectionEngine::ImpWatchDog() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 10.10.94 -|* Letzte Aenderung OV 10.10.94 -|* *************************************************************************/ IMPL_LINK( SelectionEngine, ImpWatchDog, Timer*, EMPTYARG ) @@ -103,10 +94,6 @@ IMPL_LINK( SelectionEngine, ImpWatchDog, Timer*, EMPTYARG ) |* |* SelectionEngine::SetSelectionMode() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 10.10.94 -|* Letzte Aenderung OV 10.10.94 -|* *************************************************************************/ void SelectionEngine::SetSelectionMode( SelectionMode eMode ) @@ -118,10 +105,6 @@ void SelectionEngine::SetSelectionMode( SelectionMode eMode ) |* |* SelectionEngine::ActivateDragMode() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 10.10.94 -|* Letzte Aenderung OV 10.10.94 -|* *************************************************************************/ void SelectionEngine::ActivateDragMode() @@ -133,10 +116,6 @@ void SelectionEngine::ActivateDragMode() |* |* SelectionEngine::CursorPosChanging() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 10.10.94 -|* Letzte Aenderung GT 2002-04-04 -|* *************************************************************************/ void SelectionEngine::CursorPosChanging( sal_Bool bShift, sal_Bool bMod1 ) @@ -191,10 +170,6 @@ void SelectionEngine::CursorPosChanging( sal_Bool bShift, sal_Bool bMod1 ) |* |* SelectionEngine::SelMouseButtonDown() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 10.10.94 -|* Letzte Aenderung OV 07.06.95 -|* *************************************************************************/ sal_Bool SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) @@ -324,10 +299,6 @@ sal_Bool SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) |* |* SelectionEngine::SelMouseButtonUp() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 10.10.94 -|* Letzte Aenderung OV 10.10.94 -|* *************************************************************************/ sal_Bool SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) @@ -378,10 +349,6 @@ sal_Bool SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) |* |* SelectionEngine::SelMouseMove() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 10.10.94 -|* Letzte Aenderung OV 10.10.94 -|* *************************************************************************/ sal_Bool SelectionEngine::SelMouseMove( const MouseEvent& rMEvt ) @@ -400,7 +367,7 @@ sal_Bool SelectionEngine::SelMouseMove( const MouseEvent& rMEvt ) if( aWTimer.IsActive() && !aArea.IsInside( rMEvt.GetPosPixel() )) return sal_True; - + aWTimer.SetTimeout( nUpdateInterval ); aWTimer.Start(); if ( eSelMode != SINGLE_SELECTION ) { @@ -422,10 +389,6 @@ sal_Bool SelectionEngine::SelMouseMove( const MouseEvent& rMEvt ) |* |* SelectionEngine::SetWindow() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 10.10.94 -|* Letzte Aenderung OV 10.10.94 -|* *************************************************************************/ void SelectionEngine::SetWindow( Window* pNewWin ) @@ -444,10 +407,6 @@ void SelectionEngine::SetWindow( Window* pNewWin ) |* |* SelectionEngine::Reset() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 07.07.95 -|* Letzte Aenderung OV 07.07.95 -|* *************************************************************************/ void SelectionEngine::Reset() @@ -463,10 +422,6 @@ void SelectionEngine::Reset() |* |* SelectionEngine::Command() |* -|* Beschreibung SELENG.SDW -|* Ersterstellung OV 07.07.95 -|* Letzte Aenderung OV 07.07.95 -|* *************************************************************************/ void SelectionEngine::Command( const CommandEvent& rCEvt ) @@ -496,3 +451,29 @@ void SelectionEngine::Command( const CommandEvent& rCEvt ) nFlags &= ~SELENG_CMDEVT; } } + +void SelectionEngine::SetUpdateInterval( sal_uLong nInterval ) +{ + if (nInterval < SELENG_AUTOREPEAT_INTERVAL_MIN) + // Set a lower threshold. On Windows, setting this value too low + // would cause selection to get updated indefinitely. + nInterval = SELENG_AUTOREPEAT_INTERVAL_MIN; + + if (nUpdateInterval == nInterval) + // no update needed. + return; + + if (aWTimer.IsActive()) + { + // reset the timer right away on interval change. + aWTimer.Stop(); + aWTimer.SetTimeout(nInterval); + aWTimer.Start(); + } + else + aWTimer.SetTimeout(nInterval); + + nUpdateInterval = nInterval; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx index 976c56cfea56..683c114f48f7 100644 --- a/vcl/source/window/split.cxx +++ b/vcl/source/window/split.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -805,3 +806,5 @@ void Splitter::Paint( const Rectangle& rPaintRect ) Window::Paint( rPaintRect ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index 1d701752389c..9c0f4699baa8 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #include <string.h> -#include <tools/list.hxx> #include <tools/debug.hxx> #include <tools/rcid.h> @@ -46,7 +46,6 @@ #include <svdata.hxx> #include <svids.hrc> - // ======================================================================= // Attention: Must not contain non-PODs because array is enlarged/copied @@ -100,7 +99,7 @@ struct ImplSplitSet size has not lower or upper bound. */ namespace { - long ValidateSize (const long nSize, const ImplSplitItem rItem) + long ValidateSize (const long nSize, const ImplSplitItem &rItem) { if (rItem.mnMinSize>=0 && nSize<rItem.mnMinSize) return rItem.mnMinSize; @@ -123,10 +122,6 @@ namespace { #define SPLIT_WINDOW ((sal_uInt16)0x0004) #define SPLIT_NOSPLIT ((sal_uInt16)0x8000) -// ----------------------------------------------------------------------- - -DECLARE_LIST( ImplSplitList, SplitWindow* ) - // ======================================================================= static void ImplCalcBorder( WindowAlign eAlign, sal_Bool bNoAlign, @@ -189,42 +184,7 @@ void SplitWindow::ImplDrawBorder( SplitWindow* pWin ) aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN ); } else - {/* - if ( pWin->meAlign == WINDOWALIGN_BOTTOM ) - { - pWin->SetLineColor( rStyleSettings.GetShadowColor() ); - pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) ); - pWin->SetLineColor( rStyleSettings.GetLightColor() ); - pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) ); - } - else - { - pWin->SetLineColor( rStyleSettings.GetShadowColor() ); - pWin->DrawLine( Point( 0, 0 ), Point( nDX-1, 0 ) ); - pWin->SetLineColor( rStyleSettings.GetLightColor() ); - pWin->DrawLine( Point( 0, 1 ), Point( nDX-1, 1 ) ); - if ( (pWin->meAlign == WINDOWALIGN_LEFT) || (pWin->meAlign == WINDOWALIGN_RIGHT) ) - { - if ( pWin->meAlign == WINDOWALIGN_LEFT ) - { - pWin->SetLineColor( rStyleSettings.GetShadowColor() ); - pWin->DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) ); - pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) ); - pWin->SetLineColor( rStyleSettings.GetLightColor() ); - pWin->DrawLine( Point( 1, 1 ), Point( 1, nDY-3 ) ); - pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) ); - } - else - { - pWin->SetLineColor( rStyleSettings.GetShadowColor() ); - pWin->DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-3 ) ); - pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-2, nDY-2 ) ); - pWin->SetLineColor( rStyleSettings.GetLightColor() ); - pWin->DrawLine( Point( nDX-1, 0 ), Point( nDX-1, nDY-1 ) ); - pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) ); - } - } - }*/ + { if ( pWin->meAlign == WINDOWALIGN_BOTTOM ) { pWin->SetLineColor( rStyleSettings.GetShadowColor() ); @@ -3938,3 +3898,5 @@ Rectangle SplitWindow::GetFadeOutRect() const ImplGetFadeOutRect( aRect, sal_True ); return aRect; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index ee673e87c4b5..60765be7af5d 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <tools/list.hxx> #include <tools/debug.hxx> #include <tools/rc.h> @@ -96,8 +96,6 @@ struct ImplStatusItem XubString maCommand; }; -DECLARE_LIST( ImplStatusItemList, ImplStatusItem* ) - // ======================================================================= inline long ImplCalcProgessWidth( sal_uInt16 nMax, long nSize ) @@ -197,18 +195,13 @@ StatusBar::StatusBar( Window* pParent, const ResId& rResId ) : StatusBar::~StatusBar() { // Alle Items loeschen - ImplStatusItem* pItem = mpItemList->First(); - while ( pItem ) - { - delete pItem; - pItem = mpItemList->Next(); + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + delete (*mpItemList)[ i ]; } - delete mpItemList; // VirtualDevice loeschen delete mpImplData->mpVirDev; - delete mpImplData; } @@ -280,19 +273,17 @@ void StatusBar::ImplFormat() // Breiten zusammenrechnen mnItemsWidth = STATUSBAR_OFFSET_X; long nOffset = 0; - pItem = mpItemList->First(); - while ( pItem ) - { + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + pItem = (*mpItemList)[ i ]; if ( pItem->mbVisible ) { - if ( pItem->mnBits & SIB_AUTOSIZE ) + if ( pItem->mnBits & SIB_AUTOSIZE ) { nAutoSizeItems++; + } mnItemsWidth += pItem->mnWidth + nOffset; nOffset = pItem->mnOffset; } - - pItem = mpItemList->Next(); } if ( GetStyle() & WB_RIGHT ) @@ -324,28 +315,22 @@ void StatusBar::ImplFormat() nX += ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset; } - pItem = mpItemList->First(); - while ( pItem ) - { - if ( pItem->mbVisible ) - { - if ( pItem->mnBits & SIB_AUTOSIZE ) - { + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + pItem = (*mpItemList)[ i ]; + if ( pItem->mbVisible ) { + if ( pItem->mnBits & SIB_AUTOSIZE ) { pItem->mnExtraWidth = nExtraWidth; - if ( nExtraWidth2 ) - { + if ( nExtraWidth2 ) { pItem->mnExtraWidth++; nExtraWidth2--; } - } - else + } else { pItem->mnExtraWidth = 0; + } pItem->mnX = nX; nX += pItem->mnWidth + pItem->mnExtraWidth + pItem->mnOffset; } - - pItem = mpItemList->Next(); } mbFormat = sal_False; @@ -357,7 +342,7 @@ Rectangle StatusBar::ImplGetItemRectPos( sal_uInt16 nPos ) const { Rectangle aRect; ImplStatusItem* pItem; - pItem = mpItemList->GetObject( nPos ); + pItem = ( nPos < mpItemList->size() ) ? (*mpItemList)[ nPos ] : NULL; if ( pItem ) { if ( pItem->mbVisible ) @@ -380,13 +365,13 @@ sal_uInt16 StatusBar::ImplGetFirstVisiblePos() const { ImplStatusItem* pItem; - for( sal_uInt16 nPos = 0; nPos < mpItemList->Count(); nPos++ ) + for( size_t nPos = 0; nPos < mpItemList->size(); nPos++ ) { - pItem = mpItemList->GetObject( nPos ); + pItem = (*mpItemList)[ nPos ]; if ( pItem ) { if ( pItem->mbVisible ) - return nPos; + return sal_uInt16(nPos); } } @@ -440,7 +425,7 @@ void StatusBar::ImplDrawItem( sal_Bool bOffScreen, sal_uInt16 nPos, sal_Bool bDr return; // Ausgabebereich berechnen - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; long nW = mpImplData->mnItemBorderWidth + 1; Rectangle aTextRect( aRect.Left()+nW, aRect.Top()+nW, aRect.Right()-nW, aRect.Bottom()-nW ); @@ -743,14 +728,13 @@ void StatusBar::MouseButtonDown( const MouseEvent& rMEvt ) if ( mbVisibleItems ) { Point aMousePos = rMEvt.GetPosPixel(); - sal_uInt16 i = 0; // Item suchen, das geklickt wurde - ImplStatusItem* pItem = mpItemList->First(); - while ( pItem ) + for ( size_t i = 0; i < mpItemList->size(); ++i ) { + ImplStatusItem* pItem = (*mpItemList)[ i ]; // Ist es dieses Item - if ( ImplGetItemRectPos( i ).IsInside( aMousePos ) ) + if ( ImplGetItemRectPos( sal_uInt16(i) ).IsInside( aMousePos ) ) { mnCurItemId = pItem->mnId; if ( rMEvt.GetClicks() == 2 ) @@ -762,9 +746,6 @@ void StatusBar::MouseButtonDown( const MouseEvent& rMEvt ) // Item wurde gefunden return; } - - i++; - pItem = mpItemList->Next(); } } @@ -783,7 +764,7 @@ void StatusBar::Paint( const Rectangle& ) if ( mbFormat ) ImplFormat(); - sal_uInt16 nItemCount = (sal_uInt16)mpItemList->Count(); + sal_uInt16 nItemCount = sal_uInt16( mpItemList->size() ); if ( mbProgressMode ) ImplDrawProgress( sal_True, 0, mnPercent ); @@ -962,22 +943,23 @@ void StatusBar::DataChanged( const DataChangedEvent& rDCEvt ) { Window::DataChanged( rDCEvt ); - if ( (rDCEvt.GetType() == DATACHANGED_DISPLAY) || - (rDCEvt.GetType() == DATACHANGED_FONTS) || - (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) || - ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) + if ( (rDCEvt.GetType() == DATACHANGED_DISPLAY ) + || (rDCEvt.GetType() == DATACHANGED_FONTS ) + || (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) + || ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) + && (rDCEvt.GetFlags() & SETTINGS_STYLE ) + ) + ) { mbFormat = sal_True; ImplInitSettings( sal_True, sal_True, sal_True ); - ImplStatusItem* pItem = mpItemList->First(); long nFudge = GetTextHeight() / 4; - while ( pItem ) + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + ImplStatusItem* pItem = (*mpItemList)[ i ]; long nWidth = GetTextWidth( pItem->maText ) + nFudge; if( nWidth > pItem->mnWidth + STATUSBAR_OFFSET ) pItem->mnWidth = nWidth + STATUSBAR_OFFSET; - pItem = mpItemList->Next(); } Size aSize = GetSizePixel(); // do not disturb current width, since @@ -1037,7 +1019,11 @@ void StatusBar::InsertItem( sal_uInt16 nItemId, sal_uLong nWidth, pItem->mbVisible = sal_True; // Item in die Liste einfuegen - mpItemList->Insert( pItem, nPos ); + if ( nPos < mpItemList->size() ) { + mpItemList->insert( mpItemList->begin() + nPos, pItem ); + } else { + mpItemList->push_back( pItem ); + } mbFormat = sal_True; if ( ImplIsItemUpdate() ) @@ -1053,8 +1039,8 @@ void StatusBar::RemoveItem( sal_uInt16 nItemId ) sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { - ImplStatusItem* pItem = mpItemList->Remove( nPos ); - delete pItem; + delete (*mpItemList)[ nPos ]; + mpItemList->erase( mpItemList->begin() + nPos ); mbFormat = sal_True; if ( ImplIsItemUpdate() ) @@ -1072,7 +1058,7 @@ void StatusBar::ShowItem( sal_uInt16 nItemId ) if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; if ( !pItem->mbVisible ) { pItem->mbVisible = sal_True; @@ -1094,7 +1080,7 @@ void StatusBar::HideItem( sal_uInt16 nItemId ) if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->mbVisible ) { pItem->mbVisible = sal_False; @@ -1115,7 +1101,7 @@ sal_Bool StatusBar::IsItemVisible( sal_uInt16 nItemId ) const sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->mbVisible; + return (*mpItemList)[ nPos ]->mbVisible; else return sal_False; } @@ -1153,24 +1139,14 @@ void StatusBar::HideItems() void StatusBar::CopyItems( const StatusBar& rStatusBar ) { // Alle Items entfernen - ImplStatusItem* pItem = mpItemList->First(); - while ( pItem ) - { - delete pItem; - pItem = mpItemList->Next(); + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + delete (*mpItemList)[ i ]; } - - // Items aus der Liste loeschen - mpItemList->Clear(); + mpItemList->clear(); // Items kopieren - sal_uLong i = 0; - pItem = rStatusBar.mpItemList->GetObject( i ); - while ( pItem ) - { - mpItemList->Insert( new ImplStatusItem( *pItem ), LIST_APPEND ); - i++; - pItem = rStatusBar.mpItemList->GetObject( i ); + for ( size_t i = 0, n = rStatusBar.mpItemList->size(); i < n; ++i ) { + mpItemList->push_back( new ImplStatusItem( *(*rStatusBar.mpItemList)[ i ] ) ); } mbFormat = sal_True; @@ -1183,15 +1159,10 @@ void StatusBar::CopyItems( const StatusBar& rStatusBar ) void StatusBar::Clear() { // Alle Item loeschen - ImplStatusItem* pItem = mpItemList->First(); - while ( pItem ) - { - delete pItem; - pItem = mpItemList->Next(); + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + delete (*mpItemList)[ i ]; } - - // Items aus der Liste loeschen - mpItemList->Clear(); + mpItemList->clear(); mbFormat = sal_True; if ( ImplIsItemUpdate() ) @@ -1204,31 +1175,26 @@ void StatusBar::Clear() sal_uInt16 StatusBar::GetItemCount() const { - return (sal_uInt16)mpItemList->Count(); + return (sal_uInt16)mpItemList->size(); } // ----------------------------------------------------------------------- sal_uInt16 StatusBar::GetItemId( sal_uInt16 nPos ) const { - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); - if ( pItem ) - return pItem->mnId; - else - return 0; + if ( nPos < mpItemList->size() ) + return (*mpItemList)[ nPos ]->mnId; + return 0; } // ----------------------------------------------------------------------- sal_uInt16 StatusBar::GetItemPos( sal_uInt16 nItemId ) const { - ImplStatusItem* pItem = mpItemList->First(); - while ( pItem ) - { - if ( pItem->mnId == nItemId ) - return (sal_uInt16)mpItemList->GetCurPos(); - - pItem = mpItemList->Next(); + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + if ( (*mpItemList)[ i ]->mnId == nItemId ) { + return sal_uInt16( i ); + } } return STATUSBAR_ITEM_NOTFOUND; @@ -1247,7 +1213,7 @@ sal_uInt16 StatusBar::GetItemId( const Point& rPos ) const // Rechteck holen Rectangle aRect = ImplGetItemRectPos( nPos ); if ( aRect.IsInside( rPos ) ) - return mpItemList->GetObject( nPos )->mnId; + return (*mpItemList)[ nPos ]->mnId; } } @@ -1289,7 +1255,7 @@ Point StatusBar::GetItemTextPos( sal_uInt16 nItemId ) const if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { // Rechteck holen - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; Rectangle aRect = ImplGetItemRectPos( nPos ); long nW = mpImplData->mnItemBorderWidth + 1; Rectangle aTextRect( aRect.Left()+nW, aRect.Top()+nW, @@ -1316,9 +1282,9 @@ sal_uLong StatusBar::GetItemWidth( sal_uInt16 nItemId ) const sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->mnWidth; - else - return 0; + return (*mpItemList)[ nPos ]->mnWidth; + + return 0; } // ----------------------------------------------------------------------- @@ -1328,9 +1294,9 @@ StatusBarItemBits StatusBar::GetItemBits( sal_uInt16 nItemId ) const sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->mnBits; - else - return 0; + return (*mpItemList)[ nPos ]->mnBits; + + return 0; } // ----------------------------------------------------------------------- @@ -1340,9 +1306,9 @@ long StatusBar::GetItemOffset( sal_uInt16 nItemId ) const sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->mnOffset; - else - return 0; + return (*mpItemList)[ nPos ]->mnOffset; + + return 0; } // ----------------------------------------------------------------------- @@ -1353,7 +1319,7 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const XubString& rText ) if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->maText != rText ) { @@ -1389,9 +1355,9 @@ const XubString& StatusBar::GetItemText( sal_uInt16 nItemId ) const sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->maText; - else - return ImplGetSVEmptyStr(); + return (*mpItemList)[ nPos ]->maText; + + return ImplGetSVEmptyStr(); } // ----------------------------------------------------------------------- @@ -1402,7 +1368,7 @@ void StatusBar::SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand ) if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->maCommand != rCommand ) pItem->maCommand = rCommand; @@ -1416,9 +1382,9 @@ const XubString& StatusBar::GetItemCommand( sal_uInt16 nItemId ) sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->maCommand; - else - return ImplGetSVEmptyStr(); + return (*mpItemList)[ nPos ]->maCommand; + + return ImplGetSVEmptyStr(); } // ----------------------------------------------------------------------- @@ -1429,7 +1395,7 @@ void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData ) if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; pItem->mpUserData = pNewData; // Wenn es ein User-Item ist, DrawItem-Aufrufen @@ -1450,9 +1416,9 @@ void* StatusBar::GetItemData( sal_uInt16 nItemId ) const sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->mpUserData; - else - return NULL; + return (*mpItemList)[ nPos ]->mpUserData; + + return NULL; } // ----------------------------------------------------------------------- @@ -1462,7 +1428,7 @@ void StatusBar::SetHelpText( sal_uInt16 nItemId, const XubString& rText ) sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - mpItemList->GetObject( nPos )->maHelpText = rText; + (*mpItemList)[ nPos ]->maHelpText = rText; } // ----------------------------------------------------------------------- @@ -1473,7 +1439,7 @@ const XubString& StatusBar::GetHelpText( sal_uInt16 nItemId ) const if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; if ( !pItem->maHelpText.Len() && ( pItem->maHelpId.getLength() || pItem->maCommand.Len() )) { Help* pHelp = Application::GetHelp(); @@ -1499,7 +1465,7 @@ void StatusBar::SetQuickHelpText( sal_uInt16 nItemId, const XubString& rText ) sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - mpItemList->GetObject( nPos )->maQuickHelpText = rText; + (*mpItemList)[ nPos ]->maQuickHelpText = rText; } // ----------------------------------------------------------------------- @@ -1510,11 +1476,11 @@ const XubString& StatusBar::GetQuickHelpText( sal_uInt16 nItemId ) const if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; return pItem->maQuickHelpText; } - else - return ImplGetSVEmptyStr(); + + return ImplGetSVEmptyStr(); } // ----------------------------------------------------------------------- @@ -1524,7 +1490,7 @@ void StatusBar::SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId ) sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - mpItemList->GetObject( nPos )->maHelpId = rHelpId; + (*mpItemList)[ nPos ]->maHelpId = rHelpId; } // ----------------------------------------------------------------------- @@ -1536,7 +1502,7 @@ rtl::OString StatusBar::GetHelpId( sal_uInt16 nItemId ) const rtl::OString aRet; if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->maHelpId.getLength() ) aRet = pItem->maHelpId; else @@ -1709,15 +1675,15 @@ void StatusBar::SetText( const XubString& rText ) Size StatusBar::CalcWindowSizePixel() const { - sal_uLong i = 0; - sal_uLong nCount = mpItemList->Count(); + size_t i = 0; + size_t nCount = mpItemList->size(); long nOffset = 0; long nCalcWidth = (STATUSBAR_OFFSET_X*2); long nCalcHeight; while ( i < nCount ) { - ImplStatusItem* pItem = mpItemList->GetObject( i ); + ImplStatusItem* pItem = (*mpItemList)[ i ]; nCalcWidth += pItem->mnWidth + nOffset; nOffset = pItem->mnOffset; i++; @@ -1777,7 +1743,7 @@ void StatusBar::SetAccessibleName( sal_uInt16 nItemId, const XubString& rName ) if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { - ImplStatusItem* pItem = mpItemList->GetObject( nPos ); + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->maAccessibleName != rName ) { @@ -1794,9 +1760,11 @@ const XubString& StatusBar::GetAccessibleName( sal_uInt16 nItemId ) const sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->maAccessibleName; - else - return ImplGetSVEmptyStr(); + return (*mpItemList)[ nPos ]->maAccessibleName; + + return ImplGetSVEmptyStr(); } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index 25e693ae72a2..341d7f3bfff8 100755 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -234,9 +235,17 @@ void SystemChildWindow::ImplTestJavaException( void* pEnv ) throw uno::RuntimeException(ouMessage, uno::Reference<uno::XInterface>()); } +#else + (void)pEnv; #endif // SOLAR_JAVA } +void SystemChildWindow::SetForwardKey( sal_Bool bEnable ) +{ + if ( mpWindowImpl->mpSysObj ) + mpWindowImpl->mpSysObj->SetForwardKey( bEnable ); +} + // ----------------------------------------------------------------------- sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava ) @@ -246,9 +255,11 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava ) (void)bUseJava; #if defined WNT nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->hWnd ); + (void)bUseJava; #elif defined QUARTZ // FIXME: this is wrong nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView ); + (void)bUseJava; #elif defined UNX if( !bUseJava ) { @@ -340,3 +351,5 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava ) return nRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index 3313402dfef6..f6c7e422cc3b 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1076,7 +1077,14 @@ unsigned int SystemWindow::GetScreenNumber() const // ----------------------------------------------------------------------- -void SystemWindow::SetScreenNumber( unsigned int nScreen) +void SystemWindow::SetScreenNumber(unsigned int nScreen) { mpWindowImpl->mpFrame->SetScreenNumber( nScreen ); } + +void SystemWindow::SetApplicationID(const rtl::OUString &rApplicationID) +{ + mpWindowImpl->mpFrame->SetApplicationID(rApplicationID); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx index 92c013218286..32e8a0dcec92 100644 --- a/vcl/source/window/tabdlg.cxx +++ b/vcl/source/window/tabdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <vcl/fixed.hxx> #include <vcl/tabctrl.hxx> #include <vcl/tabdlg.hxx> -#ifndef _SV_RC_H #include <tools/rc.h> -#endif @@ -274,3 +273,4 @@ void TabDialog::AdjustLayout() ImplPosControls(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx index 459e07f97042..a834af10d37d 100644 --- a/vcl/source/window/tabpage.cxx +++ b/vcl/source/window/tabpage.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -203,11 +204,4 @@ void TabPage::DeactivatePage() { } -// ----------------------------------------------------------------------- - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > TabPage::CreateAccessible() -{ - // TODO: remove this method (incompatible) - - return Window::CreateAccessible(); -} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx index f4f40f6722bf..24c8ded6e4b4 100644 --- a/vcl/source/window/taskpanelist.cxx +++ b/vcl/source/window/taskpanelist.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -110,26 +111,8 @@ TaskPaneList::~TaskPaneList() void TaskPaneList::AddWindow( Window *pWindow ) { -#if OSL_DEBUG_LEVEL > 0 - bool bDockingWindow=false; - bool bToolbox=false; - bool bDialog=false; - bool bUnknown=false; -#endif - if( pWindow ) { -#if OSL_DEBUG_LEVEL > 0 - if( pWindow->GetType() == RSC_DOCKINGWINDOW ) - bDockingWindow = true; - else if( pWindow->GetType() == RSC_TOOLBOX ) - bToolbox = true; - else if( pWindow->IsDialog() ) - bDialog = true; - else - bUnknown = true; -#endif - ::std::vector< Window* >::iterator insertionPos = mTaskPanes.end(); for ( ::std::vector< Window* >::iterator p = mTaskPanes.begin(); p != mTaskPanes.end(); @@ -147,8 +130,6 @@ void TaskPaneList::AddWindow( Window *pWindow ) // beginning, until the first window is found which has the ChildPathFocus. Now // if this would be the ancestor window of another pane window, this would fudge // the result - // 2004-09-27 - fs@openoffice.org, while fixing #i33573#, which included replacing - // the original fix for #98916# with this one here. if ( pWindow->IsWindowOrChild( *p ) ) { insertionPos = p + 1; @@ -257,7 +238,7 @@ sal_Bool TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent ) return sal_True; } else - p++; + ++p; } // the focus is not in the list: activate first float if F6 was pressed @@ -399,3 +380,4 @@ Window* TaskPaneList::FindNextFloat( Window *pWindow, sal_Bool bForward ) // -------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 682c65e47a6f..8ffe04c4208a 100755 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #include <rtl/logfile.hxx> -#include <tools/list.hxx> #include <tools/debug.hxx> #include <tools/rc.h> #include <tools/poly.hxx> @@ -144,7 +144,7 @@ struct ImplToolSizeArray // ----------------------------------------------------------------------- -DECLARE_LIST( ImplTBList, ToolBox* ) +typedef ::std::vector< ToolBox* > ImplTBList; class ImplTBDragMgr { @@ -168,12 +168,19 @@ public: ImplTBDragMgr(); ~ImplTBDragMgr(); - void Insert( ToolBox* pBox ) - { mpBoxList->Insert( pBox ); } - void Remove( ToolBox* pBox ) - { mpBoxList->Remove( pBox ); } - sal_uLong Count() const - { return mpBoxList->Count(); } + void push_back( ToolBox* pBox ) + { mpBoxList->push_back( pBox ); } + void erase( ToolBox* pBox ) + { + for ( ImplTBList::iterator it = mpBoxList->begin(); it < mpBoxList->end(); ++it ) { + if ( *it == pBox ) { + mpBoxList->erase( it ); + break; + } + } + } + size_t size() const + { return mpBoxList->size(); } ToolBox* FindToolBox( const Rectangle& rRect ); @@ -566,7 +573,7 @@ void ToolBox::ImplDrawTransparentBackground( ToolBox* pThis, const Region &rRegi { // just invalidate to trigger paint of the parent - const bool bOldPaintLock = pThis->mpData->mbIsPaintLocked; + const bool bOldPaintLock = pThis->mpData->mbIsPaintLocked; pThis->mpData->mbIsPaintLocked = true; // send an invalidate to the first opaque parent and invalidate the whole hierarchy from there (noclipchildren) @@ -1122,7 +1129,7 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec mbHorz = sal_True; } else { - DBG_ERROR( "ImplLineSizing: Trailing else" ); + OSL_FAIL( "ImplLineSizing: Trailing else" ); nCurSize = 0; mbHorz = sal_False; } @@ -1253,7 +1260,7 @@ sal_uInt16 ToolBox::ImplFindItemPos( ToolBox* pBox, const Point& rPos ) ImplTBDragMgr::ImplTBDragMgr() { - mpBoxList = new ImplTBList( 4, 4 ); + mpBoxList = new ImplTBList(); mnLineMode = 0; mnStartLines = 0; mbCustomizeMode = sal_False; @@ -1277,9 +1284,9 @@ ImplTBDragMgr::~ImplTBDragMgr() ToolBox* ImplTBDragMgr::FindToolBox( const Rectangle& rRect ) { - ToolBox* pBox = mpBoxList->First(); - while ( pBox ) + for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i ) { + ToolBox* pBox = (*mpBoxList)[ i ]; /* * FIXME: since we can have multiple frames now we cannot * find the drag target by its position alone. @@ -1287,8 +1294,9 @@ ToolBox* ImplTBDragMgr::FindToolBox( const Rectangle& rRect ) * this works in one frame only anyway. If the dialogue * changes to a system window, we need a new implementation here */ - if ( pBox->IsReallyVisible() && pBox->ImplGetWindowImpl()->mpFrame == mpDragBox->ImplGetWindowImpl()->mpFrame ) - { + if ( pBox->IsReallyVisible() + && pBox->ImplGetWindowImpl()->mpFrame == mpDragBox->ImplGetWindowImpl()->mpFrame + ) { if ( !pBox->ImplIsFloatingMode() ) { Point aPos = pBox->GetPosPixel(); @@ -1298,11 +1306,9 @@ ToolBox* ImplTBDragMgr::FindToolBox( const Rectangle& rRect ) return pBox; } } - - pBox = mpBoxList->Next(); } - return pBox; + return NULL; } // ----------------------------------------------------------------------- @@ -1501,11 +1507,8 @@ void ImplTBDragMgr::StartCustomizeMode() { mbCustomizeMode = sal_True; - ToolBox* pBox = mpBoxList->First(); - while ( pBox ) - { - pBox->ImplStartCustomizeMode(); - pBox = mpBoxList->Next(); + for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i ) { + (*mpBoxList)[ i ]->ImplStartCustomizeMode(); } } @@ -1515,11 +1518,8 @@ void ImplTBDragMgr::EndCustomizeMode() { mbCustomizeMode = sal_False; - ToolBox* pBox = mpBoxList->First(); - while ( pBox ) - { - pBox->ImplEndCustomizeMode(); - pBox = mpBoxList->Next(); + for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i ) { + (*mpBoxList)[ i ]->ImplEndCustomizeMode(); } } @@ -1578,7 +1578,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle ) ImplGetWindowImpl()->mbToolBox = sal_True; mpBtnDev = NULL; mpFloatSizeAry = NULL; - mpData = new ImplToolBoxPrivateData; + mpData = new ImplToolBoxPrivateData; mpFloatWin = NULL; mnDX = 0; mnDY = 0; @@ -1597,7 +1597,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle ) mnCurItemId = 0; mnDownItemId = 0; mnCurPos = TOOLBOX_ITEM_NOTFOUND; - mnFocusPos = TOOLBOX_ITEM_NOTFOUND; // current position during keyboard access + mnFocusPos = TOOLBOX_ITEM_NOTFOUND; // current position during keyboard access mnLines = 1; mnCurLine = 1; mnCurLines = 1; @@ -1621,9 +1621,8 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle ) mbCustomize = sal_False; mbCustomizeMode = sal_False; mbDragging = sal_False; - mbHideStatusText = sal_False; mbMenuStrings = sal_False; - mbIsShift = sal_False; + mbIsShift = sal_False; mbIsKeyEvent = sal_False; mbChangingHighlight = sal_False; meButtonType = BUTTON_SYMBOL; @@ -1631,7 +1630,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle ) meLastStyle = POINTER_ARROW; mnWinStyle = nStyle; mnLastFocusItemId = 0; - mnKeyModifier = 0; + mnKeyModifier = 0; mnActivateCount = 0; maTimer.SetTimeout( 50 ); @@ -1840,9 +1839,9 @@ ToolBox::~ToolBox() { // Wenn im TBDrag-Manager, dann wieder rausnehmen if ( mbCustomize ) - pSVData->maCtrlData.mpTBDragMgr->Remove( this ); + pSVData->maCtrlData.mpTBDragMgr->erase( this ); - if ( !pSVData->maCtrlData.mpTBDragMgr->Count() ) + if ( !pSVData->maCtrlData.mpTBDragMgr->size() ) { delete pSVData->maCtrlData.mpTBDragMgr; pSVData->maCtrlData.mpTBDragMgr = NULL; @@ -2167,13 +2166,22 @@ sal_uInt16 ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, sal_Bool b sal_Bool bWindow; sal_Bool bBreak = sal_False; long nWidthTotal = nWidth; + long nMenuWidth = 0; // when docked the menubutton will be in the first line - // ->initialize first linewidth with button if( IsMenuEnabled() && !ImplIsFloatingMode() ) - nLineWidth = mpData->maMenubuttonItem.maItemSize.Width(); + nMenuWidth = mpData->maMenubuttonItem.maItemSize.Width(); - std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); + // we need to know which item is the last visible one to be able to add + // the menu width in case we are unable to show all the items + std::vector< ImplToolItem >::iterator it, lastVisible; + for ( it = mpData->m_aItems.begin(); it != mpData->m_aItems.end(); ++it ) + { + if ( it->mbVisible ) + lastVisible = it; + } + + it = mpData->m_aItems.begin(); while ( it != mpData->m_aItems.end() ) { it->mbBreak = bBreak; @@ -2209,12 +2217,18 @@ sal_uInt16 ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, sal_Bool b } } - // check for line break - if ( (nLineWidth+nCurWidth > nWidthTotal) && mbScroll ) + // in case we are able to show all the items, we do not want + // to show the toolbar's menu; otherwise yes + if ( ( ( it == lastVisible ) && (nLineWidth+nCurWidth > nWidthTotal) && mbScroll ) || + ( ( it != lastVisible ) && (nLineWidth+nCurWidth+nMenuWidth > nWidthTotal) && mbScroll ) ) bBreak = sal_True; } else if ( it->meType == TOOLBOXITEM_SEPARATOR ) + { nCurWidth = it->mnSepSize; + if ( ( it != lastVisible ) && (nLineWidth+nCurWidth+nMenuWidth > nWidthTotal) ) + bBreak = sal_True; + } // treat breaks as separators, except when using old style toolbars (ie. no menu button) else if ( (it->meType == TOOLBOXITEM_BREAK) && !IsMenuEnabled() ) bBreak = sal_True; @@ -2933,7 +2947,7 @@ IMPL_LINK( ToolBox, ImplDropdownLongClickHdl, ToolBox*, EMPTYARG ) { // no floater was opened Deactivate(); - ImplDrawItem( mnCurPos, sal_False ); + ImplDrawItem( mnCurPos, 0 ); mnCurPos = TOOLBOX_ITEM_NOTFOUND; mnCurItemId = 0; @@ -3225,7 +3239,7 @@ void ToolBox::ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight ) if( !pThis->mpData->maMenubuttonItem.maRect.IsEmpty() ) { // #i53937# paint menu button only if necessary - if( !(pThis->GetMenuType() & TOOLBOX_MENUTYPE_CUSTOMIZE) && !pThis->ImplHasClippedItems() ) + if( !pThis->ImplHasClippedItems() ) return; // execute pending paint requests @@ -3279,7 +3293,7 @@ void ToolBox::ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight ) else pThis->DrawSelectionBackground( aInnerRect, 2, sal_False, sal_False, sal_False ); } - else + else if( !bNativeButtons ) { // improve visibility by using a dark gradient Gradient g; @@ -3298,19 +3312,8 @@ void ToolBox::ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight ) else aRect.Left() = aRect.Right() - aRect.getWidth()/3; - if( pThis->mpData->maMenuType & TOOLBOX_MENUTYPE_CUSTOMIZE ) - ImplDrawDropdownArrow( pThis, aRect, sal_True, !pThis->mbHorz ); - if( pThis->ImplHasClippedItems() ) - { - aRect = aInnerRect; - if( pThis->mbHorz ) - aRect.Bottom() = aRect.Top() + aRect.getHeight()/3; - else - aRect.Right() = aRect.Left() + aRect.getWidth()/3; - - ImplDrawMoreIndicator( pThis, aRect, sal_True, !pThis->mbHorz ); - } + ImplDrawMoreIndicator( pThis, aInnerRect, sal_True, !pThis->mbHorz ); // store highlight state pThis->mpData->mbMenubuttonSelected = bHighlight; @@ -3407,6 +3410,54 @@ void ToolBox::ImplDrawNext( sal_Bool bIn ) // ----------------------------------------------------------------------- +void ToolBox::ImplDrawSeparator( sal_uInt16 nPos, Rectangle rRect ) +{ + bool bNativeOk = false; + ImplToolItem* pItem = &mpData->m_aItems[nPos]; + + if( IsNativeControlSupported( CTRL_TOOLBAR, PART_SEPARATOR ) ) + { + ImplControlValue aControlValue; + ControlState nState = 0; + bNativeOk = DrawNativeControl( CTRL_TOOLBAR, PART_SEPARATOR, + rRect, nState, aControlValue, rtl::OUString() ); + } + + /* Draw the widget only if it can't be drawn natively. */ + if( !bNativeOk ) + { + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + ImplToolItem* pTempItem = &mpData->m_aItems[nPos-1]; + + // no separator before or after windows or at breaks + if ( pTempItem && !pTempItem->mbShowWindow && nPos < mpData->m_aItems.size()-1 ) + { + pTempItem = &mpData->m_aItems[nPos+1]; + if ( !pTempItem->mbShowWindow && !pTempItem->mbBreak ) + { + long nCenterPos, nSlim; + SetLineColor( rStyleSettings.GetSeparatorColor() ); + if ( IsHorizontal() ) + { + nSlim = (pItem->maRect.Bottom() - pItem->maRect.Top ()) / 4; + nCenterPos = pItem->maRect.Center().X(); + DrawLine( Point( nCenterPos, pItem->maRect.Top() + nSlim ), + Point( nCenterPos, pItem->maRect.Bottom() - nSlim ) ); + } + else + { + nSlim = (pItem->maRect.Right() - pItem->maRect.Left ()) / 4; + nCenterPos = pItem->maRect.Center().Y(); + DrawLine( Point( pItem->maRect.Left() + nSlim, nCenterPos ), + Point( pItem->maRect.Right() - nSlim, nCenterPos ) ); + } + } + } + } +} + +// ----------------------------------------------------------------------- + static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bEnabled, sal_Bool bIsWindow ) { // draws toolbar button background either native or using a coloured selection @@ -3419,7 +3470,7 @@ static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, sal_uInt16 h ControlState nState = 0; if ( highlight == 1 ) nState |= CTRL_STATE_PRESSED; - if ( highlight == 2 ) nState |= CTRL_STATE_ROLLOVER; + if ( highlight == 2 ) nState |= CTRL_STATE_ROLLOVER; if ( bEnabled ) nState |= CTRL_STATE_ENABLED; aControlValue.setTristateVal( bChecked ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); @@ -3433,7 +3484,7 @@ static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, sal_uInt16 h pThis->DrawSelectionBackground( rRect, bIsWindow ? 3 : highlight, bChecked, sal_True, bIsWindow, 2, NULL, NULL ); } -void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPaint, sal_Bool bLayout ) +void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, sal_Bool bPaint, sal_Bool bLayout ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -3451,7 +3502,8 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain MetricVector* pVector = bLayout ? &mpData->m_pLayoutData->m_aUnicodeBoundRects : NULL; String* pDisplayText = bLayout ? &mpData->m_pLayoutData->m_aDisplayText : NULL; - bHighlight = bHighlight && pItem->mbEnabled; + if(!pItem->mbEnabled) + nHighlight = 0; // Falls Rechteck ausserhalb des sichbaren Bereichs liegt if ( pItem->maRect.IsEmpty() ) @@ -3468,6 +3520,33 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain if( rStyleSettings.GetFaceColor() == Color( COL_WHITE ) ) bHighContrastWhite = sal_True; + // Compute buttons area. + Size aBtnSize = pItem->maRect.GetSize(); + if( ImplGetSVData()->maNWFData.mbToolboxDropDownSeparate ) + { + // separate button not for dropdown only where the whole button is painted + if ( pItem->mnBits & TIB_DROPDOWN && + ((pItem->mnBits & TIB_DROPDOWNONLY) != TIB_DROPDOWNONLY) ) + { + Rectangle aArrowRect = pItem->GetDropDownRect( mbHorz ); + if( aArrowRect.Top() == pItem->maRect.Top() ) // dropdown arrow on right side + aBtnSize.Width() -= aArrowRect.GetWidth(); + else // dropdown arrow on bottom side + aBtnSize.Height() -= aArrowRect.GetHeight(); + } + } + + /* Compute the button/separator rectangle here, we'll need it for + * both the buttons and the separators. */ + Rectangle aButtonRect( pItem->maRect.TopLeft(), aBtnSize ); + long nOffX = SMALLBUTTON_OFF_NORMAL_X; + long nOffY = SMALLBUTTON_OFF_NORMAL_Y; + long nImageOffX = 0; + long nImageOffY = 0; + long nTextOffX = 0; + long nTextOffY = 0; + sal_uInt16 nStyle = 0; + // draw separators in flat style only if ( !bLayout && (mnOutStyle & TOOLBOX_STYLE_FLAT) && @@ -3475,31 +3554,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain nPos > 0 ) { - // no separator before or after windows or at breaks - ImplToolItem* pTempItem = &mpData->m_aItems[nPos-1]; - if ( pTempItem && !pTempItem->mbShowWindow && nPos < mpData->m_aItems.size()-1 ) - { - pTempItem = &mpData->m_aItems[nPos+1]; - if ( !pTempItem->mbShowWindow && !pTempItem->mbBreak ) - { - long nCenterPos, nSlim; - SetLineColor( rStyleSettings.GetSeparatorColor() ); - if ( IsHorizontal() ) - { - nSlim = (pItem->maRect.Bottom() - pItem->maRect.Top ()) / 4; - nCenterPos = pItem->maRect.Center().X(); - DrawLine( Point( nCenterPos, pItem->maRect.Top() + nSlim ), - Point( nCenterPos, pItem->maRect.Bottom() - nSlim ) ); - } - else - { - nSlim = (pItem->maRect.Right() - pItem->maRect.Left ()) / 4; - nCenterPos = pItem->maRect.Center().Y(); - DrawLine( Point( pItem->maRect.Left() + nSlim, nCenterPos ), - Point( pItem->maRect.Right() - nSlim, nCenterPos ) ); - } - } - } + ImplDrawSeparator( nPos, aButtonRect ); } // do nothing if item is no button or will be displayed as window @@ -3563,30 +3618,6 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain return; } - // draw button - Size aBtnSize = pItem->maRect.GetSize(); - if( ImplGetSVData()->maNWFData.mbToolboxDropDownSeparate ) - { - // separate button not for dropdown only where the whole button is painted - if ( pItem->mnBits & TIB_DROPDOWN && - ((pItem->mnBits & TIB_DROPDOWNONLY) != TIB_DROPDOWNONLY) ) - { - Rectangle aArrowRect = pItem->GetDropDownRect( mbHorz ); - if( aArrowRect.Top() == pItem->maRect.Top() ) // dropdown arrow on right side - aBtnSize.Width() -= aArrowRect.GetWidth(); - else // dropdown arrow on bottom side - aBtnSize.Height() -= aArrowRect.GetHeight(); - } - } - Rectangle aButtonRect( pItem->maRect.TopLeft(), aBtnSize ); - long nOffX = SMALLBUTTON_OFF_NORMAL_X; - long nOffY = SMALLBUTTON_OFF_NORMAL_Y; - long nImageOffX=0; - long nImageOffY=0; - long nTextOffX=0; - long nTextOffY=0; - sal_uInt16 nStyle = 0; - if ( pItem->meState == STATE_CHECK ) { nStyle |= BUTTON_DRAW_CHECKED; @@ -3595,7 +3626,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain { nStyle |= BUTTON_DRAW_DONTKNOW; } - if ( bHighlight == 1 ) + if ( nHighlight == 1 ) { nStyle |= BUTTON_DRAW_PRESSED; } @@ -3604,7 +3635,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain { nOffX = OUTBUTTON_OFF_NORMAL_X; nOffY = OUTBUTTON_OFF_NORMAL_Y; - if ( bHighlight ) + if ( nHighlight != 0 ) { nOffX++; nOffY++; @@ -3617,7 +3648,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain { if ( (pItem->meState != STATE_NOCHECK) || !bPaint ) { - ImplErase( this, pItem->maRect, bHighlight, bHasOpenPopup ); + ImplErase( this, pItem->maRect, nHighlight != 0, bHasOpenPopup ); } } else @@ -3656,7 +3687,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain if ( bImage && ! bLayout ) { const Image* pImage; - if ( bHighlight && (!(pItem->maHighImage)) == sal_False ) + if ( (nHighlight != 0) && (!(pItem->maHighImage)) == sal_False ) pImage = &(pItem->maHighImage); else pImage = &(pItem->maImage); @@ -3690,14 +3721,14 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain nImageOffX += (nBtnWidth-aImageSize.Width())/2; nImageOffY += (nBtnHeight-aImageSize.Height())/2; } - if ( bHighlight || (pItem->meState == STATE_CHECK) ) + if ( nHighlight != 0 || (pItem->meState == STATE_CHECK) ) { if( bHasOpenPopup ) ImplDrawFloatwinBorder( pItem ); else - ImplDrawButton( this, aButtonRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? sal_True : sal_False ); + ImplDrawButton( this, aButtonRect, nHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? sal_True : sal_False ); - if( bHighlight ) + if( nHighlight != 0 ) { if( bHighContrastWhite ) nImageStyle |= IMAGE_DRAW_COLORTRANSFORM; @@ -3756,12 +3787,12 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain } // draw selection only if not already drawn during image output (see above) - if ( !bLayout && !bImage && (bHighlight || (pItem->meState == STATE_CHECK) ) ) + if ( !bLayout && !bImage && (nHighlight != 0 || (pItem->meState == STATE_CHECK) ) ) { if( bHasOpenPopup ) ImplDrawFloatwinBorder( pItem ); else - ImplDrawButton( this, pItem->maRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? sal_True : sal_False ); + ImplDrawButton( this, pItem->maRect, nHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? sal_True : sal_False ); } sal_uInt16 nTextStyle = 0; @@ -3796,14 +3827,14 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain // dropdown only will be painted without inner border if( (pItem->mnBits & TIB_DROPDOWNONLY) != TIB_DROPDOWNONLY ) { - ImplErase( this, aDropDownRect, bHighlight, bHasOpenPopup ); + ImplErase( this, aDropDownRect, nHighlight != 0, bHasOpenPopup ); - if( bHighlight || (pItem->meState == STATE_CHECK) ) + if( nHighlight != 0 || (pItem->meState == STATE_CHECK) ) { if( bHasOpenPopup ) ImplDrawFloatwinBorder( pItem ); else - ImplDrawButton( this, aDropDownRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), sal_False ); + ImplDrawButton( this, aDropDownRect, nHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), sal_False ); } } ImplDrawDropdownArrow( this, aDropDownRect, bSetColor, bRotate ); @@ -3914,7 +3945,7 @@ void ToolBox::ImplFloatControl( sal_Bool bStart, FloatingWindow* pFloatWindow ) mpFloatWin = pFloatWindow; // redraw item, to trigger drawing of a special border - ImplDrawItem( mnCurPos, sal_True ); + ImplDrawItem( mnCurPos, 1 ); mbDrag = sal_False; EndTracking(); @@ -3995,7 +4026,7 @@ sal_Bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, sal_Bool bRepeat { if ( !mnCurItemId ) { - ImplDrawItem( mnCurPos, sal_True ); + ImplDrawItem( mnCurPos, 1 ); mnCurItemId = pItem->mnId; Highlight(); } @@ -4134,17 +4165,17 @@ sal_Bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, sal_Bool bCa // Items nicht geloescht, im Select-Handler if ( mnCurItemId ) { - sal_Bool bHighlight; + sal_uInt16 nHighlight; if ( (mnCurItemId == mnHighItemId) && (mnOutStyle & TOOLBOX_STYLE_FLAT) ) - bHighlight = 2; + nHighlight = 2; else - bHighlight = sal_False; + nHighlight = 0; // Get current pos for the case that items are inserted/removed // in the toolBox mnCurPos = GetItemPos( mnCurItemId ); if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND ) { - ImplDrawItem( mnCurPos, bHighlight ); + ImplDrawItem( mnCurPos, nHighlight ); Flush(); } } @@ -4263,7 +4294,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND ) { mnCurItemId = mnHighItemId = it->mnId; - ImplDrawItem( mnCurPos, 2 /*sal_True*/ ); // always use shadow effect (2) + ImplDrawItem( mnCurPos, 2 ); // always use shadow effect (2) } else mnCurItemId = mnHighItemId = 0; @@ -4379,7 +4410,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) } // only clear highlight when focus is not in toolbar - sal_Bool bMenuButtonHit = mpData->maMenubuttonItem.maRect.IsInside( aMousePos ); + sal_Bool bMenuButtonHit = mpData->maMenubuttonItem.maRect.IsInside( aMousePos ) && ImplHasClippedItems(); if ( bClearHigh || bMenuButtonHit ) { if ( !bMenuButtonHit && mpData->mbMenubuttonSelected ) @@ -4393,7 +4424,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) sal_uInt16 nClearPos = GetItemPos( mnHighItemId ); if ( nClearPos != TOOLBOX_ITEM_NOTFOUND ) { - ImplDrawItem( nClearPos, (nClearPos == mnCurPos) ? sal_True : sal_False ); + ImplDrawItem( nClearPos, (nClearPos == mnCurPos) ? 1 : 0 ); if( nClearPos != mnCurPos ) ImplCallEventListeners( VCLEVENT_TOOLBOX_HIGHLIGHTOFF, reinterpret_cast< void* >( nClearPos ) ); } @@ -4505,7 +4536,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) if ( mbSelection ) { - ImplDrawItem( mnCurPos, sal_True ); + ImplDrawItem( mnCurPos, 1 ); Highlight(); } else @@ -4522,7 +4553,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) if ( mbDrag ) { - ImplDrawItem( mnCurPos, sal_True ); + ImplDrawItem( mnCurPos, 1 ); Highlight(); } @@ -4543,7 +4574,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) { // no floater was opened Deactivate(); - ImplDrawItem( mnCurPos, sal_False ); + ImplDrawItem( mnCurPos, 0 ); mnCurPos = TOOLBOX_ITEM_NOTFOUND; mnCurItemId = 0; @@ -4580,7 +4611,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) Deactivate(); // menu button hit ? - if( mpData->maMenubuttonItem.maRect.IsInside( aMousePos ) ) + if( mpData->maMenubuttonItem.maRect.IsInside( aMousePos ) && ImplHasClippedItems() ) { ExecuteCustomMenu(); return; @@ -4737,12 +4768,12 @@ void ToolBox::Paint( const Rectangle& rPaintRect ) // Nur malen, wenn Rechteck im PaintRectangle liegt if ( !pItem->maRect.IsEmpty() && rPaintRect.IsOver( pItem->maRect ) ) { - sal_Bool bHighlight = sal_False; + sal_uInt16 nHighlight = 0; if ( i == mnCurPos ) - bHighlight = 1; + nHighlight = 1; else if ( i == nHighPos ) - bHighlight = 2; - ImplDrawItem( i, bHighlight ); + nHighlight = 2; + ImplDrawItem( i, nHighlight ); } } ImplShowFocus(); @@ -5398,8 +5429,8 @@ sal_uInt16 ToolBox::ImplCountLineBreaks( const ToolBox *pThis ) while ( it != ((ToolBox*)pThis)->mpData->m_aItems.end() ) { if( it->meType == TOOLBOXITEM_BREAK ) - nLines++; - it++; + ++nLines; + ++it; } return nLines; } @@ -5410,7 +5441,7 @@ Size ToolBox::CalcPopupWindowSizePixel() const sal_uInt16 nLines = ImplCountLineBreaks( this ); if( nLines ) - nLines++; // add the first line + ++nLines; // add the first line else { // no breaks found: use quadratic layout @@ -5430,7 +5461,7 @@ Size ToolBox::CalcPopupWindowSizePixel() const Size ToolBox::CalcFloatingWindowSizePixel() const { sal_uInt16 nLines = ImplCountLineBreaks( this ); - nLines++; // add the first line + ++nLines; // add the first line return CalcFloatingWindowSizePixel( nLines ); } @@ -5471,7 +5502,7 @@ Size ToolBox::CalcMinimumWindowSizePixel() const pToolBox->CopyItem( *this, it->mnId ); if( (it->meType != TOOLBOXITEM_BUTTON) || !it->mbVisible || ImplIsFixedControl( &(*it) ) ) - it++; + ++it; else break; } @@ -5506,9 +5537,9 @@ void ToolBox::EnableCustomize( sal_Bool bEnable ) ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); if ( bEnable ) - pMgr->Insert( this ); + pMgr->push_back( this ); else - pMgr->Remove( this ); + pMgr->erase( this ); } } @@ -5687,7 +5718,7 @@ sal_Bool ToolBox::ImplOpenItem( KeyCode aKeyCode ) if( ImplCloseLastPopup( GetParent() ) ) return bRet; - ImplUpdateCustomMenu(); + UpdateCustomMenu(); Application::PostUserEvent( mpData->mnEventId, LINK( this, ToolBox, ImplCallExecuteCustomMenu ) ); } else if( mnHighItemId && ImplGetItem( mnHighItemId ) && @@ -5914,7 +5945,7 @@ sal_uInt16 ToolBox::ImplGetItemLine( ImplToolItem* pCurrentItem ) while( it != mpData->m_aItems.end() ) { if ( it->mbBreak ) - nLine++; + ++nLine; if( &(*it) == pCurrentItem) break; ++it; @@ -5994,7 +6025,7 @@ sal_uInt16 ToolBox::ImplFindItemPos( const ImplToolItem* pItem, const std::vecto if( pItem ) { sal_uInt16 nPos; - for( nPos = 0; nPos < rList.size(); nPos++ ) + for( nPos = 0; nPos < rList.size(); ++nPos ) if( &rList[ nPos ] == pItem ) return nPos; } @@ -6028,7 +6059,7 @@ void ToolBox::ImplChangeHighlight( ImplToolItem* pItem, sal_Bool bNoGrabFocus ) // which will in turn ImplShowFocus again // set mnHighItemId to 0 already to prevent this hen/egg problem mnHighItemId = 0; - ImplDrawItem( nPos, sal_False ); + ImplDrawItem( nPos, 0 ); ImplCallEventListeners( VCLEVENT_TOOLBOX_HIGHLIGHTOFF, reinterpret_cast< void* >( nPos ) ); } @@ -6333,3 +6364,5 @@ void ToolBox::ImplDisableFlatButtons() mnOutStyle &= ~TOOLBOX_STYLE_FLAT; #endif } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index fd6fb5dffb6b..348ecec00104 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <tools/list.hxx> #include <tools/debug.hxx> #include <tools/rc.h> @@ -50,7 +50,8 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> using namespace vcl; -using namespace rtl; + +using ::rtl::OUString; // ======================================================================= @@ -504,12 +505,6 @@ void ToolBox::Deactivate() mnActivateCount--; ImplCallEventListeners( VCLEVENT_TOOLBOX_DEACTIVATE ); maDeactivateHdl.Call( this ); - - if ( mbHideStatusText ) - { - GetpApp()->HideHelpStatusText(); - mbHideStatusText = sal_False; - } } // ----------------------------------------------------------------------- @@ -518,13 +513,6 @@ void ToolBox::Highlight() { ImplCallEventListeners( VCLEVENT_TOOLBOX_HIGHLIGHT ); maHighlightHdl.Call( this ); - - XubString aStr = GetHelpText( mnCurItemId ); - if ( aStr.Len() || mbHideStatusText ) - { - GetpApp()->ShowHelpStatusText( aStr ); - mbHideStatusText = sal_True; - } } // ----------------------------------------------------------------------- @@ -2182,12 +2170,12 @@ sal_Bool ToolBox::ImplHasClippedItems() { if( it->IsClipped() ) return sal_True; - it++; + ++it; } return sal_False; } -void ToolBox::ImplUpdateCustomMenu() +void ToolBox::UpdateCustomMenu() { // fill clipped items into menu if( !IsMenuEnabled() ) @@ -2308,7 +2296,7 @@ void ToolBox::ExecuteCustomMenu() { // handle custom menu asynchronously // to avoid problems if the toolbox is closed during menu execute - ImplUpdateCustomMenu(); + UpdateCustomMenu(); Application::PostUserEvent( mpData->mnEventId, LINK( this, ToolBox, ImplCallExecuteCustomMenu ) ); } } @@ -2375,12 +2363,12 @@ sal_Bool ToolBox::AlwaysLocked() utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( vcl::unohelper::GetMultiServiceFactory(), - OUString::createFromAscii( "/org.openoffice.Office.UI.GlobalSettings/Toolbars" ) ); // note: case sensisitive ! + OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.UI.GlobalSettings/Toolbars")) ); // note: case sensisitive ! if ( aNode.isValid() ) { // feature enabled ? sal_Bool bStatesEnabled = sal_Bool(); - ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString::createFromAscii( "StatesEnabled" ) ); + ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("StatesEnabled")) ); if( aValue >>= bStatesEnabled ) { if( bStatesEnabled == sal_True ) @@ -2388,10 +2376,10 @@ sal_Bool ToolBox::AlwaysLocked() // now read the locking state utl::OConfigurationNode aNode2 = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( vcl::unohelper::GetMultiServiceFactory(), - OUString::createFromAscii( "/org.openoffice.Office.UI.GlobalSettings/Toolbars/States" ) ); // note: case sensisitive ! + OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.UI.GlobalSettings/Toolbars/States")) ); // note: case sensisitive ! sal_Bool bLocked = sal_Bool(); - ::com::sun::star::uno::Any aValue2 = aNode2.getNodeValue( OUString::createFromAscii( "Locked" ) ); + ::com::sun::star::uno::Any aValue2 = aNode2.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Locked")) ); if( aValue2 >>= bLocked ) nAlwaysLocked = (bLocked == sal_True) ? 1 : 0; } @@ -2416,11 +2404,9 @@ void ToolBox::ImplUpdateImageList() { if (mpData->mpImageListProvider != NULL) { - sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); try { - ImageListType eType = bHC ? vcl::HIGHCONTRAST_YES : vcl::HIGHCONTRAST_NO; - + ImageListType eType = vcl::HIGHCONTRAST_NO; if (eType != mpData->meImageListType) { vcl::IImageListProvider* pImageListProvider = mpData->mpImageListProvider; @@ -2438,3 +2424,5 @@ void ToolBox::SetImageListProvider(vcl::IImageListProvider* _pProvider) ImplUpdateImageList(); } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index ac7101f079c0..b8457d1267a5 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -95,10 +96,11 @@ #include "com/sun/star/accessibility/XAccessible.hpp" #include "com/sun/star/accessibility/AccessibleRole.hpp" +#include <sal/macros.h> + #include <set> #include <typeinfo> -using namespace rtl; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::datatransfer::clipboard; @@ -106,6 +108,8 @@ using namespace ::com::sun::star::datatransfer::dnd; using namespace ::com::sun::star; using namespace com::sun; +using ::rtl::OUString; + using ::com::sun::star::awt::XTopWindow; // ======================================================================= @@ -305,8 +309,6 @@ bool Window::ImplCheckUIFont( const Font& rFont ) void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl ) { - // reset high contrast to false, so the system can either update it - // or AutoDetectSystemHC can kick in (see below) StyleSettings aTmpSt( rSettings.GetStyleSettings() ); aTmpSt.SetHighContrastMode( sal_False ); rSettings.SetStyleSettings( aTmpSt ); @@ -325,7 +327,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl if ( !bUseSystemFont ) { ImplInitFontList(); - String aConfigFont = utl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() ); + String aConfigFont = utl::DefaultFontConfiguration::get().getUserInterfaceFont( rSettings.GetUILocale() ); xub_StrLen nIndex = 0; while( nIndex != STRING_NOTFOUND ) { @@ -414,8 +416,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl }; static std::set< LanguageType > aBrokenSystemFontSizeLanguagesSet( eBrokenSystemFontSizeLanguages, - eBrokenSystemFontSizeLanguages + - (sizeof(eBrokenSystemFontSizeLanguages)/sizeof(eBrokenSystemFontSizeLanguages[0])) + eBrokenSystemFontSizeLanguages + SAL_N_ELEMENTS(eBrokenSystemFontSizeLanguages) ); LanguageType aLang = Application::GetSettings().GetUILanguage(); if( aBrokenSystemFontSizeLanguagesSet.find( aLang ) != aBrokenSystemFontSizeLanguagesSet.end() ) @@ -493,7 +494,6 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl rSettings.SetStyleSettings( aStyleSettings ); - // auto detect HC mode; if the system already set it to "yes" // (see above) then accept that if( !rSettings.GetStyleSettings().GetHighContrastMode() ) @@ -501,10 +501,10 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl sal_Bool bTmp = sal_False, bAutoHCMode = sal_True; utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( vcl::unohelper::GetMultiServiceFactory(), - OUString::createFromAscii( "org.openoffice.Office.Common/Accessibility" ) ); // note: case sensisitive ! + OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/Accessibility")) ); // note: case sensisitive ! if ( aNode.isValid() ) { - ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString::createFromAscii( "AutoDetectSystemHC" ) ); + ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("AutoDetectSystemHC")) ); if( aValue >>= bTmp ) bAutoHCMode = bTmp; } @@ -515,6 +515,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl { aStyleSettings = rSettings.GetStyleSettings(); aStyleSettings.SetHighContrastMode( sal_True ); + aStyleSettings.SetSymbolsStyle( STYLE_SYMBOLS_HICONTRAST ); rSettings.SetStyleSettings( aStyleSettings ); } } @@ -524,10 +525,11 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl if( pEnvHC && *pEnvHC ) { aStyleSettings.SetHighContrastMode( sal_True ); + aStyleSettings.SetSymbolsStyle( STYLE_SYMBOLS_HICONTRAST ); rSettings.SetStyleSettings( aStyleSettings ); } -#ifdef DBG_UTIL +#if defined(DBG_UTIL) // Evt. AppFont auf Fett schalten, damit man feststellen kann, // ob fuer die Texte auf anderen Systemen genuegend Platz // vorhanden ist @@ -654,10 +656,10 @@ void Window::ImplInitWindowData( WindowType nType ) mpWindowImpl->mbDockWin = sal_False; // sal_True: DockingWindow is the base class mpWindowImpl->mbFloatWin = sal_False; // sal_True: FloatingWindow is the base class mpWindowImpl->mbPushButton = sal_False; // sal_True: PushButton is the base class - mpWindowImpl->mbToolBox = sal_False; // sal_True: ToolBox is the base class + mpWindowImpl->mbToolBox = sal_False; // sal_True: ToolBox is the base class mpWindowImpl->mbMenuFloatingWindow= sal_False; // sal_True: MenuFloatingWindow is the base class mpWindowImpl->mbToolbarFloatingWindow= sal_False; // sal_True: ImplPopupFloatWin is the base class, used for subtoolbars - mpWindowImpl->mbSplitter = sal_False; // sal_True: Splitter is the base class + mpWindowImpl->mbSplitter = sal_False; // sal_True: Splitter is the base class mpWindowImpl->mbVisible = sal_False; // sal_True: Show( sal_True ) called mpWindowImpl->mbOverlapVisible = sal_False; // sal_True: Hide called for visible window from ImplHideAllOverlapWindow() mpWindowImpl->mbDisabled = sal_False; // sal_True: Enable( sal_False ) called @@ -1306,7 +1308,10 @@ void Window::ImplLoadRes( const ResId& rResId ) if ( nObjMask & WINDOW_QUICKTEXT ) SetQuickHelpText( ReadStringRes() ); if ( nObjMask & WINDOW_EXTRALONG ) - SetData( (void*)ReadLongRes() ); + { + sal_uIntPtr nRes = ReadLongRes(); + SetData( (void*)nRes ); + } if ( nObjMask & WINDOW_UNIQUEID ) SetUniqueId( ReadByteStringRes() ); @@ -1563,7 +1568,6 @@ void Window::ImplResetReallyVisible() // the SHOW/HIDE events serve as indicators to send child creation/destroy events to the access bridge. // For this, the data member of the event must not be NULL. // Previously, we did this in Window::Show, but there some events got lost in certain situations. - // #104887# - 2004-08-10 - fs@openoffice.org if( bBecameReallyInvisible && ImplIsAccessibleCandidate() ) ImplCallEventListeners( VCLEVENT_WINDOW_HIDE, this ); // TODO. It's kind of a hack that we're re-using the VCLEVENT_WINDOW_HIDE. Normally, we should @@ -1606,7 +1610,6 @@ void Window::ImplSetReallyVisible() // For this, the data member of the event must not be NULL. // Previously, we did this in Window::Show, but there some events got lost in certain situations. Now // we're doing it when the visibility really changes - // #104887# - 2004-08-10 - fs@openoffice.org if( bBecameReallyVisible && ImplIsAccessibleCandidate() ) ImplCallEventListeners( VCLEVENT_WINDOW_SHOW, this ); // TODO. It's kind of a hack that we're re-using the VCLEVENT_WINDOW_SHOW. Normally, we should @@ -1775,7 +1778,7 @@ sal_Bool Window::ImplSysObjClip( const Region* pOldRegion ) if ( mpWindowImpl->mpSysObj ) { - sal_Bool bVisibleState = mpWindowImpl->mbReallyVisible; + bool bVisibleState = mpWindowImpl->mbReallyVisible; if ( bVisibleState ) { @@ -2407,7 +2410,7 @@ void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags ) { bool bRestoreCursor = false; if ( mpWindowImpl->mpCursor ) - bRestoreCursor = mpWindowImpl->mpCursor->ImplHide( false ); + bRestoreCursor = mpWindowImpl->mpCursor->ImplSuspend(); mbInitClipRegion = sal_True; mpWindowImpl->mbInPaint = sal_True; @@ -2454,7 +2457,7 @@ void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags ) mbInitClipRegion = sal_True; mpWindowImpl->mpPaintRegion = NULL; if ( mpWindowImpl->mpCursor ) - mpWindowImpl->mpCursor->ImplShow( false, bRestoreCursor ); + mpWindowImpl->mpCursor->ImplResume( bRestoreCursor ); } } else @@ -2896,7 +2899,7 @@ void Window::ImplScroll( const Rectangle& rRect, ImplInvalidateAllOverlapBackgrounds(); if ( mpWindowImpl->mpCursor ) - mpWindowImpl->mpCursor->ImplHide( false ); + mpWindowImpl->mpCursor->ImplSuspend(); sal_uInt16 nOrgFlags = nFlags; if ( !(nFlags & (SCROLL_CHILDREN | SCROLL_NOCHILDREN)) ) @@ -3043,7 +3046,7 @@ void Window::ImplScroll( const Rectangle& rRect, Update(); if ( mpWindowImpl->mpCursor ) - mpWindowImpl->mpCursor->ImplShow( false ); + mpWindowImpl->mpCursor->ImplResume(); } // ----------------------------------------------------------------------- @@ -3122,7 +3125,7 @@ void Window::ImplUpdateWindowPtr() void Window::ImplUpdateOverlapWindowPtr( sal_Bool bNewFrame ) { sal_Bool bVisible = IsVisible(); - Show( sal_False ); + Show( false ); ImplRemoveWindow( bNewFrame ); Window* pRealParent = mpWindowImpl->mpRealParent; ImplInsertWindow( ImplGetParent() ); @@ -3143,7 +3146,7 @@ void Window::ImplUpdateOverlapWindowPtr( sal_Bool bNewFrame ) } if ( bVisible ) - Show( sal_True ); + Show( true ); } // ----------------------------------------------------------------------- @@ -3200,7 +3203,6 @@ void Window::ImplPosSizeWindow( long nX, long nY, { sal_Bool bNewPos = sal_False; sal_Bool bNewSize = sal_False; - sal_Bool bNewWidth = sal_False; sal_Bool bCopyBits = sal_False; long nOldOutOffX = mnOutOffX; long nOldOutOffY = mnOutOffY; @@ -3243,7 +3245,6 @@ void Window::ImplPosSizeWindow( long nX, long nY, mnOutWidth = nWidth; bNewSize = sal_True; bCopyBits = sal_False; - bNewWidth = sal_True; } } if ( nFlags & WINDOW_POSSIZE_HEIGHT ) @@ -3770,7 +3771,7 @@ void Window::ImplShowAllOverlaps() { if ( pOverlapWindow->mpWindowImpl->mbOverlapVisible ) { - pOverlapWindow->Show( sal_True, SHOW_NOACTIVATE ); + pOverlapWindow->Show( true, SHOW_NOACTIVATE ); pOverlapWindow->mpWindowImpl->mbOverlapVisible = sal_False; } @@ -3788,7 +3789,7 @@ void Window::ImplHideAllOverlaps() if ( pOverlapWindow->IsVisible() ) { pOverlapWindow->mpWindowImpl->mbOverlapVisible = sal_True; - pOverlapWindow->Show( sal_False ); + pOverlapWindow->Show( false ); } pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext; @@ -4073,7 +4074,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags ) { // Cursor hiden if ( pOldFocusWindow->mpWindowImpl->mpCursor ) - pOldFocusWindow->mpWindowImpl->mpCursor->ImplHide( true ); + pOldFocusWindow->mpWindowImpl->mpCursor->ImplHide(); } // !!!!! Wegen altem SV-Office Activate/Deavtivate Handling @@ -4098,110 +4099,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags ) pNewRealWindow->Activate(); } } -/* - // call Deactivate and Activate - Window* pDeactivateParent; - Window* pActivateParent; - Window* pParent; - Window* pLastParent; - pDeactivateParent = pOldFocusWindow; - while ( pDeactivateParent ) - { - pParent = pDeactivateParent; - if ( pParent->ImplIsChild( this ) ) - break; - - if ( pDeactivateParent->ImplIsOverlapWindow() ) - { - if ( !pDeactivateParent->mpWindowImpl->mbParentActive ) - break; - } - - pDeactivateParent = pDeactivateParent->ImplGetParent(); - } - if ( pOldFocusWindow ) - { - pActivateParent = this; - while ( pActivateParent ) - { - pParent = pActivateParent; - if ( pParent->ImplIsChild( pOldFocusWindow ) ) - break; - - if ( pActivateParent->ImplIsOverlapWindow() ) - { - if ( !pActivateParent->mpWindowImpl->mbParentActive ) - break; - } - - pActivateParent = pActivateParent->ImplGetParent(); - } - } - else - { - if ( ImplIsOverlapWindow() ) - pActivateParent = this; - else - pActivateParent = mpWindowImpl->mpOverlapWindow; - while ( pActivateParent ) - { - if ( pActivateParent->ImplIsOverlapWindow() ) - { - if ( !pActivateParent->mpWindowImpl->mbParentActive ) - break; - } - - pActivateParent = pActivateParent->ImplGetParent(); - } - } - if ( pDeactivateParent ) - { - do - { - pLastParent = pOldFocusWindow; - if ( pLastParent != pDeactivateParent ) - { - pParent = pLastParent->ImplGetParent(); - while ( pParent ) - { - if ( pParent == pDeactivateParent ) - break; - pLastParent = pParent; - pParent = pParent->ImplGetParent(); - } - } - else - pParent = pLastParent; - - pParent->mpWindowImpl->mbActive = sal_False; - pParent->Deactivate(); - pDeactivateParent = pLastParent; - } - while ( pDeactivateParent != pOldFocusWindow ); - } - do - { - pLastParent = this; - if ( pLastParent != pActivateParent ) - { - pParent = pLastParent->ImplGetParent(); - while ( pParent ) - { - if ( pParent == pActivateParent ) - break; - pLastParent = pParent; - pParent = pParent->ImplGetParent(); - } - } - else - pParent = pLastParent; - pParent->mpWindowImpl->mbActive = sal_True; - pParent->Activate(); - pActivateParent = pLastParent; - } - while ( pActivateParent != this ); -*/ // call Get- and LoseFocus if ( pOldFocusWindow && ! aOldFocusDel.IsDelete() ) { @@ -4443,7 +4341,7 @@ Window::~Window() xComponent->dispose(); } - catch ( Exception exc ) + catch ( Exception ) { // can be safely ignored here. } @@ -4484,7 +4382,7 @@ Window::~Window() if ( pSVData->maWinData.mpDefDialogParent == this ) pSVData->maWinData.mpDefDialogParent = NULL; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 0 if ( sal_True ) // always perform these tests in non-pro versions { ByteString aErrorStr; @@ -4505,7 +4403,7 @@ Window::~Window() aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); aTempStr += ") with living SystemWindow(s) destroyed: "; aTempStr += aErrorStr; - DBG_ERROR( aTempStr.GetBuffer() ); + OSL_FAIL( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! } @@ -4526,7 +4424,7 @@ Window::~Window() aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); aTempStr += ") with living SystemWindow(s) destroyed: "; aTempStr += aErrorStr; - DBG_ERROR( aTempStr.GetBuffer() ); + OSL_FAIL( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! } @@ -4541,7 +4439,7 @@ Window::~Window() lcl_appendWindowInfo( aTempStr, *pTempWin ); pTempWin = pTempWin->mpWindowImpl->mpNext; } - DBG_ERROR( aTempStr.GetBuffer() ); + OSL_FAIL( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! } @@ -4556,7 +4454,7 @@ Window::~Window() lcl_appendWindowInfo( aTempStr, *pTempWin ); pTempWin = pTempWin->mpWindowImpl->mpNext; } - DBG_ERROR( aTempStr.GetBuffer() ); + OSL_FAIL( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! } @@ -4574,7 +4472,7 @@ Window::~Window() ByteString aTempStr( "Window (" ); aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); aTempStr += ") still in TaskPanelList!"; - DBG_ERROR( aTempStr.GetBuffer() ); + OSL_FAIL( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! } } @@ -4600,7 +4498,7 @@ Window::~Window() ByteString aTempStr( "Window (" ); aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); aTempStr += ") not found in TaskPanelList!"; - DBG_ERROR( aTempStr.GetBuffer() ); + OSL_FAIL( aTempStr.GetBuffer() ); } } @@ -4627,11 +4525,11 @@ Window::~Window() { // #122232#, this must not happen and is an application bug ! but we try some cleanup to hopefully avoid crashes, see below bHasFocussedChild = sal_True; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 0 ByteString aTempStr( "Window (" ); aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); aTempStr += ") with focussed child window destroyed ! THIS WILL LEAD TO CRASHES AND MUST BE FIXED !"; - DBG_ERROR( aTempStr.GetBuffer() ); + OSL_FAIL( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! #endif } @@ -4796,12 +4694,22 @@ void Window::doLazyDelete() DockingWindow* pDockWin = dynamic_cast<DockingWindow*>(this); if( pSysWin || ( pDockWin && pDockWin->IsFloatingMode() ) ) { - Show( sal_False ); + Show( false ); SetParent( ImplGetDefaultWindow() ); } vcl::LazyDeletor<Window>::Delete( this ); } +sal_uInt16 Window::GetIndicatorState() const +{ + return mpWindowImpl->mpFrame->GetIndicatorState().mnState; +} + +void Window::SimulateKeyPress( sal_uInt16 nKeyCode ) const +{ + mpWindowImpl->mpFrame->SimulateKeyPress(nKeyCode); +} + // ----------------------------------------------------------------------- void Window::InterceptChildWindowKeyDown( sal_Bool bIntercept ) { @@ -5210,48 +5118,6 @@ long Window::PreNotify( NotifyEvent& rNEvt ) // #82968# mouse and key events will be notified after processing ( in ImplNotifyKeyMouseCommandEventListeners() )! // see also ImplHandleMouseEvent(), ImplHandleKey() - /* - else if( rNEvt.GetType() == EVENT_MOUSEMOVE ) - { - if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) - { - if ( rNEvt.GetWindow() == this ) - ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, (void*)rNEvt.GetMouseEvent() ); - else - ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, &ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) ); - } - } - else if( rNEvt.GetType() == EVENT_MOUSEBUTTONUP ) - { - if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) - { - if ( rNEvt.GetWindow() == this ) - ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, (void*)rNEvt.GetMouseEvent() ); - else - ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, &ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) ); - } - } - else if( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) - { - if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) - { - if ( rNEvt.GetWindow() == this ) - ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, (void*)rNEvt.GetMouseEvent() ); - else - ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, &ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) ); - } - } - else if( rNEvt.GetType() == EVENT_KEYINPUT ) - { - if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) - ImplCallEventListeners( VCLEVENT_WINDOW_KEYINPUT, (void*)rNEvt.GetKeyEvent() ); - } - else if( rNEvt.GetType() == EVENT_KEYUP ) - { - if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) - ImplCallEventListeners( VCLEVENT_WINDOW_KEYUP, (void*)rNEvt.GetKeyEvent() ); - } - */ } return bDone; @@ -5397,8 +5263,7 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData ) if ( aDelData.IsDelete() ) return; - if ( !mpWindowImpl->maEventListeners.empty() ) - mpWindowImpl->maEventListeners.Call( &aEvent ); + mpWindowImpl->maEventListeners.Call( &aEvent ); if ( aDelData.IsDelete() ) return; @@ -5410,8 +5275,7 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData ) { pWindow->ImplAddDel( &aDelData ); - if ( !pWindow->mpWindowImpl->maChildEventListeners.empty() ) - pWindow->mpWindowImpl->maChildEventListeners.Call( &aEvent ); + pWindow->mpWindowImpl->maChildEventListeners.Call( &aEvent ); if ( aDelData.IsDelete() ) return; @@ -5431,28 +5295,28 @@ void Window::FireVclEvent( VclSimpleEvent* pEvent ) void Window::AddEventListener( const Link& rEventListener ) { - mpWindowImpl->maEventListeners.push_back( rEventListener ); + mpWindowImpl->maEventListeners.addListener( rEventListener ); } // ----------------------------------------------------------------------- void Window::RemoveEventListener( const Link& rEventListener ) { - mpWindowImpl->maEventListeners.remove( rEventListener ); + mpWindowImpl->maEventListeners.removeListener( rEventListener ); } // ----------------------------------------------------------------------- void Window::AddChildEventListener( const Link& rEventListener ) { - mpWindowImpl->maChildEventListeners.push_back( rEventListener ); + mpWindowImpl->maChildEventListeners.addListener( rEventListener ); } // ----------------------------------------------------------------------- void Window::RemoveChildEventListener( const Link& rEventListener ) { - mpWindowImpl->maChildEventListeners.remove( rEventListener ); + mpWindowImpl->maChildEventListeners.removeListener( rEventListener ); } // ----------------------------------------------------------------------- @@ -5985,17 +5849,6 @@ Font Window::GetPointFont() const // ----------------------------------------------------------------------- -// TODO: remove in next incompatible build -void Window::GetFontResolution( sal_Int32& nDPIX, sal_Int32& nDPIY ) const -{ - DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - - nDPIX = mpWindowImpl->mpFrameData->mnDPIX; - nDPIY = mpWindowImpl->mpFrameData->mnDPIY; -} - -// ----------------------------------------------------------------------- - void Window::SetParentClipMode( sal_uInt16 nMode ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -6105,8 +5958,6 @@ void Window::SetWindowRegionPixel( const Region& rRegion ) } else { - sal_Bool bInvalidate = sal_False; - if ( rRegion.GetType() == REGION_NULL ) { if ( mpWindowImpl->mbWinRegion ) @@ -6114,7 +5965,6 @@ void Window::SetWindowRegionPixel( const Region& rRegion ) mpWindowImpl->maWinRegion = Region( REGION_NULL ); mpWindowImpl->mbWinRegion = sal_False; ImplSetClipFlag(); - bInvalidate = sal_True; } } else @@ -6122,7 +5972,6 @@ void Window::SetWindowRegionPixel( const Region& rRegion ) mpWindowImpl->maWinRegion = rRegion; mpWindowImpl->mbWinRegion = sal_True; ImplSetClipFlag(); - bInvalidate = sal_True; } if ( IsReallyVisible() ) @@ -6307,7 +6156,7 @@ void Window::SetParent( Window* pNewParent ) mpWindowImpl->mpFrame->SetParent( pNewParent->mpWindowImpl->mpFrame ); sal_Bool bVisible = IsVisible(); - Show( sal_False, SHOW_NOFOCUSCHANGE ); + Show( false, SHOW_NOFOCUSCHANGE ); // Testen, ob sich das Overlap-Window aendert Window* pOldOverlapWindow; @@ -6423,7 +6272,7 @@ void Window::SetParent( Window* pNewParent ) ImplGetOwnerDrawList().push_back( this ); if ( bVisible ) - Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + Show( true, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); } // ----------------------------------------------------------------------- @@ -6448,10 +6297,10 @@ void Window::Show( sal_Bool bVisible, sal_uInt16 nFlags ) if ( mpWindowImpl->mpBorderWindow ) { - sal_Bool bOldUpdate = mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate; + bool bOldUpdate = mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate; if ( mpWindowImpl->mbNoParentUpdate ) mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = sal_True; - mpWindowImpl->mpBorderWindow->Show( sal_False, nFlags ); + mpWindowImpl->mpBorderWindow->Show( false, nFlags ); mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = bOldUpdate; } else if ( mpWindowImpl->mbFrame ) @@ -6589,13 +6438,22 @@ void Window::Show( sal_Bool bVisible, sal_uInt16 nFlags ) } if ( mpWindowImpl->mpBorderWindow ) - mpWindowImpl->mpBorderWindow->Show( sal_True, nFlags ); + mpWindowImpl->mpBorderWindow->Show( true, nFlags ); else if ( mpWindowImpl->mbFrame ) { - ImplSVData* pSVData = ImplGetSVData(); // #106431#, hide SplashScreen - if( pSVData->mpIntroWindow && !ImplIsWindowOrChild( pSVData->mpIntroWindow ) ) + ImplSVData* pSVData = ImplGetSVData(); + if ( !pSVData->mpIntroWindow ) + { + // The right way would be just to call this (not even in the 'if') + GetpApp()->InitFinished(); + } + else if ( !ImplIsWindowOrChild( pSVData->mpIntroWindow ) ) + { + // ... but the VCL splash is broken, and it needs this + // (for ./soffice slot:5500) pSVData->mpIntroWindow->Hide(); + } //DBG_ASSERT( !mpWindowImpl->mbSuppressAccessibilityEvents, "Window::Show() - Frame reactivated"); mpWindowImpl->mbSuppressAccessibilityEvents = sal_False; @@ -6620,7 +6478,7 @@ void Window::Show( sal_Bool bVisible, sal_uInt16 nFlags ) if( aDogTag.IsDelete() ) return; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 0 if ( IsDialog() || (GetType() == WINDOW_TABPAGE) || (GetType() == WINDOW_DOCKINGWINDOW) ) { DBG_DIALOGTEST( this ); @@ -6914,7 +6772,7 @@ void Window::EnableInput( sal_Bool bEnable, sal_Bool bChild, sal_Bool bSysWin, if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( (*p), sal_True ) ) (*p)->EnableInput( bEnable, bChild ); } - p++; + ++p; } } } @@ -8054,7 +7912,7 @@ void Window::SetCursor( Cursor* pCursor ) if ( mpWindowImpl->mpCursor != pCursor ) { if ( mpWindowImpl->mpCursor ) - mpWindowImpl->mpCursor->ImplHide( true ); + mpWindowImpl->mpCursor->ImplHide(); mpWindowImpl->mpCursor = pCursor; if ( pCursor ) pCursor->ImplShow(); @@ -8521,7 +8379,7 @@ uno::Reference< XDropTarget > Window::GetDropTarget() } - catch( RuntimeException exc ) + catch( RuntimeException ) { // release all instances mpWindowImpl->mpFrameData->mxDropTarget.clear(); @@ -8561,22 +8419,22 @@ uno::Reference< XDragSource > Window::GetDragSource() Sequence< Any > aDragSourceAL( 2 ), aDropTargetAL( 2 ); OUString aDragSourceSN, aDropTargetSN; #if defined WNT - aDragSourceSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDragSource" ); - aDropTargetSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDropTarget" ); + aDragSourceSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDragSource")); + aDropTargetSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDropTarget")); aDragSourceAL[ 1 ] = makeAny( (sal_uInt32) pEnvData->hWnd ); aDropTargetAL[ 0 ] = makeAny( (sal_uInt32) pEnvData->hWnd ); #elif defined QUARTZ /* FIXME: Mac OS X specific dnd interface does not exist! * * Using Windows based dnd as a temporary solution */ - aDragSourceSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDragSource" ); - aDropTargetSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDropTarget" ); + aDragSourceSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDragSource")); + aDropTargetSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDropTarget")); aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); #elif defined UNX aDropTargetAL.realloc( 3 ); aDragSourceAL.realloc( 3 ); - aDragSourceSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.X11DragSource" ); - aDropTargetSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.X11DropTarget" ); + aDragSourceSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.X11DragSource")); + aDropTargetSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.X11DropTarget")); aDragSourceAL[ 0 ] = makeAny( Application::GetDisplayConnection() ); aDragSourceAL[ 2 ] = makeAny( vcl::createBmpConverter() ); @@ -8594,7 +8452,7 @@ uno::Reference< XDragSource > Window::GetDragSource() } // createInstance can throw any exception - catch( Exception exc ) + catch( Exception ) { // release all instances mpWindowImpl->mpFrameData->mxDropTarget.clear(); @@ -8649,10 +8507,10 @@ uno::Reference< XClipboard > Window::GetClipboard() if( xFactory.is() ) { - mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboardExt" ) ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboardExt")) ), UNO_QUERY ); if( !mpWindowImpl->mpFrameData->mxClipboard.is() ) - mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard")) ), UNO_QUERY ); #if defined(UNX) && !defined(QUARTZ) // unix clipboard needs to be initialized if( mpWindowImpl->mpFrameData->mxClipboard.is() ) @@ -8663,7 +8521,7 @@ uno::Reference< XClipboard > Window::GetClipboard() { Sequence< Any > aArgumentList( 3 ); aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() ); - aArgumentList[ 1 ] = makeAny( OUString::createFromAscii( "CLIPBOARD" ) ); + aArgumentList[ 1 ] = makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ); aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() ); xInit->initialize( aArgumentList ); @@ -8674,7 +8532,7 @@ uno::Reference< XClipboard > Window::GetClipboard() } // createInstance can throw any exception - catch( Exception exc ) + catch( Exception ) { // release all instances mpWindowImpl->mpFrameData->mxClipboard.clear(); @@ -8706,27 +8564,27 @@ uno::Reference< XClipboard > Window::GetPrimarySelection() #if defined(UNX) && !defined(QUARTZ) Sequence< Any > aArgumentList( 3 ); aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() ); - aArgumentList[ 1 ] = makeAny( OUString::createFromAscii( "PRIMARY" ) ); + aArgumentList[ 1 ] = makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("PRIMARY")) ); aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() ); mpWindowImpl->mpFrameData->mxSelection = uno::Reference< XClipboard >( xFactory->createInstanceWithArguments( - OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ), aArgumentList ), UNO_QUERY ); -# else + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard")), aArgumentList ), UNO_QUERY ); +# else static uno::Reference< XClipboard > s_xSelection; if ( !s_xSelection.is() ) - s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboardExt" ) ), UNO_QUERY ); + s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.GenericClipboardExt")) ), UNO_QUERY ); if ( !s_xSelection.is() ) - s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboard" ) ), UNO_QUERY ); + s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.GenericClipboard")) ), UNO_QUERY ); mpWindowImpl->mpFrameData->mxSelection = s_xSelection; -# endif +# endif } } // createInstance can throw any exception - catch( Exception exc ) + catch( Exception ) { // release all instances mpWindowImpl->mpFrameData->mxSelection.clear(); @@ -9960,9 +9818,6 @@ void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& / DBG_ASSERT( ! pDev->ImplHasMirroredGraphics(), "PaintToDevice to mirroring graphics" ); DBG_ASSERT( ! pDev->IsRTLEnabled(), "PaintToDevice to mirroring device" ); - - Point aPos = pDev->LogicToPixel( rPos ); - Window* pRealParent = NULL; if( ! mpWindowImpl->mbVisible ) { @@ -10000,3 +9855,4 @@ Selection Window::GetSurroundingTextSelection() const return Selection( 0, 0 ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 2513170a4d25..bf81d2665f48 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,6 @@ #include "precompiled_vcl.hxx" #include <limits.h> - #include <tools/debug.hxx> #include <tools/poly.hxx> @@ -342,14 +342,6 @@ Bitmap Window::SnapShot( sal_Bool bBorder ) const // ----------------------------------------------------------------------- -Bitmap Window::SnapShot() const -{ - // Should be merged in the next top level build !!! - return SnapShot( sal_True ); -} - -// ----------------------------------------------------------------------- - void Window::ShowFocus( const Rectangle& rRect ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -1306,110 +1298,6 @@ void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX, } } -// support for docking -// this is currently handled in ImplDockingWindowWrapper -/* -void Window::ImplSetFloatingMode( sal_Bool bFloatMode ) -{ - // if the window is docked, put it into a flaoting window - // if it is floating put it back in the old frame - - ImplDockingWindowWrapper *pWrapper = pDockingMgr->GetDockingWindowWrapper( this ); - if( !pDockingData ) - return; - - if ( pWrapper->IsFloatingMode() != bFloatMode ) - { - if ( pWrapper->PrepareToggleFloatingMode() ) - { - sal_Bool bVisible = IsVisible(); - - if ( bFloatMode ) - { - Show( sal_False, SHOW_NOFOCUSCHANGE ); - - pWrapper->maDockPos = GetPosPixel(); - - Window* pRealParent = mpWindowImpl->mpRealParent; - pWrapper->mpOldBorderWin = mpWindowImpl->mpBorderWindow; - - ImplDockFloatWin* pWin = - new ImplDockFloatWin2( - mpWindowImpl->mpParent, - mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ? mnFloatBits | WB_SYSTEMWINDOW : mnFloatBits, - pWrapper ); - pWrapper->mpFloatWin = pWin; - mpWindowImpl->mpBorderWindow = NULL; - mpWindowImpl->mnLeftBorder = 0; - mpWindowImpl->mnTopBorder = 0; - mpWindowImpl->mnRightBorder = 0; - mpWindowImpl->mnBottomBorder = 0; - // Falls Parent zerstoert wird, muessen wir auch vom - // BorderWindow den Parent umsetzen - if ( pWrapper->mpOldBorderWin ) - pWrapper->mpOldBorderWin->SetParent( pWin ); - SetParent( pWin ); - pWin->SetPosPixel( Point() ); - mpWindowImpl->mpBorderWindow = pWin; - pWin->mpWindowImpl->mpClientWindow = this; - mpWindowImpl->mpRealParent = pRealParent; - pWin->SetText( GetText() ); - pWin->SetOutputSizePixel( GetSizePixel() ); - pWin->SetPosPixel( pWrapper->maFloatPos ); - // DockingDaten ans FloatingWindow weiterreichen - pWin->ShowTitleButton( TITLE_BUTTON_DOCKING, pWrapper->mbDockBtn ); - pWin->ShowTitleButton( TITLE_BUTTON_HIDE, pWrapper->mbHideBtn ); - pWin->SetPin( pWrapper->mbPined ); - if ( pWrapper->mbRollUp ) - pWin->RollUp(); - else - pWin->RollDown(); - pWin->SetRollUpOutputSizePixel( pWrapper->maRollUpOutSize ); - pWin->SetMinOutputSizePixel( pWrapper->maMinOutSize ); - - pWrapper->ToggleFloatingMode(); - - if ( bVisible ) - Show(); - } - else - { - Show( sal_False, SHOW_NOFOCUSCHANGE ); - - // FloatingDaten wird im FloatingWindow speichern - pWrapper->maFloatPos = mpFloatWin->GetPosPixel(); - pWrapper->mbDockBtn = mpFloatWin->IsTitleButtonVisible( TITLE_BUTTON_DOCKING ); - pWrapper->mbHideBtn = mpFloatWin->IsTitleButtonVisible( TITLE_BUTTON_HIDE ); - pWrapper->mbPined = mpFloatWin->IsPined(); - pWrapper->mbRollUp = mpFloatWin->IsRollUp(); - pWrapper->maRollUpOutSize = mpFloatWin->GetRollUpOutputSizePixel(); - pWrapper->maMinOutSize = mpFloatWin->GetMinOutputSizePixel(); - - Window* pRealParent = mpWindowImpl->mpRealParent; - mpWindowImpl->mpBorderWindow = NULL; - if ( pWrapper->mpOldBorderWin ) - { - SetParent( pWrapper->mpOldBorderWin ); - ((ImplBorderWindow*)pWrapper->mpOldBorderWin)->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); - pWrapper->mpOldBorderWin->Resize(); - } - mpWindowImpl->mpBorderWindow = pWrapper->mpOldBorderWin; - SetParent( pRealParent ); - mpWindowImpl->mpRealParent = pRealParent; - delete static_cast<ImplDockFloatWin*>(mpFloatWin); - pWrapper->mpFloatWin = NULL; - SetPosPixel( maDockPos ); - - pWrapper->ToggleFloatingMode(); - - if ( bVisible ) - Show(); - } - } - } -} -*/ - DockingManager* Window::GetDockingManager() { return ImplGetDockingManager(); @@ -1976,3 +1864,4 @@ void Window::SetOutputSizePixel( const Size& rNewSize ) rNewSize.Height()+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ) ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index 65019ba2a4af..f35e85e89464 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,3 +81,5 @@ void Window::ImplAdjustNWFSizes() break; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 6522856bb05d..2e52891d18fc 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1796,7 +1797,7 @@ IMPL_LINK( Window, ImplAsyncFocusHdl, void*, EMPTYARG ) pSVData->maWinData.mpFocusWin = NULL; if ( pFocusWin->ImplGetWindowImpl()->mpCursor ) - pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide( true ); + pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide(); // Deaktivate rufen Window* pOldFocusWindow = pFocusWin; @@ -1903,7 +1904,7 @@ static void ImplHandleLoseFocus( Window* pWindow ) Window* pFocusWin = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin; if ( pFocusWin && pFocusWin->ImplGetWindowImpl()->mpCursor ) - pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide( true ); + pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide(); if( bCallDirect ) pWindow->ImplAsyncFocusHdl( NULL ); } @@ -2611,10 +2612,12 @@ long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/, break; #ifdef DBG_UTIL default: - DBG_ERROR1( "ImplWindowFrameProc(): unknown event (%lu)", (sal_uLong)nEvent ); + OSL_TRACE( "ImplWindowFrameProc(): unknown event (%lu)", (sal_uLong)nEvent ); break; #endif } return nRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 0e667de73067..24ca3c9120d5 100755 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,6 +37,8 @@ // declare system types in sysdata.hxx #include <svsys.h> #include <vcl/sysdata.hxx> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/rendering/XCanvas.hpp> #include <svdata.hxx> #include <salframe.hxx> @@ -190,6 +193,18 @@ void WorkWindow::ShowFullScreenMode( sal_Bool bFullScreenMode, sal_Int32 nDispla mbFullScreenMode = bFullScreenMode != 0; if ( !mbSysChild ) { + // Dispose of the canvas implementation, which might rely on + // screen-specific system data. + com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas ); + if( xCanvas.is() ) + { + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > + xCanvasComponent( xCanvas, + com::sun::star::uno::UNO_QUERY ); + if( xCanvasComponent.is() ) + xCanvasComponent->dispose(); + } + mpWindowImpl->mpFrameWindow->mpWindowImpl->mbWaitSystemResize = sal_True; ImplGetFrame()->ShowFullScreen( bFullScreenMode, nDisplay ); } @@ -319,3 +334,5 @@ sal_Bool WorkWindow::IsMaximized() const } return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/test/canvasbitmaptest.cxx b/vcl/test/canvasbitmaptest.cxx index 1b70161d6cb0..aa3d524fdf6c 100644 --- a/vcl/test/canvasbitmaptest.cxx +++ b/vcl/test/canvasbitmaptest.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -114,7 +115,7 @@ class TestApp : public Application { public: virtual void Main(); - virtual USHORT Exception( USHORT nError ); + virtual sal_uInt16 Exception( sal_uInt16 nError ); }; class TestWindow : public Dialog @@ -122,7 +123,7 @@ class TestWindow : public Dialog public: TestWindow() : Dialog( (Window *) NULL ) { - SetText( rtl::OUString::createFromAscii( "CanvasBitmap test harness" ) ); + SetText( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CanvasBitmap test harness")) ); SetSizePixel( Size( 1024, 1024 ) ); EnablePaint( true ); Show(); @@ -172,8 +173,7 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp, int nDepth = nOriginalDepth; { - ScopedBitmapReadAccess pAcc( aContainedBmp.AcquireReadAccess(), - aContainedBmp ); + Bitmap::ScopedReadAccess pAcc( aContainedBmp ); nDepth = pAcc->GetBitCount(); } @@ -323,8 +323,7 @@ void checkBitmapImport( const rtl::Reference<VclCanvasBitmap>& xBmp, int nDepth = nOriginalDepth; { - ScopedBitmapReadAccess pAcc( aContainedBmp.AcquireReadAccess(), - aContainedBmp ); + Bitmap::ScopedReadAccess pAcc( aContainedBmp ); nDepth = pAcc->GetBitCount(); } @@ -887,8 +886,7 @@ void TestWindow::Paint( const Rectangle& ) Bitmap aBitmap(Size(200,200),nDepth); aBitmap.Erase(COL_WHITE); { - ScopedBitmapWriteAccess pAcc(aBitmap.AcquireWriteAccess(), - aBitmap); + Bitmap::ScopedWriteAccess pAcc(aBitmap); if( pAcc.get() ) { BitmapColor aBlack(0); @@ -918,8 +916,7 @@ void TestWindow::Paint( const Rectangle& ) Bitmap aMask(Size(200,200),1); aMask.Erase(COL_WHITE); { - ScopedBitmapWriteAccess pAcc(aMask.AcquireWriteAccess(), - aMask); + Bitmap::ScopedWriteAccess pAcc(aMask); if( pAcc.get() ) { pAcc->SetFillColor(COL_BLACK); @@ -1044,3 +1041,4 @@ void Main() Application::Execute(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/test/dndtest.cxx b/vcl/test/dndtest.cxx index c52d6d3e9589..31d7f01b3aa8 100755..100644 --- a/vcl/test/dndtest.cxx +++ b/vcl/test/dndtest.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,12 +45,11 @@ #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp> #include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp> -#include <vos/process.hxx> +#include <osl/process.h> #include <stdio.h> using namespace ::rtl; -using namespace ::vos; using namespace ::com::sun::star::io; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -139,7 +139,7 @@ public: { DataFlavor df; - df.MimeType = OUString::createFromAscii( "text/plain;charset=utf-16" ); + df.MimeType = OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16")); df.DataType = getCppuType( static_cast < OUString * > ( 0 ) ); m_aFlavorList[0] = df; @@ -156,18 +156,17 @@ public: void MyApp::Main() { OUString aRegistry; - OStartupInfo aInfo; - for( sal_Int32 n = 0, nmax = aInfo.getCommandArgCount(); n < nmax; n++ ) + for( sal_Int32 n = 0, nmax = osl_getCommandArgCount(); n < nmax; n++ ) { OUString aArg; - aInfo.getCommandArg( n, aArg ); + osl_getCommandArg( n, &aArg.pData ); - if( aArg.compareTo( OUString::createFromAscii( "-r" ), 2 ) == 0 ) + if( aArg.compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("-r")), 2 ) == 0 ) { if ( n + 1 < nmax ) - aInfo.getCommandArg( ++n, aRegistry ); + osl_getCommandArg( ++n, &aRegistry.pData ); } } @@ -211,7 +210,7 @@ void MyApp::Main() MyListBox aListBox( &aMainWin ); aListBox.SetPosSizePixel( 10, 10, 100, 100 ); - aListBox.InsertEntry( OUString::createFromAscii( "TestItem" )); + aListBox.InsertEntry( OUString(RTL_CONSTASCII_USTRINGPARAM("TestItem"))); aListBox.Show(); Execute(); @@ -297,7 +296,7 @@ void SAL_CALL MyDragAndDropListener::dragGestureRecognized( const DragGestureEve printf( "XDragGestureListener::dragGestureRecognized called ( Window: %p, %"SAL_PRIdINT32", %"SAL_PRIdINT32" ).\n", m_pWindow, dge.DragOriginX, dge.DragOriginY ); Reference< XDragSource > xDragSource( dge.DragSource, UNO_QUERY ); - xDragSource->startDrag( dge, -1, 0, 0, new StringTransferable( OUString::createFromAscii( "TestString" ) ), this ); + xDragSource->startDrag( dge, -1, 0, 0, new StringTransferable( OUString(RTL_CONSTASCII_USTRINGPARAM("TestString")) ), this ); printf( "XDragSource::startDrag returned.\n" ); } @@ -386,7 +385,7 @@ void SAL_CALL MyDragAndDropListener::disposing( const EventObject& ) throw(Runti // ----------------------------------------------------------------------- MyInfoBox::MyInfoBox( Window* pParent ) : InfoBox( pParent, - OUString::createFromAscii( "dragging over this box should result in another window id in the drag log." ) ) + OUString(RTL_CONSTASCII_USTRINGPARAM("dragging over this box should result in another window id in the drag log.")) ) { Reference< XDropTargetListener > xListener = new MyDragAndDropListener( this ); @@ -445,3 +444,4 @@ sal_Bool SAL_CALL StringTransferable::isDataFlavorSupported( const DataFlavor& ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/test/makefile.mk b/vcl/test/makefile.mk index 8691d0bcb626..8815053829cc 100644 --- a/vcl/test/makefile.mk +++ b/vcl/test/makefile.mk @@ -32,10 +32,6 @@ TARGET=dndtest LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE -.IF "$(GUI)" == "OS2" -TARGETTYPE=GUI -.ENDIF - # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk @@ -52,7 +48,6 @@ APP1STDLIBS= $(CPPULIB) \ $(CPPUHELPERLIB) \ $(TOOLSLIB) \ $(SALLIB) \ - $(VOSLIB) \ $(SOTLIB) \ $(COMPHELPERLIB) \ $(VCLLIB) diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx index 341c1263ac9e..92429e63c91e 100644 --- a/vcl/unx/generic/app/i18n_cb.cxx +++ b/vcl/unx/generic/app/i18n_cb.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -127,7 +128,6 @@ Preedit_DeleteText(preedit_text_t *ptext, int from, int howmuch) ptext->nLength -= howmuch; } else - // if ( to > pText->nLength ) { // XXX this indicates an error, are we out of sync ? fprintf(stderr, "Preedit_DeleteText( from=%i to=%i length=%i )\n", @@ -327,13 +327,6 @@ Preedit_FeedbackToSAL ( XIMFeedback* pfeedback, int nlength, std::vector<sal_uIn if (nfeedback & XIMTertiary) // same as 2ery nval |= SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE; - /* - // visibility feedback not supported now - if ( (nfeedback & XIMVisibleToForward) - || (nfeedback & XIMVisibleToBackward) - || (nfeedback & XIMVisibleCenter) ) - { } - */ } // copy in list psalattr[npos] = nval; @@ -354,7 +347,7 @@ PreeditDrawCallback(XIC ic, XPointer client_data, || pPreeditData->pFrame == NULL ) return; - // #88564# Solaris 7 deletes the preedit buffer after commit + // Solaris 7 deletes the preedit buffer after commit // since the next call to preeditstart will have the same effect just skip this. // if (pPreeditData->eState == ePreeditStatusStartPending && call_data->text == NULL) // return; @@ -510,8 +503,7 @@ PreeditCaretCallback ( XIC, XPointer,XIMPreeditCaretCallbackStruct* ) Bool IsControlCode(sal_Unicode nChar) { - if ( nChar <= 0x1F // C0 controls - /* || (0x80 <= nChar && nChar <= 0x9F) C1 controls */ ) + if ( nChar <= 0x1F /* C0 controls */ ) return True; else return False; @@ -525,7 +517,7 @@ CommitStringCallback( XIC ic, XPointer client_data, XPointer call_data ) XIMUnicodeText *cbtext = (XIMUnicodeText *)call_data; sal_Unicode *p_unicode_data = (sal_Unicode*)cbtext->string.utf16_char; - // #86964# filter unexpected pure control events + // filter unexpected pure control events if (cbtext->length == 1 && IsControlCode(p_unicode_data[0]) ) { if( pPreeditData->pFrame ) @@ -662,3 +654,5 @@ IM_IMDestroyCallback (XIM, XPointer client_data, XPointer) if (pMethod != NULL) pMethod->HandleDestroyIM(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx index 73de37538d61..8a8b5d620cb6 100644 --- a/vcl/unx/generic/app/i18n_ic.cxx +++ b/vcl/unx/generic/app/i18n_ic.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -332,7 +333,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : if ( mnPreeditStyle != XIMPreeditNone ) { -#if defined LINUX || defined FREEBSD || defined NETBSD +#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD || defined DRAGONFLY if ( mpPreeditAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, @@ -340,7 +341,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : } if ( mnStatusStyle != XIMStatusNone ) { -#if defined LINUX || defined FREEBSD || defined NETBSD +#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD || defined DRAGONFLY if ( mpStatusAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, @@ -557,14 +558,14 @@ SalI18N_InputContext::IsSupportedIMStyle( XIMStyle nStyle ) const Bool SalI18N_InputContext::SupportInputMethodStyle( XIMStyles *pIMStyles ) { - int nBestScore = 0; - int nActualScore = 0; - mnPreeditStyle = 0; mnStatusStyle = 0; if ( pIMStyles != NULL ) { + int nBestScore = 0; + int nActualScore = 0; + // check whether the XIM supports one of the desired styles // only a single preedit and a single status style must occure // in a inpuut method style. Hideki said so, so i trust him @@ -779,3 +780,4 @@ SalI18N_InputContext::EndExtTextInput( sal_uInt16 /*nFlags*/ ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/i18n_im.cxx b/vcl/unx/generic/app/i18n_im.cxx index 176212f681d5..5d30d74455ae 100644 --- a/vcl/unx/generic/app/i18n_im.cxx +++ b/vcl/unx/generic/app/i18n_im.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -617,3 +618,4 @@ SalI18N_InputMethod::AddConnectionWatch(Display *pDisplay, void *pConnectionHand +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/i18n_keysym.cxx b/vcl/unx/generic/app/i18n_keysym.cxx index 122a88517baf..2e2005f1a874 100644 --- a/vcl/unx/generic/app/i18n_keysym.cxx +++ b/vcl/unx/generic/app/i18n_keysym.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -363,3 +364,5 @@ KeysymToUnicode (KeySym nKeySym) return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx index 04ffe8bd8d71..8cae9d12eedd 100644 --- a/vcl/unx/generic/app/i18n_status.cxx +++ b/vcl/unx/generic/app/i18n_status.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -55,7 +56,6 @@ #include <svdata.hxx> using namespace vcl; -using namespace rtl; namespace vcl { @@ -731,3 +731,5 @@ SalI18NImeStatus* X11SalInstance::CreateI18NImeStatus() { return new X11ImeStatus(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/i18n_wrp.cxx b/vcl/unx/generic/app/i18n_wrp.cxx index ff56f0ed0647..981dc390e278 100644 --- a/vcl/unx/generic/app/i18n_wrp.cxx +++ b/vcl/unx/generic/app/i18n_wrp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -258,3 +259,4 @@ Status XvaCloseIM(XIM) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/i18n_xkb.cxx b/vcl/unx/generic/app/i18n_xkb.cxx index 5587bbf02339..cb93f48b6bd7 100644 --- a/vcl/unx/generic/app/i18n_xkb.cxx +++ b/vcl/unx/generic/app/i18n_xkb.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -161,3 +162,4 @@ SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32,sal_uInt32,sal_uInt32 } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx index 73d4b2a2e7eb..e164d06d5d07 100644 --- a/vcl/unx/generic/app/keysymnames.cxx +++ b/vcl/unx/generic/app/keysymnames.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#ifndef SOLARIS +#if !defined(SOLARIS) && !defined(AIX) #include <tools/prex.h> #include <X11/XKBlib.h> #include <tools/postx.h> @@ -36,6 +37,7 @@ #include <unx/saldisp.hxx> #include <X11/keysym.h> +#include <sal/macros.h> #if !defined (SunXK_Undo) #define SunXK_Undo 0x0000FF65 // XK_Undo @@ -93,8 +95,6 @@ namespace vcl_sal { { XK_Control_R, "Ctrl" }, { XK_Escape, "Esc" }, { XK_space, "Space" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Turkish[] = @@ -150,8 +150,6 @@ namespace vcl_sal { { SunXK_Paste, "Einsetzen" }, { SunXK_Find, "Suchen" }, { SunXK_Cut, "Ausschneiden" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_French[] = @@ -182,8 +180,6 @@ namespace vcl_sal { { SunXK_Paste, "Coller" }, { SunXK_Find, "Cher." }, { SunXK_Cut, "Couper" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Italian[] = @@ -213,8 +209,6 @@ namespace vcl_sal { { SunXK_Paste, "Incolla" }, { SunXK_Find, "Trova" }, { SunXK_Cut, "Taglia" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Dutch[] = @@ -239,8 +233,6 @@ namespace vcl_sal { { SunXK_Paste, "Paste" }, { SunXK_Find, "Find" }, { SunXK_Cut, "Cut" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Norwegian[] = @@ -266,8 +258,6 @@ namespace vcl_sal { { SunXK_Paste, "Lim" }, { SunXK_Find, "Søk" }, { SunXK_Cut, "Klipp" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Swedish[] = @@ -294,8 +284,6 @@ namespace vcl_sal { { SunXK_Paste, "Klistra in" }, { SunXK_Find, "Sök" }, { SunXK_Cut, "Klipp ut" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Portuguese[] = @@ -320,8 +308,6 @@ namespace vcl_sal { { SunXK_Paste, "Paste" }, { SunXK_Find, "Find" }, { SunXK_Cut, "Cut" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Spanish[] = @@ -352,77 +338,75 @@ namespace vcl_sal { { SunXK_Paste, "Pegar" }, { SunXK_Find, "Buscar" }, { SunXK_Cut, "Cortar" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeyboardReplacements aKeyboards[] = { #ifdef SOLARIS - { "Germany5", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]) }, - { "Germany4", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]) }, - { "France5", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) }, - { "France6", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) }, - { "France_x86", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) }, - { "Italy5", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) }, - { "Italy5-Hobo", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) }, - { "Italy4", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) }, - { "Italy6", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) }, - { "Italy_x86", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) }, - { "Netherland4", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) }, - { "Netherland5", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) }, - { "Netherland5-Hobo", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) }, - { "Netherland6", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) }, - { "Netherland_x86", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) }, - { "Norway5", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) }, - { "Norway5-Hobo", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) }, - { "Norway4", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) }, - { "Norway6", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) }, - { "Norway_x86", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) }, - { "Portugal5", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) }, - { "Portugal5-Hobo", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) }, - { "Portugal4", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) }, - { "Portugal6", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) }, - { "Portugal_x86", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) }, - { "Spain5", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) }, - { "Spain5-Hobo", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) }, - { "Spain4", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) }, - { "Spain6", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) }, - { "Spain_x86", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) }, - { "Sweden5", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) }, - { "Sweden5-Hobo", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) }, - { "Sweden4", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) }, - { "Sweden6", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) }, - { "Sweden_x86", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) }, + { "Germany5", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) }, + { "Germany4", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) }, + { "France5", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, + { "France6", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, + { "France_x86", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, + { "Italy5", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, + { "Italy5-Hobo", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, + { "Italy4", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, + { "Italy6", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, + { "Italy_x86", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, + { "Netherland4", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Netherland5", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Netherland5-Hobo", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Netherland6", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Netherland_x86", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Norway5", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, + { "Norway5-Hobo", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, + { "Norway4", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, + { "Norway6", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, + { "Norway_x86", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, + { "Portugal5", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Portugal5-Hobo", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Portugal4", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Portugal6", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Portugal_x86", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Spain5", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Spain5-Hobo", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Spain4", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Spain6", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Spain_x86", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Sweden5", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, + { "Sweden5-Hobo", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, + { "Sweden4", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, + { "Sweden6", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, + { "Sweden_x86", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, #endif - { "U.S. English", aImplReplacements_English, sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) }, - { "United Kingdom", aImplReplacements_English, sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) }, + { "U.S. English", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) }, + { "United Kingdom", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) }, // Germany, German - { "German", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]) }, - { "France", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) }, - { "French", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) }, + { "German", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) }, + { "France", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, + { "French", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, // Italy, Italian - { "Ital", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) }, + { "Ital", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, // Norway, Norwegian - { "Norw", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) }, + { "Norw", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, // Portugal, Portuguese - { "Portu", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) }, - { "Spain", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) }, - { "Spanish", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) }, + { "Portu", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Spain", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Spanish", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, // Sweden, Swedish - { "Swed", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) }, - { "Netherland", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) }, - { "Dutch", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) }, + { "Swed", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, + { "Netherland", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Dutch", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, // Turkish, Turkey - { "Turk", aImplReplacements_Turkish, sizeof(aImplReplacements_Turkish)/sizeof(aImplReplacements_Turkish[0]) }, + { "Turk", aImplReplacements_Turkish, SAL_N_ELEMENTS(aImplReplacements_Turkish) }, // Russian, Russia - { "Russia", aImplReplacements_Russian, sizeof(aImplReplacements_Russian)/sizeof(aImplReplacements_Russian[0]) }, - { "English", aImplReplacements_English, sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) } + { "Russia", aImplReplacements_Russian, SAL_N_ELEMENTS(aImplReplacements_Russian) }, + { "English", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) } }; String getKeysymReplacementName( const char* pKeyboard, KeySym nSymbol ) { - for( unsigned int n = 0; n < sizeof(aKeyboards)/sizeof(aKeyboards[0]); n++ ) + for( unsigned int n = 0; n < SAL_N_ELEMENTS(aKeyboards); n++ ) { if( ! strncasecmp( pKeyboard, aKeyboards[n].pKeyboardName, strlen( aKeyboards[n].pKeyboardName ) ) ) { @@ -436,7 +420,7 @@ namespace vcl_sal { } // try english fallbacks const struct KeysymNameReplacement* pRepl = aImplReplacements_English; - for( int m = sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) ; m ; ) + for( int m = SAL_N_ELEMENTS(aImplReplacements_English); m ; ) { if( nSymbol == pRepl[--m].aSymbol ) return String( pRepl[m].pName, RTL_TEXTENCODING_UTF8 ); @@ -597,11 +581,11 @@ static const keyboard_layout type6_layout[] = #include <stdio.h> #endif -const char* SalDisplay::GetKeyboardName( sal_Bool bRefresh ) +const char* SalDisplay::GetKeyboardName( bool bRefresh ) { if( bRefresh || ! m_aKeyboardName.Len() ) { -#ifdef SOLARIS +#if defined(SOLARIS) if( IsLocal() ) { int kbd = open( "/dev/kbd", O_RDONLY ); @@ -640,7 +624,7 @@ const char* SalDisplay::GetKeyboardName( sal_Bool bRefresh ) close(kbd); } } -#else +#elif !defined(AIX) int opcode, event, error; int major = XkbMajorVersion, minor = XkbMinorVersion; if( XkbQueryExtension( GetDisplay(), &opcode, &event,&error, &major, &minor ) ) @@ -686,3 +670,5 @@ const char* SalDisplay::GetKeyboardName( sal_Bool bRefresh ) } return m_aKeyboardName.GetBuffer(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/randrwrapper.cxx b/vcl/unx/generic/app/randrwrapper.cxx index e7f37c00e2ca..316bde14a83a 100644 --- a/vcl/unx/generic/app/randrwrapper.cxx +++ b/vcl/unx/generic/app/randrwrapper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -358,3 +359,5 @@ int SalDisplay::processRandREvent( XEvent* pEvent ) #endif return nRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index ec8db9509bf6..6d502e8563df 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,8 +58,8 @@ #include <unistd.h> #endif -#include <vos/process.hxx> -#include <vos/mutex.hxx> +#include <osl/process.h> +#include <osl/mutex.hxx> #include "unx/Xproto.h" #include "unx/saldisp.hxx" @@ -71,7 +72,6 @@ #include <osl/signal.h> #include <osl/thread.h> -#include <osl/process.h> #include <rtl/strbuf.hxx> #include <rtl/bootstrap.hxx> @@ -274,7 +274,13 @@ X11SalData::X11SalData() m_pPlugin = NULL; hMainThread_ = pthread_self(); - osl_getLocalHostname( &maLocalHostName.pData ); +} + +const rtl::OUString& X11SalData::GetLocalHostName() +{ + if (!maLocalHostName.getLength()) + osl_getLocalHostname( &maLocalHostName.pData ); + return maLocalHostName; } X11SalData::~X11SalData() @@ -402,16 +408,16 @@ void SalXLib::Init() Display *pDisp = NULL; // is there a -display command line parameter? - vos::OExtCommandLine aCommandLine; - sal_uInt32 nParams = aCommandLine.getCommandArgCount(); + + sal_uInt32 nParams = osl_getCommandArgCount(); rtl::OUString aParam; rtl::OString aDisplay; for (sal_uInt16 i=0; i<nParams; i++) { - aCommandLine.getCommandArg(i, aParam); - if (aParam.equalsAscii("-display")) + osl_getCommandArg(i, &aParam.pData); + if (aParam.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("-display"))) { - aCommandLine.getCommandArg(i+1, aParam); + osl_getCommandArg(i+1, &aParam.pData); aDisplay = rtl::OUStringToOString( aParam, osl_getThreadTextEncoding()); @@ -467,7 +473,7 @@ void SalXLib::Init() SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp ); XSync( pDisp, False ); - pKbdExtension->UseExtension( ! HasXErrorOccured() ); + pKbdExtension->UseExtension( ! HasXErrorOccurred() ); PopXErrorLevel(); pSalDisplay->SetKbdExtension( pKbdExtension ); @@ -537,7 +543,7 @@ void SalXLib::XError( Display *pDisplay, XErrorEvent *pEvent ) static Bool bOnce = False; if ( !bOnce ) { - std::fprintf(stderr, "X-Error occured in a request for X_OpenFont\n"); + std::fprintf(stderr, "X-Error occurred in a request for X_OpenFont\n"); EmitFontpathWarning(); bOnce = True ; @@ -795,7 +801,7 @@ void SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) void SalXLib::Wakeup() { - write (m_pTimeoutFDS[1], "", 1); + OSL_VERIFY(write (m_pTimeoutFDS[1], "", 1) == 1); } void SalXLib::PostUserEvent() @@ -865,3 +871,5 @@ rtl::OString X11SalData::getFrameResName( SalExtStyle nStyle ) return aBuf.makeStringAndClear(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 5a228676e722..358bbc205004 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,7 +42,7 @@ #include <ctype.h> #include <string.h> -#if defined(SOLARIS) +#if defined(SOLARIS) || defined(AIX) #include <sal/alloca.h> #include <osl/module.h> #endif @@ -54,7 +55,7 @@ #define XK_KOREAN #endif #include <X11/keysym.h> - +#include <X11/XKBlib.h> #include <X11/Xatom.h> #ifdef USE_XINERAMA @@ -87,9 +88,7 @@ Status XineramaGetInfo(Display*, int, XRectangle*, unsigned char*, int*); #include <vcl/keycodes.hxx> #include <vcl/salbtype.hxx> #include <unx/salbmp.h> -#ifndef _OSL_THREADMUTEX_H_ #include <osl/mutex.h> -#endif #include <unx/salobj.h> #include <unx/sm.hxx> #include <unx/wmadaptor.hxx> @@ -98,9 +97,10 @@ Status XineramaGetInfo(Display*, int, XRectangle*, unsigned char*, int*); #include <osl/socket.h> #include <poll.h> -using namespace rtl; using namespace vcl_sal; +using ::rtl::OUString; + // -=-= #defines -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #define PSEUDOCOLOR12 @@ -607,10 +607,12 @@ fd if( ! pDisplay->IsDisplay() ) return 0; - vos::IMutex* pSalInstYieldMutex = - GetSalData()->m_pInstance->GetYieldMutex(); - ::vos::OGuard aGuard( *pSalInstYieldMutex ); - return pDisplay->IsEvent(); + int result; + + GetSalData()->m_pInstance->GetYieldMutex()->acquire(); + result = pDisplay->IsEvent(); + GetSalData()->m_pInstance->GetYieldMutex()->release(); + return result; } static int DisplayQueue( int #ifdef DBG_UTIL @@ -620,11 +622,14 @@ fd { DBG_ASSERT( ConnectionNumber( pDisplay->GetDisplay() ) == fd, "wrong fd in DisplayHasEvent" ); - vos::IMutex* pSalInstYieldMutex = - GetSalData()->m_pInstance->GetYieldMutex(); - ::vos::OGuard aGuard( *pSalInstYieldMutex ); - return XEventsQueued( pDisplay->GetDisplay(), + int result; + + GetSalData()->m_pInstance->GetYieldMutex()->acquire(); + result = XEventsQueued( pDisplay->GetDisplay(), QueuedAfterReading ); + GetSalData()->m_pInstance->GetYieldMutex()->release(); + + return result; } static int DisplayYield( int #ifdef DBG_UTIL @@ -634,10 +639,10 @@ fd { DBG_ASSERT( ConnectionNumber( pDisplay->GetDisplay() ) == fd, "wrong fd in DisplayHasEvent" ); - vos::IMutex* pSalInstYieldMutex = - GetSalData()->m_pInstance->GetYieldMutex(); - ::vos::OGuard aGuard( *pSalInstYieldMutex ); + + GetSalData()->m_pInstance->GetYieldMutex()->acquire(); pDisplay->Yield(); + GetSalData()->m_pInstance->GetYieldMutex()->release(); return sal_True; } @@ -724,10 +729,10 @@ void SalDisplay::initScreen( int nScreen ) const 1 ); - ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() ); + rtl::OString aExec(rtl::OUStringToOString(SessionManagerClient::getExecName(), osl_getThreadTextEncoding())); const char* argv[2]; argv[0] = "/bin/sh"; - argv[1] = aExec.GetBuffer(); + argv[1] = aExec.getStr(); XSetCommand( pDisp_, rSD.m_aRefWindow, const_cast<char**>(argv), 2 ); XSelectInput( pDisp_, rSD.m_aRefWindow, PropertyChangeMask ); @@ -772,8 +777,7 @@ void SalDisplay::initScreen( int nScreen ) const XSetFunction( pDisp_, rSD.m_aAndInvertedGC, GXandInverted ); XSetFunction( pDisp_, rSD.m_aAndGC, GXand ); - // #44556# PowerPC Solaris 2.5 (XSun 3500) Bug: GXor = GXnop - //XSetFunction( pDisp_, pOrGC_, GXor ); + // PowerPC Solaris 2.5 (XSun 3500) Bug: GXor = GXnop XSetFunction( pDisp_, rSD.m_aOrGC, GXxor ); if( 1 == rSD.m_aVisual.GetDepth() ) @@ -792,7 +796,7 @@ void SalDisplay::initScreen( int nScreen ) const } rSD.m_hInvert50 = XCreateBitmapFromData( pDisp_, rSD.m_aRefWindow, - invert50_bits, + reinterpret_cast<const char*>(invert50_bits), invert50_width, invert50_height ); } @@ -881,7 +885,8 @@ void SalDisplay::Init() sscanf( pProperties, "%li", &nProperties_ ); else { -#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD +#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD || \ + defined NETBSD || defined OPENBSD || defined DRAGONFLY nProperties_ |= PROPERTY_FEATURE_Maximize; #endif // Server Bugs & Properties @@ -907,7 +912,8 @@ void SalDisplay::Init() if( GetServerVendor() == vendor_xfree ) { nProperties_ |= PROPERTY_BUG_XCopyArea_GXxor; -#if defined LINUX || defined FREEBSD +#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD || \ + defined DRAGONFLY // otherwm and olwm are a kind of default, which are not detected // carefully. if we are running linux (i.e. not netbsd) on an xfree // display, fvwm is most probable the wm to choose, confusing with mwm @@ -1028,6 +1034,77 @@ void SalDisplay::Beep() const // Keyboard // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +namespace { + +bool InitXkb(Display* dpy) +{ + int nOpcode, nEvent, nError; + int nXkbMajor = XkbMajorVersion; + int nXkbMinor = XkbMinorVersion; + + if (!XkbLibraryVersion(&nXkbMajor, &nXkbMinor)) + return false; + + return XkbQueryExtension( + dpy, &nOpcode, &nEvent, &nError, &nXkbMajor, &nXkbMinor); +} + +unsigned int GetKeySymMask(Display* dpy, KeySym nKeySym) +{ + int nMask = 0; + XModifierKeymap* pXmkMap = XGetModifierMapping(dpy); + KeyCode nKeyCode = XKeysymToKeycode(dpy, nKeySym); + if (nKeyCode == NoSymbol) + return 0; + + for (int i = 0; i < 8; ++i) + { + KeyCode nThisKeyCode = pXmkMap->modifiermap[pXmkMap->max_keypermod*i]; + if (nThisKeyCode == nKeyCode) + nMask = 1 << i; + } + XFreeModifiermap(pXmkMap); + return nMask; +} + +} + +void SalDisplay::SimulateKeyPress( sal_uInt16 nKeyCode ) +{ + if (nKeyCode == KEY_CAPSLOCK) + { + Display* dpy = GetDisplay(); + if (!InitXkb(dpy)) + return; + + unsigned int nMask = GetKeySymMask(dpy, XK_Caps_Lock); + XkbStateRec xkbState; + XkbGetState(dpy, XkbUseCoreKbd, &xkbState); + unsigned int nCapsLockState = xkbState.locked_mods & nMask; + if (nCapsLockState) + XkbLockModifiers (dpy, XkbUseCoreKbd, nMask, 0); + else + XkbLockModifiers (dpy, XkbUseCoreKbd, nMask, nMask); + } +} + +sal_uInt16 SalDisplay::GetIndicatorState() const +{ + unsigned int _state = 0; + sal_uInt16 nState = 0; + XkbGetIndicatorState(pDisp_, XkbUseCoreKbd, &_state); + + if ((_state & 0x00000001)) + nState |= INDICATOR_CAPSLOCK; + if ((_state & 0x00000002)) + nState |= INDICATOR_NUMLOCK; + if ((_state & 0x00000004)) + nState |= INDICATOR_SCROLLLOCK; + + return nState; +} + String SalDisplay::GetKeyNameFromKeySym( KeySym nKeySym ) const { String aRet; @@ -1099,6 +1176,7 @@ void SalDisplay::ModifierMapping() XubString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const { String aStrMap; + String aCustomKeyName; if( nKeyCode & KEY_MOD1 ) aStrMap += GetKeyNameFromKeySym( nCtrlKeySym_ ); @@ -1212,10 +1290,10 @@ XubString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const nKeySym = GetServerVendor() == vendor_sun ? SunXK_Cut : XK_L10; break; case KEY_ADD: - nKeySym = XK_plus; + aCustomKeyName = '+'; break; case KEY_SUBTRACT: - nKeySym = XK_minus; + aCustomKeyName = '-'; break; case KEY_MULTIPLY: nKeySym = XK_asterisk; @@ -1250,6 +1328,15 @@ XubString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const case KEY_QUOTELEFT: nKeySym = XK_grave; break; + case KEY_BRACKETLEFT: + aCustomKeyName = '['; + break; + case KEY_BRACKETRIGHT: + aCustomKeyName = ']'; + break; + case KEY_SEMICOLON: + aCustomKeyName = ';'; + break; default: nKeySym = 0; @@ -1268,6 +1355,14 @@ XubString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const else aStrMap.Erase(); } + else if (aCustomKeyName.Len()) + { + // For semicolumn, bracket left and bracket right, it's better to use + // their keys than their names. (fdo#32891) + if (aStrMap.Len()) + aStrMap += '+'; + aStrMap += aCustomKeyName; + } else aStrMap.Erase(); @@ -1504,13 +1599,6 @@ sal_uInt16 SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const case XK_Menu: nKey = KEY_CONTEXTMENU; break; -/* - case XK_Break: - case XK_Select: - case XK_Execute: - case XK_Print: - case XK_Cancel: -*/ } } else if( IsISOKey( keysym ) ) // XK_ISO_ @@ -1580,9 +1668,18 @@ sal_uInt16 SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const nKey = KEY_QUOTELEFT; *pcPrintable = '`'; break; -// case XK_Linefeed: -// *pcPrintable = '\n'; -// break; + case XK_bracketleft: + nKey = KEY_BRACKETLEFT; + *pcPrintable = '['; + break; + case XK_bracketright: + nKey = KEY_BRACKETRIGHT; + *pcPrintable = ']'; + break; + case XK_semicolon: + nKey = KEY_SEMICOLON; + *pcPrintable = ';'; + break; // - - - - - - - - - - - - - Apollo - - - - - - - - - - - - - 0x1000 case 0x1000FF02: // apXK_Copy nKey = KEY_COPY; @@ -1704,7 +1801,7 @@ KeySym SalDisplay::GetKeySym( XKeyEvent *pEvent, /* unhandled error */ break; case XLookupKeySym: - /* #72223# this is a strange one: on exceed sometimes + /* this is a strange one: on exceed sometimes * no printable is returned for the first char entered, * just to retry lookup solves the problem. The problem * is not yet fully understood, so restrict 2nd lookup @@ -1751,7 +1848,7 @@ KeySym SalDisplay::GetKeySym( XKeyEvent *pEvent, #define MAKE_BITMAP( name ) \ XCreateBitmapFromData( pDisp_, \ DefaultRootWindow( pDisp_ ), \ - name##_bits, \ + reinterpret_cast<const char*>(name##_bits), \ name##_width, \ name##_height ) @@ -2061,7 +2158,7 @@ XLIB_Cursor SalDisplay::GetPointer( int ePointerStyle ) MAKE_CURSOR( vertcurs_ ); break; - // --> FME 2004-07-30 #i32329# Enhanced table selection + // #i32329# Enhanced table selection case POINTER_TAB_SELECT_S: MAKE_CURSOR( tblsels_ ); break; @@ -2077,16 +2174,14 @@ XLIB_Cursor SalDisplay::GetPointer( int ePointerStyle ) case POINTER_TAB_SELECT_SW: MAKE_CURSOR( tblselsw_ ); break; - // <-- - // --> FME 2004-08-16 #i20119# Paintbrush tool + // #i20119# Paintbrush tool case POINTER_PAINTBRUSH : MAKE_CURSOR( paintbrush_ ); break; - // <-- default: - DBG_ERROR("pointer not implemented"); + OSL_FAIL("pointer not implemented"); aCur = XCreateFontCursor( pDisp_, XC_arrow ); break; } @@ -2113,10 +2208,13 @@ XLIB_Cursor SalDisplay::GetPointer( int ePointerStyle ) int SalDisplay::CaptureMouse( SalFrame *pCapture ) { + static const char* pEnv = getenv( "SAL_NO_MOUSEGRABS" ); + if( !pCapture ) { m_pCapture = NULL; - XUngrabPointer( GetDisplay(), CurrentTime ); + if( !pEnv || !*pEnv ) + XUngrabPointer( GetDisplay(), CurrentTime ); XFlush( GetDisplay() ); return 0; } @@ -2125,20 +2223,23 @@ int SalDisplay::CaptureMouse( SalFrame *pCapture ) // FIXME: get rid of X11SalFrame const SystemEnvData* pEnvData = pCapture->GetSystemData(); - int ret = XGrabPointer( GetDisplay(), - (XLIB_Window)pEnvData->aWindow, - False, - PointerMotionMask| ButtonPressMask|ButtonReleaseMask, - GrabModeAsync, - GrabModeAsync, - None, - static_cast<X11SalFrame*>(pCapture)->GetCursor(), - CurrentTime ); - - if( ret != GrabSuccess ) - { - DBG_ASSERT( 1, "SalDisplay::CaptureMouse could not grab pointer\n"); - return -1; + if( !pEnv || !*pEnv ) + { + int ret = XGrabPointer( GetDisplay(), + (XLIB_Window)pEnvData->aWindow, + False, + PointerMotionMask| ButtonPressMask|ButtonReleaseMask, + GrabModeAsync, + GrabModeAsync, + None, + static_cast<X11SalFrame*>(pCapture)->GetCursor(), + CurrentTime ); + + if( ret != GrabSuccess ) + { + DBG_ASSERT( 1, "SalDisplay::CaptureMouse could not grab pointer\n"); + return -1; + } } m_pCapture = pCapture; @@ -2246,7 +2347,7 @@ void SalX11Display::Yield() XEvent aEvent; DBG_ASSERT( static_cast<SalYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex())->GetThreadId() == - vos::OThread::getCurrentIdentifier(), + osl::Thread::getCurrentIdentifier(), "will crash soon since solar mutex not locked in SalDisplay::Yield" ); XNextEvent( pDisp_, &aEvent ); @@ -2254,13 +2355,13 @@ void SalX11Display::Yield() Dispatch( &aEvent ); #ifdef DBG_UTIL - if( pXLib_->HasXErrorOccured() ) + if( pXLib_->HasXErrorOccurred() ) { XFlush( pDisp_ ); PrintEvent( "SalDisplay::Yield (WasXError)", &aEvent ); } #endif - pXLib_->ResetXErrorOccured(); + pXLib_->ResetXErrorOccurred(); } long SalX11Display::Dispatch( XEvent *pEvent ) @@ -2325,7 +2426,7 @@ long SalX11Display::Dispatch( XEvent *pEvent ) if( MappingModifier == pEvent->xmapping.request ) ModifierMapping(); if( MappingKeyboard == pEvent->xmapping.request ) // refresh mapping - GetKeyboardName( sal_True ); + GetKeyboardName( true ); } break; case ButtonPress: @@ -2584,7 +2685,7 @@ void SalDisplay::PrintInfo() const sal::static_int_cast< unsigned int >(GetVisual(m_nDefaultScreen).GetVisualId()) ); } -int SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ) +void SalDisplay::addXineramaScreenUnique( int i, long i_nX, long i_nY, long i_nWidth, long i_nHeight ) { // see if any frame buffers are at the same coordinates // this can happen with weird configuration e.g. on @@ -2598,13 +2699,14 @@ int SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, lo if( m_aXineramaScreens[n].GetWidth() < i_nWidth || m_aXineramaScreens[n].GetHeight() < i_nHeight ) { + m_aXineramaScreenIndexMap[i] = n; m_aXineramaScreens[n].SetSize( Size( i_nWidth, i_nHeight ) ); } - return (int)n; + return; } } + m_aXineramaScreenIndexMap[i] = m_aXineramaScreens.size(); m_aXineramaScreens.push_back( Rectangle( Point( i_nX, i_nY ), Size( i_nWidth, i_nHeight ) ) ); - return (int)m_aXineramaScreens.size()-1; } void SalDisplay::InitXinerama() @@ -2630,8 +2732,9 @@ void SalDisplay::InitXinerama() { m_bXinerama = true; m_aXineramaScreens = std::vector<Rectangle>(); + m_aXineramaScreenIndexMap = std::vector<int>(nFramebuffers); for( int i = 0; i < nFramebuffers; i++ ) - addXineramaScreenUnique( pFramebuffers[i].x, + addXineramaScreenUnique( i, pFramebuffers[i].x, pFramebuffers[i].y, pFramebuffers[i].width, pFramebuffers[i].height ); @@ -2647,9 +2750,10 @@ if( XineramaIsActive( pDisp_ ) ) if( nFramebuffers > 1 ) { m_aXineramaScreens = std::vector<Rectangle>(); + m_aXineramaScreenIndexMap = std::vector<int>(nFramebuffers); for( int i = 0; i < nFramebuffers; i++ ) { - addXineramaScreenUnique( pScreens[i].x_org, + addXineramaScreenUnique( i, pScreens[i].x_org, pScreens[i].y_org, pScreens[i].width, pScreens[i].height ); @@ -2690,7 +2794,7 @@ void SalDisplay::deregisterFrame( SalFrame* pFrame ) osl_releaseMutex( hEventGuard_ ); } else { - DBG_ERROR( "SalDisplay::deregisterFrame !acquireMutex\n" ); + OSL_FAIL( "SalDisplay::deregisterFrame !acquireMutex\n" ); } m_aFrames.remove( pFrame ); @@ -3007,17 +3111,12 @@ SalColormap::SalColormap( const SalDisplay *pDisplay, Colormap hColormap, int nS GetXPixels( aColor, 0xC0, 0xC0, 0xC0 ); // light colors: 3 * 2 = 6 -// GetXPixels( aColor, 0x00, 0x00, 0x00 ); + GetXPixels( aColor, 0x00, 0x00, 0xFF ); GetXPixels( aColor, 0x00, 0xFF, 0x00 ); GetXPixels( aColor, 0x00, 0xFF, 0xFF ); -// GetXPixels( aColor, 0xFF, 0x00, 0x00 ); -// GetXPixels( aColor, 0xFF, 0x00, 0xFF ); -// GetXPixels( aColor, 0xFF, 0xFF, 0x00 ); -// GetXPixels( aColor, 0xFF, 0xFF, 0xFF ); // standard colors: 7 * 2 = 14 -// GetXPixels( aColor, 0x00, 0x00, 0x00 ); GetXPixels( aColor, 0x00, 0x00, 0x80 ); GetXPixels( aColor, 0x00, 0x80, 0x00 ); GetXPixels( aColor, 0x00, 0x80, 0x80 ); @@ -3025,7 +3124,7 @@ SalColormap::SalColormap( const SalDisplay *pDisplay, Colormap hColormap, int nS GetXPixels( aColor, 0x80, 0x00, 0x80 ); GetXPixels( aColor, 0x80, 0x80, 0x00 ); GetXPixels( aColor, 0x80, 0x80, 0x80 ); - GetXPixels( aColor, 0x00, 0xB8, 0xFF ); // Blau 7 + GetXPixels( aColor, 0x00, 0xB8, 0xFF ); // Blue 7 // cube: 6*6*6 - 8 = 208 for( r = 0; r < 0x100; r += 0x33 ) // 0x33, 0x66, 0x99, 0xCC, 0xFF @@ -3433,3 +3532,4 @@ Pixel SalColormap::GetPixel( SalColor nSalColor ) const + ((b+8)/17) ]; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx index 3b57544ebad0..81bc26cb3672 100644 --- a/vcl/unx/generic/app/salinst.cxx +++ b/vcl/unx/generic/app/salinst.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,8 +35,6 @@ #include "osl/module.hxx" #include "tools/solarmutex.hxx" -#include "vos/mutex.hxx" - #include "unx/salunx.h" #include "unx/saldata.hxx" @@ -50,6 +49,7 @@ #include "vcl/helper.hxx" #include "salwtype.hxx" +#include <sal/macros.h> // ------------------------------------------------------------------------- // @@ -66,27 +66,27 @@ SalYieldMutex::SalYieldMutex() void SalYieldMutex::acquire() { - OMutex::acquire(); - mnThreadId = vos::OThread::getCurrentIdentifier(); + SolarMutexObject::acquire(); + mnThreadId = osl::Thread::getCurrentIdentifier(); mnCount++; } void SalYieldMutex::release() { - if ( mnThreadId == vos::OThread::getCurrentIdentifier() ) + if ( mnThreadId == osl::Thread::getCurrentIdentifier() ) { if ( mnCount == 1 ) mnThreadId = 0; mnCount--; } - OMutex::release(); + SolarMutexObject::release(); } sal_Bool SalYieldMutex::tryToAcquire() { - if ( OMutex::tryToAcquire() ) + if ( SolarMutexObject::tryToAcquire() ) { - mnThreadId = vos::OThread::getCurrentIdentifier(); + mnThreadId = osl::Thread::getCurrentIdentifier(); mnCount++; return True; } @@ -221,7 +221,7 @@ bool X11SalInstance::AnyInput(sal_uInt16 nType) return bRet; } -vos::IMutex* X11SalInstance::GetYieldMutex() +osl::SolarMutex* X11SalInstance::GetYieldMutex() { return mpSalYieldMutex; } @@ -232,7 +232,7 @@ sal_uLong X11SalInstance::ReleaseYieldMutex() { SalYieldMutex* pYieldMutex = mpSalYieldMutex; if ( pYieldMutex->GetThreadId() == - vos::OThread::getCurrentIdentifier() ) + osl::Thread::getCurrentIdentifier() ) { sal_uLong nCount = pYieldMutex->GetAcquireCount(); sal_uLong n = nCount; @@ -267,8 +267,7 @@ bool X11SalInstance::CheckYieldMutex() bool bRet = true; SalYieldMutex* pYieldMutex = mpSalYieldMutex; - if ( pYieldMutex->GetThreadId() != - vos::OThread::getCurrentIdentifier() ) + if ( pYieldMutex->GetThreadId() != osl::Thread::getCurrentIdentifier() ) { bRet = false; } @@ -319,7 +318,7 @@ static void getServerDirectories( std::list< rtl::OString >& o_rFontPaths ) }; ::std::list< ByteString > aLines; - for( unsigned int i = 0; i < sizeof(pCommands)/sizeof(pCommands[0]); i++ ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS(pCommands); i++ ) { FILE* pPipe = popen( pCommands[i], "r" ); aLines.clear(); @@ -450,3 +449,5 @@ void X11SalInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, cons if (add_to_recently_used_file_list) add_to_recently_used_file_list(rFileUrl, rMimeType); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/salsys.cxx b/vcl/unx/generic/app/salsys.cxx index 672b3e53e672..c5f7174e3d4c 100644 --- a/vcl/unx/generic/app/salsys.cxx +++ b/vcl/unx/generic/app/salsys.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -224,3 +225,5 @@ int X11SalSystem::ShowNativeMessageBox(const String& rTitle, const String& rMess return nResult != -1 ? nButtonIds[ nResult ] : 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/saltimer.cxx b/vcl/unx/generic/app/saltimer.cxx index af8b2df4124b..98d6ccde5943 100644 --- a/vcl/unx/generic/app/saltimer.cxx +++ b/vcl/unx/generic/app/saltimer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,3 +95,4 @@ void X11SalTimer::Start( sal_uLong nMS ) GetX11SalData()->GetLib()->StartTimer( nMS ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index c8090270d611..0d1b084b74a5 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,6 +35,8 @@ #include <stdio.h> +#include <rtl/strbuf.hxx> + #include <osl/process.h> #include <osl/security.h> #include <osl/conditn.h> @@ -82,6 +85,7 @@ SalSession* X11SalInstance::CreateSalSession() { if( ! pOneInstance ) pOneInstance = new IceSalSession(); + SessionManagerClient::open(); return pOneInstance; } @@ -175,7 +179,7 @@ public: SmcConn SessionManagerClient::aSmcConnection = NULL; -ByteString SessionManagerClient::aClientID; +rtl::OString SessionManagerClient::m_aClientID; sal_Bool ICEConnectionObserver::bIsWatching = sal_False; struct pollfd* ICEConnectionObserver::pFilehandles = NULL; IceConn* ICEConnectionObserver::pConnections = NULL; @@ -211,7 +215,7 @@ static void BuildSmPropertyList() { if( ! pSmProps ) { - ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() ); + rtl::OString aExec(rtl::OUStringToOString(SessionManagerClient::getExecName(), osl_getThreadTextEncoding())); nSmProps = 5; pSmProps = new SmProp[ nSmProps ]; @@ -220,29 +224,30 @@ static void BuildSmPropertyList() pSmProps[ 0 ].type = const_cast<char*>(SmLISTofARRAY8); pSmProps[ 0 ].num_vals = 1; pSmProps[ 0 ].vals = new SmPropValue; - pSmProps[ 0 ].vals->length = aExec.Len()+1; - pSmProps[ 0 ].vals->value = strdup( aExec.GetBuffer() ); + pSmProps[ 0 ].vals->length = aExec.getLength()+1; + pSmProps[ 0 ].vals->value = strdup( aExec.getStr() ); pSmProps[ 1 ].name = const_cast<char*>(SmProgram); pSmProps[ 1 ].type = const_cast<char*>(SmARRAY8); pSmProps[ 1 ].num_vals = 1; pSmProps[ 1 ].vals = new SmPropValue; - pSmProps[ 1 ].vals->length = aExec.Len()+1; - pSmProps[ 1 ].vals->value = strdup( aExec.GetBuffer() ); + pSmProps[ 1 ].vals->length = aExec.getLength()+1; + pSmProps[ 1 ].vals->value = strdup( aExec.getStr() ); pSmProps[ 2 ].name = const_cast<char*>(SmRestartCommand); pSmProps[ 2 ].type = const_cast<char*>(SmLISTofARRAY8); pSmProps[ 2 ].num_vals = 3; pSmProps[ 2 ].vals = new SmPropValue[3]; - pSmProps[ 2 ].vals[0].length = aExec.Len()+1; - pSmProps[ 2 ].vals[0].value = strdup( aExec.GetBuffer() ); - ByteString aRestartOption( "-session=" ); - aRestartOption.Append( SessionManagerClient::getSessionID() ); - pSmProps[ 2 ].vals[1].length = aRestartOption.Len()+1; - pSmProps[ 2 ].vals[1].value = strdup( aRestartOption.GetBuffer() ); - ByteString aRestartOptionNoLogo( "-nologo" ); - pSmProps[ 2 ].vals[2].length = aRestartOptionNoLogo.Len()+1; - pSmProps[ 2 ].vals[2].value = strdup( aRestartOptionNoLogo.GetBuffer() ); + pSmProps[ 2 ].vals[0].length = aExec.getLength()+1; + pSmProps[ 2 ].vals[0].value = strdup( aExec.getStr() ); + rtl::OStringBuffer aRestartOption; + aRestartOption.append(RTL_CONSTASCII_STRINGPARAM("-session=")); + aRestartOption.append(SessionManagerClient::getSessionID()); + pSmProps[ 2 ].vals[1].length = aRestartOption.getLength()+1; + pSmProps[ 2 ].vals[1].value = strdup(aRestartOption.getStr()); + rtl::OString aRestartOptionNoLogo(RTL_CONSTASCII_STRINGPARAM("-nologo")); + pSmProps[ 2 ].vals[2].length = aRestartOptionNoLogo.getLength()+1; + pSmProps[ 2 ].vals[2].value = strdup(aRestartOptionNoLogo.getStr()); rtl::OUString aUserName; rtl::OString aUser; @@ -377,7 +382,8 @@ void SessionManagerClient::SaveYourselfProc( SessionManagerClient::saveDone(); return; } - Application::PostUserEvent( STATIC_LINK( (void*)(shutdown ? 0xffffffff : 0x0), SessionManagerClient, SaveYourselfHdl ) ); + sal_uIntPtr nStateVal = shutdown ? 0xffffffff : 0x0; + Application::PostUserEvent( STATIC_LINK( (void*)nStateVal, SessionManagerClient, SaveYourselfHdl ) ); SMprintf( "waiting for save yourself event to be processed\n" ); #endif } @@ -463,7 +469,7 @@ void SessionManagerClient::open() ICEConnectionObserver::lock(); char* pClientID = NULL; - const ByteString& rPrevId( getPreviousSessionID() ); + const rtl::OString& rPrevId(getPreviousSessionID()); aCallbacks.save_yourself.callback = SaveYourselfProc; aCallbacks.save_yourself.client_data = NULL; @@ -482,7 +488,7 @@ void SessionManagerClient::open() SmcSaveCompleteProcMask | SmcShutdownCancelledProcMask , &aCallbacks, - rPrevId.Len() ? const_cast<char*>(rPrevId.GetBuffer()) : NULL, + rPrevId.getLength() ? const_cast<char*>(rPrevId.getStr()) : NULL, &pClientID, sizeof( aErrBuf ), aErrBuf ); @@ -490,13 +496,13 @@ void SessionManagerClient::open() SMprintf( "SmcOpenConnection failed: %s\n", aErrBuf ); else SMprintf( "SmcOpenConnection succeeded, client ID is \"%s\"\n", pClientID ); - aClientID = ByteString( pClientID ); + m_aClientID = rtl::OString(pClientID); free( pClientID ); pClientID = NULL; ICEConnectionObserver::unlock(); SalDisplay* pDisp = GetX11SalData()->GetDisplay(); - if( pDisp->GetDrawable( pDisp->GetDefaultScreenNumber() ) && aClientID.Len() ) + if( pDisp->GetDrawable(pDisp->GetDefaultScreenNumber()) && !m_aClientID.isEmpty() ) { XChangeProperty( pDisp->GetDisplay(), pDisp->GetDrawable( pDisp->GetDefaultScreenNumber() ), @@ -504,8 +510,8 @@ void SessionManagerClient::open() XA_STRING, 8, PropModeReplace, - (unsigned char*)aClientID.GetBuffer(), - aClientID.Len() + (unsigned char*)m_aClientID.getStr(), + m_aClientID.getLength() ); } } @@ -514,9 +520,9 @@ void SessionManagerClient::open() #endif } -const ByteString& SessionManagerClient::getSessionID() +const rtl::OString& SessionManagerClient::getSessionID() { - return aClientID; + return m_aClientID; } void SessionManagerClient::close() @@ -559,35 +565,38 @@ void SessionManagerClient::interactionDone( bool bCancelShutdown ) } -String SessionManagerClient::getExecName() +rtl::OUString SessionManagerClient::getExecName() { rtl::OUString aExec, aSysExec; osl_getExecutableFile( &aExec.pData ); osl_getSystemPathFromFileURL( aExec.pData, &aSysExec.pData ); - int nPos = aSysExec.indexOf( rtl::OUString::createFromAscii( ".bin" ) ); + int nPos = aSysExec.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".bin")) ); if( nPos != -1 ) aSysExec = aSysExec.copy( 0, nPos ); return aSysExec; } -const ByteString& SessionManagerClient::getPreviousSessionID() +const rtl::OString& SessionManagerClient::getPreviousSessionID() { - static ByteString aPrevId; + static rtl::OString aPrevId; int nCommands = osl_getCommandArgCount(); - for( int i = 0; i < nCommands; i++ ) + for (int i = 0; i < nCommands; ++i) { ::rtl::OUString aArg; osl_getCommandArg( i, &aArg.pData ); - if( aArg.compareToAscii( "-session=", 9 ) == 0 ) + if(aArg.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("-session="))) { - aPrevId = ByteString( ::rtl::OUStringToOString( aArg.copy( 9 ), osl_getThreadTextEncoding() ) ); + aPrevId = rtl::OUStringToOString( + aArg.copy(RTL_CONSTASCII_LENGTH("-session=")), + osl_getThreadTextEncoding()); break; } } - SMprintf( "previous ID = \"%s\"\n", aPrevId.GetBuffer() ); + + SMprintf( "previous ID = \"%s\"\n", aPrevId.getStr() ); return aPrevId; } @@ -654,7 +663,7 @@ void ICEConnectionObserver::deactivate() void ICEConnectionObserver::wakeup() { char cChar = 'w'; - write( nWakeupFiles[1], &cChar, 1 ); + OSL_VERIFY(write( nWakeupFiles[1], &cChar, 1 ) == 1); } void ICEConnectionWorker( void* ) @@ -791,6 +800,9 @@ void ICEConnectionObserver::ICEWatchProc( close( nWakeupFiles[1] ); close( nWakeupFiles[0] ); ICEThread = NULL; + // acquire the mutex again, because the caller does not expect + // it to be released when calling into SM + osl_acquireMutex( ICEMutex ); } } SMprintf( "ICE connection on %d %s\n", @@ -799,3 +811,5 @@ void ICEConnectionObserver::ICEWatchProc( SMprintf( "Display connection is %d\n", ConnectionNumber( GetX11SalData()->GetDisplay()->GetDisplay() ) ); #endif } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/soicon.cxx b/vcl/unx/generic/app/soicon.cxx index bb41299c376d..1557b064977e 100644 --- a/vcl/unx/generic/app/soicon.cxx +++ b/vcl/unx/generic/app/soicon.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -114,3 +115,4 @@ sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen,sal_uInt16 nIcon return sal_True; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 90b2e5426bdf..ad9b5ee22d6c 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,7 @@ #include "osl/thread.h" #include "osl/process.h" - +#include <sal/macros.h> #include "vcl/configsettings.hxx" #include "unx/wmadaptor.hxx" @@ -500,7 +501,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) : WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*) bsearch( &aSearch, aProtocolTab, - sizeof( aProtocolTab )/sizeof( aProtocolTab[0] ), + SAL_N_ELEMENTS( aProtocolTab ), sizeof( struct WMAdaptorProtocol ), compareProtocol ); if( pMatch ) @@ -675,7 +676,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) : && aRealType == XA_CARDINAL && nFormat == 32 && nItems != 0 - && ! m_pSalDisplay->GetXLib()->HasXErrorOccured() + && ! m_pSalDisplay->GetXLib()->HasXErrorOccurred() ) { aCheckWindow = *(XLIB_Window*)pProperty; @@ -756,7 +757,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) : WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*) bsearch( &aSearch, aProtocolTab, - sizeof( aProtocolTab )/sizeof( aProtocolTab[0] ), + SAL_N_ELEMENTS( aProtocolTab ), sizeof( struct WMAdaptorProtocol ), compareProtocol ); if( pMatch ) @@ -878,7 +879,7 @@ bool WMAdaptor::getNetWmName() && aRealType == XA_WINDOW && nFormat == 32 && nItems != 0 - && ! m_pSalDisplay->GetXLib()->HasXErrorOccured() + && ! m_pSalDisplay->GetXLib()->HasXErrorOccurred() ) { aCheckWindow = *(XLIB_Window*)pProperty; @@ -1037,7 +1038,7 @@ bool GnomeWMAdaptor::isValid() const void WMAdaptor::initAtoms() { // get basic atoms - for( unsigned int i = 0; i < sizeof( aAtomTab )/sizeof( aAtomTab[0] ); i++ ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS( aAtomTab ); i++ ) m_aWMAtoms[ aAtomTab[i].nProtocol ] = XInternAtom( m_pDisplay, aAtomTab[i].pProtocol, False ); m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ] = XInternAtom( m_pDisplay, "_NET_SUPPORTING_WM_CHECK", True ); m_aWMAtoms[ NET_WM_NAME ] = XInternAtom( m_pDisplay, "_NET_WM_NAME", True ); @@ -1090,7 +1091,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const if( aCountry.getLength() ) { - aLocaleString += ::rtl::OUString::createFromAscii( "_" ); + aLocaleString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_")); aLocaleString += aCountry; } if( aVariant.getLength() ) @@ -2546,3 +2547,5 @@ void WMAdaptor::answerPing( X11SalFrame* i_pFrame, XClientMessageEvent* i_pEvent XFlush( m_pDisplay ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx b/vcl/unx/generic/desktopdetect/desktopdetector.cxx index 777e5aa921d3..77cabc229284 100644 --- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx +++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,6 +30,7 @@ #include "precompiled_vcl.hxx" #include <unx/svunx.h> +#include <unx/desktops.hxx> #include <tools/prex.h> #include <X11/Xatom.h> #include <tools/postx.h> @@ -41,19 +43,10 @@ #include "vclpluginapi.h" #include <unistd.h> +#include <string.h> -using namespace rtl; - -enum { - DESKTOP_NONE = 0, - DESKTOP_UNKNOWN, - DESKTOP_GNOME, - DESKTOP_KDE, - DESKTOP_KDE4, - DESKTOP_CDE -}; - -static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KDE4", "CDE" }; +using ::rtl::OUString; +using ::rtl::OString; static bool is_gnome_desktop( Display* pDisplay ) { @@ -253,9 +246,8 @@ static bool is_cde_desktop( Display* pDisplay ) extern "C" { -DESKTOP_DETECTOR_PUBLIC rtl::OUString get_desktop_environment() +DESKTOP_DETECTOR_PUBLIC DesktopType get_desktop_environment() { - rtl::OUStringBuffer aRet( 8 ); static const char *pOverride = getenv( "OOO_FORCE_DESKTOP" ); if ( pOverride && *pOverride ) @@ -263,33 +255,39 @@ DESKTOP_DETECTOR_PUBLIC rtl::OUString get_desktop_environment() OString aOver( pOverride ); if ( aOver.equalsIgnoreAsciiCase( "cde" ) ) - aRet.appendAscii( desktop_strings[DESKTOP_CDE] ); + return DESKTOP_CDE; if ( aOver.equalsIgnoreAsciiCase( "kde4" ) ) - aRet.appendAscii( desktop_strings[DESKTOP_KDE4] ); + return DESKTOP_KDE4; if ( aOver.equalsIgnoreAsciiCase( "gnome" ) ) - aRet.appendAscii( desktop_strings[DESKTOP_GNOME] ); + return DESKTOP_GNOME; if ( aOver.equalsIgnoreAsciiCase( "kde" ) ) - aRet.appendAscii( desktop_strings[DESKTOP_KDE] ); + return DESKTOP_KDE; if ( aOver.equalsIgnoreAsciiCase( "none" ) ) - aRet.appendAscii( desktop_strings[DESKTOP_UNKNOWN] ); + return DESKTOP_UNKNOWN; } - if( aRet.getLength() == 0 ) + // get display to connect to + const char* pDisplayStr = getenv( "DISPLAY" ); + + const char* pUsePlugin = getenv( "SAL_USE_VCLPLUGIN" ); + + if (pUsePlugin && (strcmp(pUsePlugin, "svp") == 0)) + pDisplayStr = NULL; + else { - // get display to connect to - const char* pDisplayStr = getenv( "DISPLAY" ); int nParams = osl_getCommandArgCount(); OUString aParam; OString aBParm; for( int i = 0; i < nParams; i++ ) { osl_getCommandArg( i, &aParam.pData ); - if( aParam.equalsAscii( "-headless" ) ) + if( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-headless" ) ) || + aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--headless" ) ) ) { pDisplayStr = NULL; break; } - if( i < nParams-1 && (aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" )) ) + if( i < nParams-1 && (aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-display" ) ) || aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--display" ) )) ) { osl_getCommandArg( i+1, &aParam.pData ); aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() ); @@ -297,47 +295,49 @@ DESKTOP_DETECTOR_PUBLIC rtl::OUString get_desktop_environment() break; } } - - // no server at all - if( ! pDisplayStr || !*pDisplayStr ) - aRet.appendAscii( desktop_strings[DESKTOP_NONE] ); - else - { - /* #i92121# workaround deadlocks in the X11 implementation - */ - static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); - /* #i90094# - from now on we know that an X connection will be - established, so protect X against itself - */ - if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) - XInitThreads(); - - Display* pDisplay = XOpenDisplay( pDisplayStr ); - if( pDisplay ) - { - XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler ); - - if ( is_kde4_desktop( pDisplay ) ) - aRet.appendAscii( desktop_strings[DESKTOP_KDE4] ); - else if ( is_gnome_desktop( pDisplay ) ) - aRet.appendAscii( desktop_strings[DESKTOP_GNOME] ); - else if ( is_cde_desktop( pDisplay ) ) - aRet.appendAscii( desktop_strings[DESKTOP_CDE] ); - else if ( is_kde_desktop( pDisplay ) ) - aRet.appendAscii( desktop_strings[DESKTOP_KDE] ); - else - aRet.appendAscii( desktop_strings[DESKTOP_UNKNOWN] ); - - // set the default handler again - XSetErrorHandler( pOldHdl ); - - XCloseDisplay( pDisplay ); - } - } } - return aRet.makeStringAndClear(); + // no server at all + if( ! pDisplayStr || !*pDisplayStr ) + return DESKTOP_NONE; + + /* #i92121# workaround deadlocks in the X11 implementation + */ + static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); + /* #i90094# + from now on we know that an X connection will be + established, so protect X against itself + */ + if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) + XInitThreads(); + + Display* pDisplay = XOpenDisplay( pDisplayStr ); + if( pDisplay == NULL ) + return DESKTOP_NONE; + + DesktopType ret; + + XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler ); + + if ( is_kde4_desktop( pDisplay ) ) + ret = DESKTOP_KDE4; + else if ( is_gnome_desktop( pDisplay ) ) + ret = DESKTOP_GNOME; + else if ( is_cde_desktop( pDisplay ) ) + ret = DESKTOP_CDE; + else if ( is_kde_desktop( pDisplay ) ) + ret = DESKTOP_KDE; + else + ret = DESKTOP_UNKNOWN; + + // set the default handler again + XSetErrorHandler( pOldHdl ); + + XCloseDisplay( pDisplay ); + + return ret; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/X11_clipboard.cxx b/vcl/unx/generic/dtrans/X11_clipboard.cxx index a08a9481b8e8..e2cc22b32198 100644 --- a/vcl/unx/generic/dtrans/X11_clipboard.cxx +++ b/vcl/unx/generic/dtrans/X11_clipboard.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,9 +53,10 @@ using namespace com::sun::star::uno; using namespace com::sun::star::awt; using namespace cppu; using namespace osl; -using namespace rtl; using namespace x11; +using ::rtl::OUString; + X11Clipboard::X11Clipboard( SelectionManager& rManager, Atom aSelection ) : ::cppu::WeakComponentImplHelper4< ::com::sun::star::datatransfer::clipboard::XClipboardEx, @@ -78,7 +80,7 @@ X11Clipboard::X11Clipboard( SelectionManager& rManager, Atom aSelection ) : else { m_rSelectionManager.registerHandler( XA_PRIMARY, *this ); - m_rSelectionManager.registerHandler( m_rSelectionManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ), *this ); + m_rSelectionManager.registerHandler( m_rSelectionManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ), *this ); } } @@ -96,7 +98,7 @@ X11Clipboard::~X11Clipboard() else { m_rSelectionManager.deregisterHandler( XA_PRIMARY ); - m_rSelectionManager.deregisterHandler( m_rSelectionManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ) ); + m_rSelectionManager.deregisterHandler( m_rSelectionManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ) ); } } @@ -107,7 +109,7 @@ void X11Clipboard::fireChangedContentsEvent() { ClearableMutexGuard aGuard( m_rSelectionManager.getMutex() ); #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "X11Clipboard::fireChangedContentsEvent for %s (%d listeners)\n", + fprintf( stderr, "X11Clipboard::fireChangedContentsEvent for %s (%" SAL_PRI_SIZET "u listeners)\n", OUStringToOString( m_rSelectionManager.getString( m_aSelection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(), m_aListeners.size() ); #endif ::std::list< Reference< XClipboardListener > > listeners( m_aListeners ); @@ -153,7 +155,7 @@ Reference< XTransferable > SAL_CALL X11Clipboard::getContents() MutexGuard aGuard(m_rSelectionManager.getMutex()); if( ! m_aContents.is() ) - m_aContents = new X11Transferable( SelectionManager::get(), static_cast< OWeakObject* >(this), m_aSelection ); + m_aContents = new X11Transferable( SelectionManager::get(), m_aSelection ); return m_aContents; } @@ -181,7 +183,7 @@ void SAL_CALL X11Clipboard::setContents( else { m_rSelectionManager.requestOwnership( XA_PRIMARY ); - m_rSelectionManager.requestOwnership( m_rSelectionManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ) ); + m_rSelectionManager.requestOwnership( m_rSelectionManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ) ); } // notify old owner on loss of ownership @@ -260,7 +262,7 @@ Reference< XInterface > X11Clipboard::getReference() throw() OUString SAL_CALL X11Clipboard::getImplementationName( ) throw(RuntimeException) { - return OUString::createFromAscii(X11_CLIPBOARD_IMPLEMENTATION_NAME); + return OUString(RTL_CONSTASCII_USTRINGPARAM(X11_CLIPBOARD_IMPLEMENTATION_NAME)); } // ------------------------------------------------------------------------ @@ -291,3 +293,4 @@ Sequence< OUString > SAL_CALL X11Clipboard::getSupportedServiceNames( ) return X11Clipboard_getSupportedServiceNames(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/X11_clipboard.hxx b/vcl/unx/generic/dtrans/X11_clipboard.hxx index 2c0ee2d95c0d..73240d8715e6 100644 --- a/vcl/unx/generic/dtrans/X11_clipboard.hxx +++ b/vcl/unx/generic/dtrans/X11_clipboard.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,13 +31,9 @@ #include <X11_selection.hxx> -#ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDEX_HPP_ #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp> -#endif -#ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDNOTIFIER_HPP_ #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp> -#endif #include <cppuhelper/compbase4.hxx> // ------------------------------------------------------------------------ @@ -149,3 +146,5 @@ namespace x11 { } // namepspace #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/X11_dndcontext.cxx b/vcl/unx/generic/dtrans/X11_dndcontext.cxx index e6fc3dd8a532..988dce430a51 100644 --- a/vcl/unx/generic/dtrans/X11_dndcontext.cxx +++ b/vcl/unx/generic/dtrans/X11_dndcontext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -136,3 +137,5 @@ void DragSourceContext::transferablesFlavorsChanged() throw() { m_rManager.transferablesFlavorsChanged(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/X11_dndcontext.hxx b/vcl/unx/generic/dtrans/X11_dndcontext.hxx index d8ef87444a7a..bca708eb24c7 100644 --- a/vcl/unx/generic/dtrans/X11_dndcontext.hxx +++ b/vcl/unx/generic/dtrans/X11_dndcontext.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -102,3 +103,5 @@ namespace x11 { } // namespace #endif // _DTRANS_X11_DNDCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/X11_droptarget.cxx b/vcl/unx/generic/dtrans/X11_droptarget.cxx index 5db23329abd8..d72c5c4c7eeb 100644 --- a/vcl/unx/generic/dtrans/X11_droptarget.cxx +++ b/vcl/unx/generic/dtrans/X11_droptarget.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,12 +32,13 @@ #include <X11_selection.hxx> using namespace x11; -using namespace rtl; using namespace com::sun::star::lang; using namespace com::sun::star::awt; using namespace com::sun::star::datatransfer; using namespace com::sun::star::datatransfer::dnd; +using ::rtl::OUString; + DropTarget::DropTarget() : ::cppu::WeakComponentImplHelper3< XDropTarget, @@ -202,7 +204,7 @@ void DropTarget::dragOver( const DropTargetDragEvent& dtde ) throw() OUString DropTarget::getImplementationName() throw() { - return OUString::createFromAscii(XDND_DROPTARGET_IMPLEMENTATION_NAME); + return OUString(RTL_CONSTASCII_USTRINGPARAM(XDND_DROPTARGET_IMPLEMENTATION_NAME)); } // ------------------------------------------------------------------------ @@ -226,3 +228,4 @@ Sequence< OUString > DropTarget::getSupportedServiceNames() throw() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index e7b0e754e395..22f109905b13 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,12 +42,13 @@ #include <X11/keysym.h> #include <X11/Xutil.h> #include "tools/postx.h" -#if defined(LINUX) || defined(NETBSD) || defined (FREEBSD) +#if defined(LINUX) || defined(NETBSD) || defined (FREEBSD) || defined(OPENBSD) #include <sys/poll.h> #else #include <poll.h> #endif #include <sal/alloca.h> +#include <sal/macros.h> #include <X11_selection.hxx> #include <X11_clipboard.hxx> @@ -72,7 +74,7 @@ #include <osl/process.h> #include <comphelper/processfactory.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #define DRAG_EVENT_MASK ButtonPressMask |\ ButtonReleaseMask |\ @@ -93,11 +95,13 @@ 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; using namespace x11; +using ::rtl::OUString; +using ::rtl::OUStringHash; +using ::rtl::OStringToOUString; + // stubs to satisfy solaris compiler's rather rigid linking warning extern "C" { @@ -214,9 +218,9 @@ rtl_TextEncoding x11::getTextPlainEncoding( const OUString& rMimeType ) // ------------------------------------------------------------------------ -::std::hash_map< OUString, SelectionManager*, OUStringHash >& SelectionManager::getInstances() +::boost::unordered_map< OUString, SelectionManager*, OUStringHash >& SelectionManager::getInstances() { - static ::std::hash_map< OUString, SelectionManager*, OUStringHash > aInstances; + static ::boost::unordered_map< OUString, SelectionManager*, OUStringHash > aInstances; return aInstances; } @@ -292,7 +296,7 @@ SelectionManager::SelectionManager() : m_aDragRunning.reset(); } -XLIB_Cursor SelectionManager::createCursor( const char* pPointerData, const char* pMaskData, int width, int height, int hotX, int hotY ) +XLIB_Cursor SelectionManager::createCursor( const unsigned char* pPointerData, const unsigned char* pMaskData, int width, int height, int hotX, int hotY ) { Pixmap aPointer; Pixmap aMask; @@ -309,13 +313,13 @@ XLIB_Cursor SelectionManager::createCursor( const char* pPointerData, const char aPointer = XCreateBitmapFromData( m_pDisplay, m_aWindow, - pPointerData, + reinterpret_cast<const char*>(pPointerData), width, height ); aMask = XCreateBitmapFromData( m_pDisplay, m_aWindow, - pMaskData, + reinterpret_cast<const char*>(pMaskData), width, height ); XLIB_Cursor aCursor = @@ -331,7 +335,7 @@ XLIB_Cursor SelectionManager::createCursor( const char* pPointerData, const char void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::com::sun::star::uno::Exception) { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); if( ! m_xDisplayConnection.is() ) { @@ -351,16 +355,6 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c arguments.getConstArray()[0] >>= m_xDisplayConnection; if( ! m_xDisplayConnection.is() ) { -#if 0 - // for the time being try to live without XDisplayConnection - // for the sake of clipboard service - // clipboard service should be initialized with a XDisplayConnection - // in the future - Exception aExc; - aExc.Message = OUString::createFromAscii( "initialize me with a valid XDisplayConnection" ); - aExc.Context = static_cast< OWeakObject* >(this); - throw aExc; -#endif } else m_xDisplayConnection->addEventHandler( Any(), this, ~0 ); @@ -393,39 +387,38 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c XSynchronize( m_pDisplay, True ); #endif // clipboard selection - m_nCLIPBOARDAtom = getAtom( OUString::createFromAscii( "CLIPBOARD" ) ); + m_nCLIPBOARDAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ); // special targets - m_nTARGETSAtom = getAtom( OUString::createFromAscii( "TARGETS" ) ); - m_nTIMESTAMPAtom = getAtom( OUString::createFromAscii( "TIMESTAMP" ) ); - m_nTEXTAtom = getAtom( OUString::createFromAscii( "TEXT" ) ); - m_nINCRAtom = getAtom( OUString::createFromAscii( "INCR" ) ); - m_nCOMPOUNDAtom = getAtom( OUString::createFromAscii( "COMPOUND_TEXT" ) ); - m_nMULTIPLEAtom = getAtom( OUString::createFromAscii( "MULTIPLE" ) ); - m_nUTF16Atom = getAtom( OUString::createFromAscii( "ISO10646-1" ) ); -// m_nUTF16Atom = getAtom( OUString::createFromAscii( "text/plain;charset=ISO-10646-UCS-2" ) ); - m_nImageBmpAtom = getAtom( OUString::createFromAscii( "image/bmp" ) ); + m_nTARGETSAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("TARGETS")) ); + m_nTIMESTAMPAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")) ); + m_nTEXTAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("TEXT")) ); + m_nINCRAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("INCR")) ); + m_nCOMPOUNDAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("COMPOUND_TEXT")) ); + m_nMULTIPLEAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("MULTIPLE")) ); + m_nUTF16Atom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("ISO10646-1")) ); + m_nImageBmpAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("image/bmp")) ); // Atoms for Xdnd protocol - m_nXdndAware = getAtom( OUString::createFromAscii( "XdndAware" ) ); - m_nXdndEnter = getAtom( OUString::createFromAscii( "XdndEnter" ) ); - m_nXdndLeave = getAtom( OUString::createFromAscii( "XdndLeave" ) ); - m_nXdndPosition = getAtom( OUString::createFromAscii( "XdndPosition" ) ); - m_nXdndStatus = getAtom( OUString::createFromAscii( "XdndStatus" ) ); - m_nXdndDrop = getAtom( OUString::createFromAscii( "XdndDrop" ) ); - m_nXdndFinished = getAtom( OUString::createFromAscii( "XdndFinished" ) ); - m_nXdndSelection = getAtom( OUString::createFromAscii( "XdndSelection" ) ); - m_nXdndTypeList = getAtom( OUString::createFromAscii( "XdndTypeList" ) ); - m_nXdndProxy = getAtom( OUString::createFromAscii( "XdndProxy" ) ); - m_nXdndActionCopy = getAtom( OUString::createFromAscii( "XdndActionCopy" ) ); - m_nXdndActionMove = getAtom( OUString::createFromAscii( "XdndActionMove" ) ); - m_nXdndActionLink = getAtom( OUString::createFromAscii( "XdndActionLink" ) ); - m_nXdndActionAsk = getAtom( OUString::createFromAscii( "XdndActionAsk" ) ); - m_nXdndActionPrivate= getAtom( OUString::createFromAscii( "XdndActionPrivate" ) ); + m_nXdndAware = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndAware")) ); + m_nXdndEnter = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndEnter")) ); + m_nXdndLeave = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndLeave")) ); + m_nXdndPosition = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndPosition")) ); + m_nXdndStatus = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndStatus")) ); + m_nXdndDrop = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndDrop")) ); + m_nXdndFinished = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndFinished")) ); + m_nXdndSelection = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndSelection")) ); + m_nXdndTypeList = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndTypeList")) ); + m_nXdndProxy = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndProxy")) ); + m_nXdndActionCopy = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndActionCopy")) ); + m_nXdndActionMove = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndActionMove")) ); + m_nXdndActionLink = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndActionLink")) ); + m_nXdndActionAsk = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndActionAsk")) ); + m_nXdndActionPrivate= getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndActionPrivate")) ); // initialize map with member none - m_aAtomToString[ 0 ]= OUString::createFromAscii( "None" ); - m_aAtomToString[ XA_PRIMARY ] = OUString::createFromAscii( "PRIMARY" ); + m_aAtomToString[ 0 ]= OUString(RTL_CONSTASCII_USTRINGPARAM("None")); + m_aAtomToString[ XA_PRIMARY ] = OUString(RTL_CONSTASCII_USTRINGPARAM("PRIMARY")); // create a (invisible) message window m_aWindow = XCreateSimpleWindow( m_pDisplay, DefaultRootWindow( m_pDisplay ), @@ -470,7 +463,7 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c // just interested in SelectionClear/Notify/Request and PropertyChange XSelectInput( m_pDisplay, m_aWindow, PropertyChangeMask ); // create the transferable for Drag operations - m_xDropTransferable = new X11Transferable( *this, static_cast< OWeakObject* >(this), m_nXdndSelection ); + m_xDropTransferable = new X11Transferable( *this, m_nXdndSelection ); registerHandler( m_nXdndSelection, *this ); m_aThread = osl_createSuspendedThread( call_SelectionManager_run, this ); @@ -493,9 +486,9 @@ SelectionManager::~SelectionManager() fprintf( stderr, "SelectionManager::~SelectionManager (%s)\n", m_pDisplay ? DisplayString(m_pDisplay) : "no display" ); #endif { - MutexGuard aGuard( *Mutex::getGlobalMutex() ); + osl::MutexGuard aGuard( *osl::Mutex::getGlobalMutex() ); - ::std::hash_map< OUString, SelectionManager*, OUStringHash >::iterator it; + ::boost::unordered_map< OUString, SelectionManager*, OUStringHash >::iterator it; for( it = getInstances().begin(); it != getInstances().end(); ++it ) if( it->second == this ) { @@ -519,18 +512,12 @@ SelectionManager::~SelectionManager() // thread handle is freed in dragDoDispatch() } - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "shutting down SelectionManager\n" ); #endif - if( m_xDisplayConnection.is() ) - { - m_xDisplayConnection->removeEventHandler( Any(), this ); - m_xDisplayConnection.clear(); - } - if( m_pDisplay ) { deregisterHandler( m_nXdndSelection ); @@ -560,7 +547,7 @@ SelectionManager::~SelectionManager() SelectionAdaptor* SelectionManager::getAdaptor( Atom selection ) { - ::std::hash_map< Atom, Selection* >::iterator it = + ::boost::unordered_map< Atom, Selection* >::iterator it = m_aSelections.find( selection ); return it != m_aSelections.end() ? it->second->m_pAdaptor : NULL; } @@ -569,7 +556,7 @@ SelectionAdaptor* SelectionManager::getAdaptor( Atom selection ) OUString SelectionManager::convertFromCompound( const char* pText, int nLen ) { - MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( m_aMutex ); OUString aRet; if( nLen < 0 ) nLen = strlen( pText ); @@ -600,7 +587,7 @@ OUString SelectionManager::convertFromCompound( const char* pText, int nLen ) OString SelectionManager::convertToCompound( const OUString& rText ) { - MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( m_aMutex ); XTextProperty aProp; aProp.value = NULL; aProp.encoding = XA_STRING; @@ -620,7 +607,7 @@ OString SelectionManager::convertToCompound( const OUString& rText ) aRet = (char*)aProp.value; XFree( aProp.value ); #ifdef SOLARIS - /* #97070# + /* * for currently unknown reasons XmbTextListToTextProperty on Solaris returns * no data in ISO8859-n encodings (at least for n = 1, 15) * in these encodings the directly converted text does the @@ -693,7 +680,7 @@ bool SelectionManager::convertData( aEncoding = getTextPlainEncoding( aFlavor.MimeType ); if( aEncoding != RTL_TEXTENCODING_DONTKNOW || bCompoundText ) { - aFlavor.MimeType = OUString::createFromAscii( "text/plain;charset=utf-16" ); + aFlavor.MimeType = OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16")); aFlavor.DataType = getCppuType( (OUString *) 0 ); if( xTransferable->isDataFlavorSupported( aFlavor ) ) { @@ -720,14 +707,14 @@ bool SelectionManager::convertData( SelectionManager& SelectionManager::get( const OUString& rDisplayName ) { - MutexGuard aGuard( *Mutex::getGlobalMutex() ); + osl::MutexGuard aGuard( *osl::Mutex::getGlobalMutex() ); OUString aDisplayName( rDisplayName ); if( ! aDisplayName.getLength() ) aDisplayName = OStringToOUString( getenv( "DISPLAY" ), RTL_TEXTENCODING_ISO_8859_1 ); SelectionManager* pInstance = NULL; - ::std::hash_map< OUString, SelectionManager*, OUStringHash >::iterator it = getInstances().find( aDisplayName ); + ::boost::unordered_map< OUString, SelectionManager*, OUStringHash >::iterator it = getInstances().find( aDisplayName ); if( it != getInstances().end() ) pInstance = it->second; else pInstance = getInstances()[ aDisplayName ] = new SelectionManager(); @@ -739,9 +726,9 @@ SelectionManager& SelectionManager::get( const OUString& rDisplayName ) const OUString& SelectionManager::getString( Atom aAtom ) { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); - ::std::hash_map< Atom, OUString >::const_iterator it; + ::boost::unordered_map< Atom, OUString >::const_iterator it; if( ( it = m_aAtomToString.find( aAtom ) ) == m_aAtomToString.end() ) { static OUString aEmpty; @@ -760,9 +747,9 @@ const OUString& SelectionManager::getString( Atom aAtom ) Atom SelectionManager::getAtom( const OUString& rString ) { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); - ::std::hash_map< OUString, Atom, OUStringHash >::const_iterator it; + ::boost::unordered_map< OUString, Atom, OUStringHash >::const_iterator it; if( ( it = m_aStringToAtom.find( rString ) ) == m_aStringToAtom.end() ) { static Atom nNoDisplayAtoms = 1; @@ -780,7 +767,7 @@ bool SelectionManager::requestOwnership( Atom selection ) bool bSuccess = false; if( m_pDisplay && m_aWindow ) { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); SelectionAdaptor* pAdaptor = getAdaptor( selection ); if( pAdaptor ) @@ -822,9 +809,7 @@ bool SelectionManager::requestOwnership( Atom selection ) void SelectionManager::convertTypeToNative( const OUString& rType, Atom selection, int& rFormat, ::std::list< Atom >& rConversions, bool bPushFront ) { NativeTypeEntry* pTab = selection == m_nXdndSelection ? aXdndConversionTab : aNativeConversionTab; - int nTabEntries = selection == m_nXdndSelection - ? sizeof(aXdndConversionTab)/sizeof(aXdndConversionTab[0]) : - sizeof(aNativeConversionTab)/sizeof(aNativeConversionTab[0]); + int nTabEntries = selection == m_nXdndSelection ? SAL_N_ELEMENTS(aXdndConversionTab) : SAL_N_ELEMENTS(aNativeConversionTab); OString aType( OUStringToOString( rType, RTL_TEXTENCODING_ISO_8859_1 ) ); rFormat = 0; @@ -887,7 +872,7 @@ void SelectionManager::getNativeTypeList( const Sequence< DataFlavor >& rTypes, rOutTypeList.push_front( XA_STRING ); rOutTypeList.push_front( m_nCOMPOUNDAtom ); } - convertTypeToNative( OUString::createFromAscii( "text/plain;charset=utf-8" ), targetselection, nFormat, rOutTypeList, true ); + convertTypeToNative( OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-8")), targetselection, nFormat, rOutTypeList, true ); } if( targetselection != m_nXdndSelection ) rOutTypeList.push_back( m_nMULTIPLEAtom ); @@ -897,10 +882,8 @@ void SelectionManager::getNativeTypeList( const Sequence< DataFlavor >& rTypes, OUString SelectionManager::convertTypeFromNative( Atom nType, Atom selection, int& rFormat ) { - NativeTypeEntry* pTab = selection == m_nXdndSelection ? aXdndConversionTab : aNativeConversionTab; - int nTabEntries = selection == m_nXdndSelection - ? sizeof(aXdndConversionTab)/sizeof(aXdndConversionTab[0]) : - sizeof(aNativeConversionTab)/sizeof(aNativeConversionTab[0]); + NativeTypeEntry* pTab = (selection == m_nXdndSelection) ? aXdndConversionTab : aNativeConversionTab; + int nTabEntries = (selection == m_nXdndSelection) ? SAL_N_ELEMENTS(aXdndConversionTab) : SAL_N_ELEMENTS(aNativeConversionTab); for( int i = 0; i < nTabEntries; i++ ) { @@ -920,8 +903,8 @@ OUString SelectionManager::convertTypeFromNative( Atom nType, Atom selection, in bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_Int8 >& rData ) { - ResettableMutexGuard aGuard(m_aMutex); - ::std::hash_map< Atom, Selection* >::iterator it; + osl::ResettableMutexGuard aGuard(m_aMutex); + ::boost::unordered_map< Atom, Selection* >::iterator it; bool bSuccess = false; #if OSL_DEBUG_LEVEL > 1 @@ -1059,12 +1042,11 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rType, Sequence< sal_Int8 >& rData ) { - int nFormat; bool bSuccess = false; - ::std::hash_map< Atom, Selection* >::iterator it; + ::boost::unordered_map< Atom, Selection* >::iterator it; { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); it = m_aSelections.find( selection ); if( it == m_aSelections.end() ) @@ -1160,7 +1142,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp Atom pTypes[4] = { XA_PIXMAP, XA_PIXMAP, XA_COLORMAP, XA_COLORMAP }; { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); XChangeProperty( m_pDisplay, m_aWindow, @@ -1178,7 +1160,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp Atom* pReturnedTypes = (Atom*)aData.getArray(); if( pReturnedTypes[0] == XA_PIXMAP && pReturnedTypes[1] == XA_PIXMAP ) { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); Atom type = None; int format = 0; @@ -1226,7 +1208,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp // convert data if possible if( aPixmap != None ) { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); sal_Int32 nOutSize = 0; sal_uInt8* pBytes = X11_getBmpFromPixmap( m_pDisplay, aPixmap, aColormap, nOutSize ); @@ -1243,6 +1225,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp if( ! bSuccess ) { + int nFormat; ::std::list< Atom > aTypes; convertTypeToNative( rType, selection, nFormat, aTypes ); ::std::list< Atom >::const_iterator type_it; @@ -1257,7 +1240,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp bSuccess = getPasteData( selection, nSelectedType, rData ); } #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "getPasteData for selection %s and data type %s returns %s, returned sequence has length %ld\n", + fprintf( stderr, "getPasteData for selection %s and data type %s returns %s, returned sequence has length %" SAL_PRIdINT32 "\n", OUStringToOString( getString( selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(), OUStringToOString( rType, RTL_TEXTENCODING_ISO_8859_1 ).getStr(), bSuccess ? "true" : "false", @@ -1271,9 +1254,9 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >& rTypes ) { - ::std::hash_map< Atom, Selection* >::iterator it; + ::boost::unordered_map< Atom, Selection* >::iterator it; { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); it = m_aSelections.find( selection ); if( it != m_aSelections.end() && @@ -1304,7 +1287,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor > { const unsigned int atomcount = 256; // more than three types; look in property - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); Atom nType; int nFormat; @@ -1422,7 +1405,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor > Sequence< DataFlavor > aTemp( nNewFlavors ); for( i = 0; i < nNewFlavors-1; i++ ) aTemp.getArray()[i+1] = rTypes.getConstArray()[i]; - aTemp.getArray()[0].MimeType = OUString::createFromAscii( "text/plain;charset=utf-16" ); + aTemp.getArray()[0].MimeType = OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16")); aTemp.getArray()[0].DataType = getCppuType( (OUString*)0 ); rTypes = aTemp; @@ -1435,7 +1418,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor > } { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); it = m_aSelections.find( selection ); if( it != m_aSelections.end() ) @@ -1462,7 +1445,6 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor > } #if OSL_DEBUG_LEVEL > 1 -// if( selection != m_nCLIPBOARDAtom ) { fprintf( stderr, "SelectionManager::getPasteDataTypes( %s ) = %s\n", OUStringToOString( getString( selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(), bSuccess ? "true" : "false" ); for( int i = 0; i < rTypes.getLength(); i++ ) @@ -1477,7 +1459,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor > PixmapHolder* SelectionManager::getPixmapHolder( Atom selection ) { - std::hash_map< Atom, Selection* >::const_iterator it = m_aSelections.find( selection ); + boost::unordered_map< Atom, Selection* >::const_iterator it = m_aSelections.find( selection ); if( it == m_aSelections.end() ) return NULL; if( ! it->second->m_pPixmap ) @@ -1497,7 +1479,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor, Atom property, Atom selection ) { - ResettableMutexGuard aGuard( m_aMutex ); + osl::ResettableMutexGuard aGuard( m_aMutex ); // handle targets related to image/bmp if( target == XA_COLORMAP || target == XA_PIXMAP || target == XA_BITMAP || target == XA_VISUALID ) @@ -1543,7 +1525,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor, try { Any aResult = - m_xBitmapConverter->invoke( OUString::createFromAscii( "convert-bitmap-depth" ), + m_xBitmapConverter->invoke( OUString(RTL_CONSTASCII_USTRINGPARAM("convert-bitmap-depth")), aArgs, aOutIndex, aOutArgs ); if( aResult >>= xBM ) aData = xBM->getDIB(); @@ -1599,10 +1581,10 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor, { #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "using INCR protocol\n" ); - std::hash_map< XLIB_Window, std::hash_map< Atom, IncrementalTransfer > >::const_iterator win_it = m_aIncrementals.find( requestor ); + boost::unordered_map< XLIB_Window, boost::unordered_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 ); + boost::unordered_map< Atom, IncrementalTransfer >::const_iterator inc_it = win_it->second.find( property ); if( inc_it != win_it->second.end() ) { const IncrementalTransfer& rInc = inc_it->second; @@ -1657,7 +1639,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor, bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest ) { - ResettableMutexGuard aGuard( m_aMutex ); + osl::ResettableMutexGuard aGuard( m_aMutex ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "handleSelectionRequest for selection %s and target %s\n", OUStringToOString( getString( rRequest.selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(), @@ -1811,6 +1793,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest fprintf( stderr, " \"%s\"", OUStringToOString( getString( pProps[i]), RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); XFree( pProps ); } + fprintf( stderr, "\n" ); } #endif } @@ -1865,7 +1848,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest bool SelectionManager::handleReceivePropertyNotify( XPropertyEvent& rNotify ) { - MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( m_aMutex ); // data we requested arrived #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "handleReceivePropertyNotify for property %s\n", @@ -1873,7 +1856,7 @@ bool SelectionManager::handleReceivePropertyNotify( XPropertyEvent& rNotify ) #endif bool bHandled = false; - ::std::hash_map< Atom, Selection* >::iterator it = + ::boost::unordered_map< Atom, Selection* >::iterator it = m_aSelections.find( rNotify.atom ); if( it != m_aSelections.end() && rNotify.state == PropertyNewValue && @@ -1984,7 +1967,7 @@ bool SelectionManager::handleReceivePropertyNotify( XPropertyEvent& rNotify ) bool SelectionManager::handleSendPropertyNotify( XPropertyEvent& rNotify ) { - MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( m_aMutex ); // ready for next part of a IncrementalTransfer #if OSL_DEBUG_LEVEL > 1 @@ -1998,13 +1981,13 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent& rNotify ) // feed incrementals if( rNotify.state == PropertyDelete ) { - std::hash_map< XLIB_Window, std::hash_map< Atom, IncrementalTransfer > >::iterator it; + boost::unordered_map< XLIB_Window, boost::unordered_map< Atom, IncrementalTransfer > >::iterator it; it = m_aIncrementals.find( rNotify.window ); if( it != m_aIncrementals.end() ) { bHandled = true; int nCurrentTime = time( NULL ); - std::hash_map< Atom, IncrementalTransfer >::iterator inc_it; + boost::unordered_map< Atom, IncrementalTransfer >::iterator inc_it; // throw out aborted transfers std::list< Atom > aTimeouts; for( inc_it = it->second.begin(); inc_it != it->second.end(); ++inc_it ) @@ -2084,14 +2067,14 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent& rNotify ) bool SelectionManager::handleSelectionNotify( XSelectionEvent& rNotify ) { - MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( m_aMutex ); bool bHandled = false; // notification about success/failure of one of our conversion requests #if OSL_DEBUG_LEVEL > 1 OUString aSelection( getString( rNotify.selection ) ); - OUString aProperty( OUString::createFromAscii( "None" ) ); + OUString aProperty(RTL_CONSTASCII_USTRINGPARAM("None")); if( rNotify.property ) aProperty = getString( rNotify.property ); fprintf( stderr, "handleSelectionNotify for selection %s and property %s (0x%lx)\n", @@ -2102,7 +2085,7 @@ bool SelectionManager::handleSelectionNotify( XSelectionEvent& rNotify ) if( rNotify.requestor != m_aWindow && rNotify.requestor != m_aCurrentDropWindow ) fprintf( stderr, "Warning: selection notify for unknown window 0x%lx\n", rNotify.requestor ); #endif - ::std::hash_map< Atom, Selection* >::iterator it = + ::boost::unordered_map< Atom, Selection* >::iterator it = m_aSelections.find( rNotify.selection ); if ( (rNotify.requestor == m_aWindow || rNotify.requestor == m_aCurrentDropWindow) && @@ -2177,7 +2160,7 @@ bool SelectionManager::handleSelectionNotify( XSelectionEvent& rNotify ) bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage ) { - ResettableMutexGuard aGuard(m_aMutex); + osl::ResettableMutexGuard aGuard(m_aMutex); // handle drop related events XLIB_Window aSource = rMessage.data.l[0]; @@ -2185,7 +2168,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage ) bool bHandled = false; - ::std::hash_map< XLIB_Window, DropTargetEntry >::iterator it = + ::boost::unordered_map< XLIB_Window, DropTargetEntry >::iterator it = m_aDropTargets.find( aTarget ); #if OSL_DEBUG_LEVEL > 1 @@ -2210,7 +2193,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage ) m_bDropWaitingForCompletion && m_aDropEnterEvent.data.l[0] ) { bHandled = true; - OSL_ENSURE( 0, "someone forgot to call dropComplete ?" ); + OSL_FAIL( "someone forgot to call dropComplete ?" ); // some listener forgot to call dropComplete in the last operation // let us end it now and accept the new enter event aGuard.clear(); @@ -2359,7 +2342,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage ) void SelectionManager::dropComplete( sal_Bool bSuccess, XLIB_Window aDropWindow, XLIB_Time ) { - ClearableMutexGuard aGuard(m_aMutex); + osl::ClearableMutexGuard aGuard(m_aMutex); if( aDropWindow == m_aCurrentDropWindow ) { @@ -2416,7 +2399,7 @@ void SelectionManager::dropComplete( sal_Bool bSuccess, XLIB_Window aDropWindow, m_bDropWaitingForCompletion = false; } else - OSL_ASSERT( "dropComplete from invalid DropTargetDropContext" ); + OSL_FAIL( "dropComplete from invalid DropTargetDropContext" ); } /* @@ -2427,7 +2410,7 @@ void SelectionManager::dropComplete( sal_Bool bSuccess, XLIB_Window aDropWindow, void SelectionManager::sendDragStatus( Atom nDropAction ) { - ClearableMutexGuard aGuard(m_aMutex); + osl::ClearableMutexGuard aGuard(m_aMutex); if( m_xDragSourceListener.is() ) { @@ -2556,12 +2539,12 @@ bool SelectionManager::updateDragAction( int modifierState ) void SelectionManager::sendDropPosition( bool bForce, XLIB_Time eventTime ) { - ClearableMutexGuard aGuard(m_aMutex); + osl::ClearableMutexGuard aGuard(m_aMutex); if( m_bDropSent ) return; - ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it = + ::boost::unordered_map< XLIB_Window, DropTargetEntry >::const_iterator it = m_aDropTargets.find( m_aDropWindow ); if( it != m_aDropTargets.end() ) { @@ -2619,12 +2602,12 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage ) if( ! m_xDragSourceListener.is() ) return false; - ResettableMutexGuard aGuard(m_aMutex); + osl::ResettableMutexGuard aGuard(m_aMutex); bool bHandled = false; // for shortcut - ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it = + ::boost::unordered_map< XLIB_Window, DropTargetEntry >::const_iterator it = m_aDropTargets.find( m_aDropWindow ); #if OSL_DEBUG_LEVEL > 1 switch( rMessage.type ) @@ -2633,7 +2616,6 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage ) fprintf( stderr, "handleDragEvent: %s\n", OUStringToOString( getString( rMessage.xclient.message_type ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); break; case MotionNotify: -// fprintf( stderr, "handleDragEvent: MotionNotify\n" ); break; case EnterNotify: fprintf( stderr, "handleDragEvent: EnterNotify\n" ); @@ -3076,7 +3058,7 @@ int SelectionManager::getXdndVersion( XLIB_Window aWindow, XLIB_Window& rProxy ) void SelectionManager::updateDragWindow( int nX, int nY, XLIB_Window aRoot ) { - ResettableMutexGuard aGuard( m_aMutex ); + osl::ResettableMutexGuard aGuard( m_aMutex ); css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); @@ -3126,7 +3108,7 @@ void SelectionManager::updateDragWindow( int nX, int nY, XLIB_Window aRoot ) dsde.DropAction = nNewProtocolVersion >= 0 ? m_nUserDragAction : DNDConstants::ACTION_COPY; dsde.UserAction = nNewProtocolVersion >= 0 ? m_nUserDragAction : DNDConstants::ACTION_COPY; - ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it; + ::boost::unordered_map< XLIB_Window, DropTargetEntry >::const_iterator it; if( aNewCurrentWindow != m_aDropWindow ) { #if OSL_DEBUG_LEVEL > 1 @@ -3271,7 +3253,7 @@ void SelectionManager::startDrag( SalFrame* pCaptureFrame = NULL; { - ClearableMutexGuard aGuard(m_aMutex); + osl::ClearableMutexGuard aGuard(m_aMutex); // first get the current pointer position and the window that // the pointer is located in. since said window should be one @@ -3281,7 +3263,7 @@ void SelectionManager::startDrag( int root_x, root_y, win_x, win_y; unsigned int mask; - ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it; + ::boost::unordered_map< XLIB_Window, DropTargetEntry >::const_iterator it; it = m_aDropTargets.begin(); while( it != m_aDropTargets.end() ) { @@ -3347,7 +3329,7 @@ void SelectionManager::startDrag( */ if( nPointerGrabSuccess != GrabSuccess ) { - vos::IMutex& rSolarMutex( Application::GetSolarMutex() ); + osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); if( rSolarMutex.tryToAcquire() ) { pCaptureFrame = GetX11SalData()->GetDisplay()->GetCaptureFrame(); @@ -3388,12 +3370,12 @@ void SelectionManager::startDrag( listener->dragDropEnd( aDragFailedEvent ); if( pCaptureFrame ) { - vos::IMutex& rSolarMutex( Application::GetSolarMutex() ); + osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); if( rSolarMutex.tryToAcquire() ) GetX11SalData()->GetDisplay()->CaptureMouse( pCaptureFrame ); #if OSL_DEBUG_LEVEL > 0 else - OSL_ENSURE( 0, "failed to acquire SolarMutex to reset capture frame" ); + OSL_FAIL( "failed to acquire SolarMutex to reset capture frame" ); #endif } return; @@ -3477,12 +3459,12 @@ void SelectionManager::startDrag( if( pCaptureFrame ) { - vos::IMutex& rSolarMutex( Application::GetSolarMutex() ); + osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); if( rSolarMutex.tryToAcquire() ) GetX11SalData()->GetDisplay()->CaptureMouse( pCaptureFrame ); #if OSL_DEBUG_LEVEL > 0 else - OSL_ENSURE( 0, "failed to acquire SolarMutex to reset capture frame" ); + OSL_FAIL( "failed to acquire SolarMutex to reset capture frame" ); #endif } @@ -3521,7 +3503,7 @@ void SelectionManager::dragDoDispatch() fprintf( stderr, "end executeDrag dispatching\n" ); #endif { - ClearableMutexGuard aGuard(m_aMutex); + osl::ClearableMutexGuard aGuard(m_aMutex); css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); css::uno::Reference< XTransferable > xTransferable( m_xDragSourceTransferable ); @@ -3581,7 +3563,7 @@ sal_Int32 SelectionManager::getCurrentCursor() void SelectionManager::setCursor( sal_Int32 cursor, XLIB_Window aDropWindow, XLIB_Time ) { - MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( m_aMutex ); if( aDropWindow == m_aDropWindow && XLIB_Cursor(cursor) != m_aCurrentCursor ) { if( m_xDragSourceListener.is() && ! m_bDropSent ) @@ -3603,7 +3585,7 @@ void SelectionManager::setImage( sal_Int32, XLIB_Window, XLIB_Time ) void SelectionManager::transferablesFlavorsChanged() { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); m_aDragFlavors = m_xDragSourceTransferable->getTransferDataFlavors(); int i; @@ -3661,7 +3643,7 @@ bool SelectionManager::handleXEvent( XEvent& rEvent ) * to get client messages it is essential not to dispatch * events twice that we get on both connections * - * #95201# between dispatching ButtonPress and startDrag + * between dispatching ButtonPress and startDrag * the user can already have released the mouse. The ButtonRelease * will then be dispatched in VCLs queue and never turn up here. * Which is not so good, since startDrag will XGrabPointer and @@ -3679,14 +3661,14 @@ bool SelectionManager::handleXEvent( XEvent& rEvent ) { case SelectionClear: { - ClearableMutexGuard aGuard(m_aMutex); + osl::ClearableMutexGuard aGuard(m_aMutex); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "SelectionClear for selection %s\n", OUStringToOString( getString( rEvent.xselectionclear.selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); #endif SelectionAdaptor* pAdaptor = getAdaptor( rEvent.xselectionclear.selection ); - std::hash_map< Atom, Selection* >::iterator it( m_aSelections.find( rEvent.xselectionclear.selection ) ); + boost::unordered_map< Atom, Selection* >::iterator it( m_aSelections.find( rEvent.xselectionclear.selection ) ); if( it != m_aSelections.end() ) it->second->m_bOwner = false; aGuard.clear(); @@ -3742,41 +3724,29 @@ bool SelectionManager::handleXEvent( XEvent& rEvent ) void SelectionManager::dispatchEvent( int millisec ) { - pollfd aPollFD; - XEvent event; - - // query socket handle to poll on - aPollFD.fd = ConnectionNumber( m_pDisplay ); - aPollFD.events = POLLIN; - aPollFD.revents = 0; - - // wait for activity (outside the xlib) - if( poll( &aPollFD, 1, millisec ) > 0 ) + // acquire the mutex to prevent other threads + // from using the same X connection + osl::ResettableMutexGuard aGuard(m_aMutex); + + if( !XPending( m_pDisplay )) + { // wait for any events if none are already queued + pollfd aPollFD; + aPollFD.fd = XConnectionNumber( m_pDisplay ); + aPollFD.events = POLLIN; + aPollFD.revents = 0; + // release mutex for the time of waiting for possible data + aGuard.clear(); + if( poll( &aPollFD, 1, millisec ) <= 0 ) + return; + aGuard.reset(); + } + while( XPending( m_pDisplay )) { - // now acquire the mutex to prevent other threads - // from using the same X connection - ResettableMutexGuard aGuard(m_aMutex); - - // prevent that another thread already ate the input - // this can happen if e.g. another thread does - // an X request getting a response. the response - // would be removed from the queue and we would end up - // with an empty socket here - if( poll( &aPollFD, 1, 0 ) > 0 ) - { - int nPending = 1; - while( nPending ) - { - nPending = XPending( m_pDisplay ); - if( nPending ) - { - XNextEvent( m_pDisplay, &event ); - aGuard.clear(); - handleXEvent( event ); - aGuard.reset(); - } - } - } + XEvent event; + XNextEvent( m_pDisplay, &event ); + aGuard.clear(); + handleXEvent( event ); + aGuard.reset(); } } @@ -3797,9 +3767,9 @@ void SelectionManager::run( void* pThis ) css::uno::Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); if( xFact.is() ) { - css::uno::Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY ); - if( xDesktop.is() ) - xDesktop->addTerminateListener(This); + This->m_xDesktop.set(xFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY); + if (This->m_xDesktop.is()) + This->m_xDesktop->addTerminateListener(This); } while( osl_scheduleThread(This->m_aThread) ) @@ -3811,10 +3781,10 @@ void SelectionManager::run( void* pThis ) if( (aNow.tv_sec - aLast.tv_sec) > 0 ) { - ClearableMutexGuard aGuard(This->m_aMutex); + osl::ClearableMutexGuard aGuard(This->m_aMutex); std::list< std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > > > aChangeList; - for( std::hash_map< Atom, Selection* >::iterator it = This->m_aSelections.begin(); it != This->m_aSelections.end(); ++it ) + for( boost::unordered_map< Atom, Selection* >::iterator it = This->m_aSelections.begin(); it != This->m_aSelections.end(); ++it ) { if( it->first != This->m_nXdndSelection && ! it->second->m_bOwner ) { @@ -3844,12 +3814,22 @@ void SelectionManager::run( void* pThis ) void SelectionManager::shutdown() throw() { - ResettableMutexGuard aGuard(m_aMutex); + #if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "SelectionManager got app termination event\n" ); + #endif + + osl::ResettableMutexGuard aGuard(m_aMutex); + if( m_bShutDown ) - { return; - } m_bShutDown = true; + + if ( m_xDesktop.is() ) + m_xDesktop->removeTerminateListener(this); + + if( m_xDisplayConnection.is() ) + m_xDisplayConnection->removeEventHandler(Any(), this); + // stop dispatching if( m_aThread ) { @@ -3872,7 +3852,7 @@ void SelectionManager::shutdown() throw() aGuard.clear(); while (osl_isThreadRunning(m_aThread)) { - vos::OGuard guard2(Application::GetSolarMutex()); + SolarMutexGuard guard2; Application::Reschedule(); } osl_joinWithThread( m_aThread ); @@ -3880,8 +3860,9 @@ void SelectionManager::shutdown() throw() m_aThread = NULL; aGuard.reset(); } - m_xDisplayConnection->removeEventHandler( Any(), this ); + m_xDesktop.clear(); m_xDisplayConnection.clear(); + m_xDropTransferable.clear(); } // ------------------------------------------------------------------------ @@ -3904,7 +3885,7 @@ sal_Bool SelectionManager::handleEvent( const Any& event ) throw() if( nTimestamp != CurrentTime ) { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); m_nSelectionTimestamp = nTimestamp; } @@ -3921,9 +3902,11 @@ sal_Bool SelectionManager::handleEvent( const Any& event ) throw() return sal_True; } -void SAL_CALL SelectionManager::disposing( const ::com::sun::star::lang::EventObject& ) +void SAL_CALL SelectionManager::disposing( const ::com::sun::star::lang::EventObject& rEvt ) throw( ::com::sun::star::uno::RuntimeException ) { + if (rEvt.Source == m_xDesktop || rEvt.Source == m_xDisplayConnection) + shutdown(); } void SAL_CALL SelectionManager::queryTermination( const ::com::sun::star::lang::EventObject& ) @@ -3939,20 +3922,14 @@ void SAL_CALL SelectionManager::queryTermination( const ::com::sun::star::lang:: void SAL_CALL SelectionManager::notifyTermination( const ::com::sun::star::lang::EventObject& rEvent ) throw( ::com::sun::star::uno::RuntimeException ) { - css::uno::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(); + disposing(rEvent); } // ------------------------------------------------------------------------ void SelectionManager::registerHandler( Atom selection, SelectionAdaptor& rAdaptor ) { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); Selection* pNewSelection = new Selection(); pNewSelection->m_pAdaptor = &rAdaptor; @@ -3964,9 +3941,9 @@ void SelectionManager::registerHandler( Atom selection, SelectionAdaptor& rAdapt void SelectionManager::deregisterHandler( Atom selection ) { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); - ::std::hash_map< Atom, Selection* >::iterator it = + ::boost::unordered_map< Atom, Selection* >::iterator it = m_aSelections.find( selection ); if( it != m_aSelections.end() ) { @@ -3992,13 +3969,13 @@ extern "C" void SelectionManager::registerDropTarget( XLIB_Window aWindow, DropTarget* pTarget ) { - MutexGuard aGuard(m_aMutex); + osl::MutexGuard aGuard(m_aMutex); // sanity check - ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it = + ::boost::unordered_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" ); + OSL_FAIL( "attempt to register window as drop target twice" ); else if( aWindow && m_pDisplay ) { DropTargetEntry aEntry( pTarget ); @@ -4029,20 +4006,20 @@ void SelectionManager::registerDropTarget( XLIB_Window aWindow, DropTarget* pTar m_aDropTargets[ aWindow ] = aEntry; } else - OSL_ASSERT( "attempt to register None as drop target" ); + OSL_FAIL( "attempt to register None as drop target" ); } // ------------------------------------------------------------------------ void SelectionManager::deregisterDropTarget( XLIB_Window aWindow ) { - ClearableMutexGuard aGuard(m_aMutex); + osl::ClearableMutexGuard aGuard(m_aMutex); m_aDropTargets.erase( aWindow ); if( aWindow == m_aDragSourceWindow && m_aDragRunning.check() ) { // abort drag - std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it = + boost::unordered_map< XLIB_Window, DropTargetEntry >::const_iterator it = m_aDropTargets.find( m_aDropWindow ); if( it != m_aDropTargets.end() ) { @@ -4189,7 +4166,7 @@ void SelectionManagerHolder::startDrag( OUString SelectionManagerHolder::getImplementationName() throw() { - return OUString::createFromAscii(XDND_IMPLEMENTATION_NAME); + return OUString(RTL_CONSTASCII_USTRINGPARAM(XDND_IMPLEMENTATION_NAME)); } // ------------------------------------------------------------------------ @@ -4215,3 +4192,4 @@ Sequence< OUString > SelectionManagerHolder::getSupportedServiceNames() throw() // ------------------------------------------------------------------------ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/X11_selection.hxx b/vcl/unx/generic/dtrans/X11_selection.hxx index 34a50819bfed..ad02ca36c2c1 100644 --- a/vcl/unx/generic/dtrans/X11_selection.hxx +++ b/vcl/unx/generic/dtrans/X11_selection.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,11 +41,9 @@ #include <com/sun/star/frame/XDesktop.hpp> #include <osl/thread.h> -#ifndef _OSL_CONDITION_HXX_ #include <osl/conditn.hxx> -#endif -#include <hash_map> +#include <boost/unordered_map.hpp> #include <list> #include "tools/prex.h" @@ -164,7 +163,7 @@ namespace x11 { >, public SelectionAdaptor { - static ::std::hash_map< ::rtl::OUString, SelectionManager*, ::rtl::OUStringHash >& getInstances(); + static ::boost::unordered_map< ::rtl::OUString, SelectionManager*, ::rtl::OUStringHash >& getInstances(); // for INCR type selection transfer // INCR protocol is used if the data cannot @@ -260,6 +259,7 @@ namespace x11 { oslThread m_aDragExecuteThread; ::osl::Condition m_aDragRunning; XLIB_Window m_aWindow; + com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop; com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection > m_xDisplayConnection; com::sun::star::uno::Reference< com::sun::star::script::XInvocation > @@ -336,7 +336,7 @@ namespace x11 { // drag and drop int m_nCurrentProtocolVersion; - ::std::hash_map< XLIB_Window, DropTargetEntry > + ::boost::unordered_map< XLIB_Window, DropTargetEntry > m_aDropTargets; @@ -367,16 +367,16 @@ namespace x11 { Atom m_nXdndActionPrivate; // caching for atoms - ::std::hash_map< Atom, ::rtl::OUString > + ::boost::unordered_map< Atom, ::rtl::OUString > m_aAtomToString; - ::std::hash_map< ::rtl::OUString, Atom, ::rtl::OUStringHash > + ::boost::unordered_map< ::rtl::OUString, Atom, ::rtl::OUStringHash > m_aStringToAtom; // the registered selections - ::std::hash_map< Atom, Selection* > + ::boost::unordered_map< Atom, Selection* > m_aSelections; // IncrementalTransfers in progress - std::hash_map< XLIB_Window, std::hash_map< Atom, IncrementalTransfer > > + boost::unordered_map< XLIB_Window, boost::unordered_map< Atom, IncrementalTransfer > > m_aIncrementals; // do not use X11 multithreading capabilities @@ -404,7 +404,7 @@ namespace x11 { void sendDropPosition( bool bForce, XLIB_Time eventXLIB_Time ); bool updateDragAction( int modifierState ); 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 ); + XLIB_Cursor createCursor( const unsigned char* pPointerData, const unsigned char* pMaskData, int width, int height, int hotX, int hotY ); // coordinates on root XLIB_Window void updateDragWindow( int nX, int nY, XLIB_Window aRoot ); @@ -530,3 +530,5 @@ namespace x11 { } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/X11_service.cxx b/vcl/unx/generic/dtrans/X11_service.cxx index fa7fc6a65589..bdfdd4bb7a91 100644 --- a/vcl/unx/generic/dtrans/X11_service.cxx +++ b/vcl/unx/generic/dtrans/X11_service.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,31 +46,32 @@ namespace css = com::sun::star; } -using namespace rtl; using namespace cppu; using namespace com::sun::star::lang; using namespace com::sun::star::datatransfer::clipboard; using namespace com::sun::star::awt; using namespace x11; +using ::rtl::OUString; + Sequence< OUString > SAL_CALL x11::X11Clipboard_getSupportedServiceNames() { Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard"); + aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard")); return aRet; } Sequence< OUString > SAL_CALL x11::Xdnd_getSupportedServiceNames() { Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DragSource"); + aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.X11DragSource")); return aRet; } Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames() { Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DropTarget"); + aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.X11DropTarget")); return aRet; } @@ -77,7 +79,7 @@ Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames() css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments ) { - static std::hash_map< OUString, ::std::hash_map< Atom, css::uno::Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances; + static boost::unordered_map< OUString, ::boost::unordered_map< Atom, Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances; OUString aDisplayName; Atom nSelection; @@ -110,11 +112,11 @@ css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequenc else { // default atom is clipboard selection - nSelection = rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ); + nSelection = rManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ); } - ::std::hash_map< Atom, css::uno::Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] ); - ::std::hash_map< Atom, css::uno::Reference< XClipboard > >::iterator it = rMap.find( nSelection ); + ::boost::unordered_map< Atom, css::uno::Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] ); + ::boost::unordered_map< Atom, css::uno::Reference< XClipboard > >::iterator it = rMap.find( nSelection ); if( it != rMap.end() ) return it->second; @@ -139,3 +141,4 @@ css::uno::Reference< XInterface > X11SalInstance::CreateDropTarget() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/X11_transferable.cxx b/vcl/unx/generic/dtrans/X11_transferable.cxx index 16518f0b2864..fa4629f1c0f2 100644 --- a/vcl/unx/generic/dtrans/X11_transferable.cxx +++ b/vcl/unx/generic/dtrans/X11_transferable.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,19 +43,17 @@ using namespace com::sun::star::io; using namespace com::sun::star::uno; using namespace cppu; using namespace osl; -using namespace rtl; - using namespace x11; +using ::rtl::OUString; + X11Transferable::X11Transferable( SelectionManager& rManager, - const Reference< XInterface >& xCreator, Atom selection ) : m_rManager( rManager ), - m_xCreator( xCreator ), m_aSelection( selection ) { } @@ -74,13 +73,13 @@ Any SAL_CALL X11Transferable::getTransferData( const DataFlavor& rFlavor ) Sequence< sal_Int8 > aData; bool bSuccess = m_rManager.getPasteData( m_aSelection ? m_aSelection : XA_PRIMARY, rFlavor.MimeType, aData ); if( ! bSuccess && m_aSelection == 0 ) - bSuccess = m_rManager.getPasteData( m_rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ), rFlavor.MimeType, aData ); + bSuccess = m_rManager.getPasteData( m_rManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ), rFlavor.MimeType, aData ); if( ! bSuccess ) { throw UnsupportedFlavorException( rFlavor.MimeType, static_cast < XTransferable * > ( this ) ); } - if( rFlavor.MimeType.equalsIgnoreAsciiCase( OUString::createFromAscii( "text/plain;charset=utf-16" ) ) ) + if( rFlavor.MimeType.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16")) ) ) { int nLen = aData.getLength()/2; if( ((sal_Unicode*)aData.getConstArray())[nLen-1] == 0 ) @@ -106,7 +105,7 @@ Sequence< DataFlavor > SAL_CALL X11Transferable::getTransferDataFlavors() Sequence< DataFlavor > aFlavorList; bool bSuccess = m_rManager.getPasteDataTypes( m_aSelection ? m_aSelection : XA_PRIMARY, aFlavorList ); if( ! bSuccess && m_aSelection == 0 ) - bSuccess = m_rManager.getPasteDataTypes( m_rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ), aFlavorList ); + bSuccess = m_rManager.getPasteDataTypes( m_rManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ), aFlavorList ); return aFlavorList; } @@ -118,7 +117,7 @@ sal_Bool SAL_CALL X11Transferable::isDataFlavorSupported( const DataFlavor& aFla { if( aFlavor.DataType != getCppuType( (Sequence< sal_Int8 >*)0 ) ) { - if( ! aFlavor.MimeType.equalsIgnoreAsciiCase( OUString::createFromAscii( "text/plain;charset=utf-16" ) ) && + if( ! aFlavor.MimeType.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16")) ) && aFlavor.DataType == getCppuType( (OUString*)0 ) ) return false; } @@ -132,3 +131,4 @@ sal_Bool SAL_CALL X11Transferable::isDataFlavorSupported( const DataFlavor& aFla return sal_False; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/X11_transferable.hxx b/vcl/unx/generic/dtrans/X11_transferable.hxx index 65f7d1fdc475..9eb4efba8dfc 100644 --- a/vcl/unx/generic/dtrans/X11_transferable.hxx +++ b/vcl/unx/generic/dtrans/X11_transferable.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,7 @@ #include <X11_selection.hxx> #include <com/sun/star/datatransfer/XTransferable.hpp> -#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HDL_ #include <com/sun/star/lang/XEventListener.hpp> -#endif #include <cppuhelper/implbase1.hxx> namespace x11 { @@ -44,10 +43,9 @@ namespace x11 { ::osl::Mutex m_aMutex; SelectionManager& m_rManager; - com::sun::star::uno::Reference< XInterface > m_xCreator; Atom m_aSelection; public: - X11Transferable( SelectionManager& rManager, const com::sun::star::uno::Reference< XInterface >& xCreator, Atom selection = None ); + X11Transferable( SelectionManager& rManager, Atom selection = None ); virtual ~X11Transferable(); /* @@ -70,3 +68,5 @@ namespace x11 { } // namespace #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/bmp.cxx b/vcl/unx/generic/dtrans/bmp.cxx index 1ccd04eba725..57ad8ecf8a4d 100644 --- a/vcl/unx/generic/dtrans/bmp.cxx +++ b/vcl/unx/generic/dtrans/bmp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,12 +36,12 @@ #include <bmp.hxx> #include <X11_selection.hxx> +#include <sal/macros.h> using namespace x11; using namespace com::sun::star::uno; using namespace com::sun::star::script; using namespace com::sun::star::awt; -using namespace rtl; /* * helper functions @@ -423,7 +424,7 @@ PixmapHolder::PixmapHolder( Display* pDisplay ) : { "StaticGray", "GrayScale", "StaticColor", "PseudoColor", "TrueColor", "DirectColor" }; fprintf( stderr, "PixmapHolder visual: id = 0x%lx, class = %s (%d), depth=%d; color map = 0x%lx\n", m_aInfo.visualid, - (m_aInfo.c_class >= 0 && unsigned(m_aInfo.c_class) < sizeof(pClasses)/sizeof(pClasses[0])) ? pClasses[m_aInfo.c_class] : "<unknown>", + (m_aInfo.c_class >= 0 && unsigned(m_aInfo.c_class) < SAL_N_ELEMENTS(pClasses)) ? pClasses[m_aInfo.c_class] : "<unknown>", m_aInfo.c_class, m_aInfo.depth, m_aColormap ); @@ -737,3 +738,5 @@ Pixmap PixmapHolder::setBitmapData( const sal_uInt8* pData ) return m_aPixmap; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/bmp.hxx b/vcl/unx/generic/dtrans/bmp.hxx index b59b4417ca69..6d2e76bae0bb 100644 --- a/vcl/unx/generic/dtrans/bmp.hxx +++ b/vcl/unx/generic/dtrans/bmp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -103,3 +104,5 @@ public: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/config.cxx b/vcl/unx/generic/dtrans/config.cxx index 001da3900bb7..5f711da47434 100644 --- a/vcl/unx/generic/dtrans/config.cxx +++ b/vcl/unx/generic/dtrans/config.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,9 +57,10 @@ public: using namespace com::sun::star::lang; using namespace com::sun::star::uno; -using namespace rtl; using namespace x11; +using ::rtl::OUString; + sal_Int32 SelectionManager::getSelectionTimeout() { if( m_nSelectionTimeout < 1 ) @@ -66,7 +68,7 @@ sal_Int32 SelectionManager::getSelectionTimeout() DtransX11ConfigItem aCfg; m_nSelectionTimeout = aCfg.getSelectionTimeout(); #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "initialized selection timeout to %ld seconds\n", m_nSelectionTimeout ); + fprintf( stderr, "initialized selection timeout to %" SAL_PRIdINT32 " seconds\n", m_nSelectionTimeout ); #endif } return m_nSelectionTimeout; @@ -87,7 +89,7 @@ DtransX11ConfigItem::DtransX11ConfigItem() : aKeys.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SELECTION_PROPERTY ) ); Sequence< Any > aValues = GetProperties( aKeys ); #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "found %ld properties for %s\n", aValues.getLength(), SELECTION_PROPERTY ); + fprintf( stderr, "found %" SAL_PRIdINT32 " properties for %s\n", aValues.getLength(), SELECTION_PROPERTY ); #endif Any* pValue = aValues.getArray(); for( int i = 0; i < aValues.getLength(); i++, pValue++ ) @@ -146,3 +148,4 @@ void DtransX11ConfigItem::Notify( const Sequence< OUString >& /*rPropertyNames*/ } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/copydata_curs.h b/vcl/unx/generic/dtrans/copydata_curs.h index e3d0e3e76530..a882a541a6d7 100644 --- a/vcl/unx/generic/dtrans/copydata_curs.h +++ b/vcl/unx/generic/dtrans/copydata_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copydata_curs_height 32 #define copydata_curs_x_hot 1 #define copydata_curs_y_hot 1 -static char copydata_curs_bits[] = { +static unsigned char copydata_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copydata_curs_bits[] = { 0xa8, 0xf2, 0x1e, 0x00, 0x50, 0x35, 0x18, 0x00, 0x00, 0xf0, 0x1e, 0x00, 0x00, 0xf0, 0x1e, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/copydata_mask.h b/vcl/unx/generic/dtrans/copydata_mask.h index f25b0863d807..9cd73b08d106 100644 --- a/vcl/unx/generic/dtrans/copydata_mask.h +++ b/vcl/unx/generic/dtrans/copydata_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define copydata_mask_height 32 #define copydata_mask_x_hot 1 #define copydata_mask_y_hot 1 -static char copydata_mask_bits[] = { +static unsigned char copydata_mask_bits[] = { 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, @@ -40,3 +41,5 @@ static char copydata_mask_bits[] = { 0xfc, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/linkdata_curs.h b/vcl/unx/generic/dtrans/linkdata_curs.h index c60edc3b99d0..054ef55ef2bb 100644 --- a/vcl/unx/generic/dtrans/linkdata_curs.h +++ b/vcl/unx/generic/dtrans/linkdata_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define linkdata_curs_height 32 #define linkdata_curs_x_hot 1 #define linkdata_curs_y_hot 1 -static char linkdata_curs_bits[] = { +static unsigned char linkdata_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, @@ -40,3 +41,5 @@ static char linkdata_curs_bits[] = { 0xa8, 0x72, 0x18, 0x00, 0x50, 0x35, 0x1a, 0x00, 0x00, 0x30, 0x1f, 0x00, 0x00, 0xb0, 0x1f, 0x00, 0x00, 0x70, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/linkdata_mask.h b/vcl/unx/generic/dtrans/linkdata_mask.h index cf0f89f63b1b..429c603066dc 100644 --- a/vcl/unx/generic/dtrans/linkdata_mask.h +++ b/vcl/unx/generic/dtrans/linkdata_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define linkdata_mask_height 32 #define linkdata_mask_x_hot 1 #define linkdata_mask_y_hot 1 -static char linkdata_mask_bits[] = { +static unsigned char linkdata_mask_bits[] = { 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, @@ -40,3 +41,5 @@ static char linkdata_mask_bits[] = { 0xfc, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/movedata_curs.h b/vcl/unx/generic/dtrans/movedata_curs.h index b79412bc3f41..642bbd176e4b 100644 --- a/vcl/unx/generic/dtrans/movedata_curs.h +++ b/vcl/unx/generic/dtrans/movedata_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movedata_curs_height 32 #define movedata_curs_x_hot 1 #define movedata_curs_y_hot 1 -static char movedata_curs_bits[] = { +static unsigned char movedata_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, @@ -40,3 +41,5 @@ static char movedata_curs_bits[] = { 0xa8, 0xaa, 0x00, 0x00, 0x50, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/movedata_mask.h b/vcl/unx/generic/dtrans/movedata_mask.h index e25d0837d8dc..f06c80f1728c 100644 --- a/vcl/unx/generic/dtrans/movedata_mask.h +++ b/vcl/unx/generic/dtrans/movedata_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define movedata_mask_height 32 #define movedata_mask_x_hot 1 #define movedata_mask_y_hot 1 -static char movedata_mask_bits[] = { +static unsigned char movedata_mask_bits[] = { 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, @@ -40,3 +41,5 @@ static char movedata_mask_bits[] = { 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/nodrop_curs.h b/vcl/unx/generic/dtrans/nodrop_curs.h index 8e208e32f293..5c501d3876c4 100644 --- a/vcl/unx/generic/dtrans/nodrop_curs.h +++ b/vcl/unx/generic/dtrans/nodrop_curs.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define nodrop_curs_height 32 #define nodrop_curs_x_hot 9 #define nodrop_curs_y_hot 9 -static char nodrop_curs_bits[] = { +static unsigned char nodrop_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x7c, 0xf8, 0x00, 0x00, 0x1c, 0xfc, 0x00, 0x00, 0x1e, 0xfe, 0x01, 0x00, 0x0e, 0xdf, 0x01, 0x00, 0x8e, 0xcf, 0x01, 0x00, @@ -40,3 +41,5 @@ static char nodrop_curs_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/nodrop_mask.h b/vcl/unx/generic/dtrans/nodrop_mask.h index 7cbecef2c60f..bd315dc28df1 100644 --- a/vcl/unx/generic/dtrans/nodrop_mask.h +++ b/vcl/unx/generic/dtrans/nodrop_mask.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #define nodrop_mask_height 32 #define nodrop_mask_x_hot 9 #define nodrop_mask_y_hot 9 -static char nodrop_mask_bits[] = { +static unsigned char nodrop_mask_bits[] = { 0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0xfc, 0xff, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x7e, 0xfe, 0x01, 0x00, 0x3f, 0xff, 0x03, 0x00, 0x9f, 0xff, 0x03, 0x00, 0xdf, 0xff, 0x03, 0x00, @@ -40,3 +41,5 @@ static char nodrop_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/fontmanager/Makefile b/vcl/unx/generic/fontmanager/Makefile new file mode 100644 index 000000000000..7fb7b0325aea --- /dev/null +++ b/vcl/unx/generic/fontmanager/Makefile @@ -0,0 +1,32 @@ +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Bjoern Michaelsen <bjoern.michaelsen@canonical.com> (Canonical Ltd.) +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Contributor(s): Jan Holesovsky <kendy@suse.cz> +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +all : afm_hash.hpp + +afm_hash.hpp : $(realpath $(dir $(firstword $(MAKEFILE_LIST))))/afm_keyword_list + $(GPERF) -C -t -l -L C++ -m 20 -Z AfmKeywordHash -k '1,4,6,$$' $< | sed -e "s/(char\*)0/(char\*)0, NOPE/g" | grep -v "^#line" > $@ + +.PHONY : all +# vim: set noet sw=4: diff --git a/vcl/unx/generic/fontmanager/afm_hash.cpp b/vcl/unx/generic/fontmanager/afm_hash.cpp deleted file mode 100755 index de01d8cd0434..000000000000 --- a/vcl/unx/generic/fontmanager/afm_hash.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/* C++ code produced by gperf version 3.0.1 */ -/* Command-line: gperf -C -t -l -L C++ -m 20 -Z AfmKeywordHash afm_keyword_list */ -/* Computed positions: -k'1,4,6,$' */ - -#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ - && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ - && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ - && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ - && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ - && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ - && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ - && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ - && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ - && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ - && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ - && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ - && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ - && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ - && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ - && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ - && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ - && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ - && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ - && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ - && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ - && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ - && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) -/* The character set is not based on ISO-646. */ -#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." -#endif - -#line 1 "afm_keyword_list" -struct hash_entry { const char* name; enum parseKey eKey; }; - -#define TOTAL_KEYWORDS 56 -#define MIN_WORD_LENGTH 1 -#define MAX_WORD_LENGTH 18 -#define MIN_HASH_VALUE 1 -#define MAX_HASH_VALUE 57 -/* maximum key range = 57, duplicates = 0 */ - -class AfmKeywordHash -{ -private: - static inline unsigned int hash (const char *str, unsigned int len); -public: - static const struct hash_entry *in_word_set (const char *str, unsigned int len); -}; - -inline unsigned int -AfmKeywordHash::hash (register const char *str, register unsigned int len) -{ - static const unsigned char asso_values[] = - { - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 28, 1, 0, 9, 0, - 19, 58, 2, 10, 58, 0, 28, 0, 20, 58, - 44, 58, 58, 0, 16, 10, 24, 2, 3, 58, - 58, 58, 58, 58, 58, 58, 58, 6, 58, 0, - 19, 0, 58, 25, 14, 6, 58, 58, 17, 11, - 0, 17, 39, 58, 0, 0, 10, 58, 58, 58, - 13, 4, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58 - }; - register int hval = len; - - switch (hval) - { - default: - hval += asso_values[(unsigned char)str[5]]; - /*FALLTHROUGH*/ - case 5: - case 4: - hval += asso_values[(unsigned char)str[3]]; - /*FALLTHROUGH*/ - case 3: - case 2: - case 1: - hval += asso_values[(unsigned char)str[0]]; - break; - } - return hval + asso_values[(unsigned char)str[len - 1]]; -} - -const struct hash_entry * -AfmKeywordHash::in_word_set (register const char *str, register unsigned int len) -{ - static const unsigned char lengthtable[] = - { - 0, 1, 2, 1, 2, 1, 3, 2, 3, 5, 10, 11, 12, 2, - 14, 15, 16, 11, 9, 13, 14, 12, 12, 14, 13, 9, 7, 9, - 7, 9, 14, 5, 6, 14, 12, 16, 10, 14, 11, 10, 7, 1, - 12, 8, 17, 18, 2, 3, 7, 1, 8, 8, 13, 6, 6, 8, - 0, 1 - }; - static const struct hash_entry wordlist[] = - { - {"",NOPE}, -#line 6 "afm_keyword_list" - {"C",CODE}, -#line 7 "afm_keyword_list" - {"CC",COMPCHAR}, -#line 5 "afm_keyword_list" - {"B",CHARBBOX}, -#line 8 "afm_keyword_list" - {"CH",CODEHEX}, -#line 54 "afm_keyword_list" - {"W",XYWIDTH}, -#line 33 "afm_keyword_list" - {"KPX",KERNPAIRXAMT}, -#line 56 "afm_keyword_list" - {"WX",XWIDTH}, -#line 55 "afm_keyword_list" - {"W0X",X0WIDTH}, -#line 47 "afm_keyword_list" - {"StdHW",STDHW}, -#line 12 "afm_keyword_list" - {"Characters",CHARACTERS}, -#line 36 "afm_keyword_list" - {"MetricsSets",METRICSSETS}, -#line 23 "afm_keyword_list" - {"EndKernPairs",ENDKERNPAIRS}, -#line 16 "afm_keyword_list" - {"Em",EM}, -#line 45 "afm_keyword_list" - {"StartKernPairs",STARTKERNPAIRS}, -#line 41 "afm_keyword_list" - {"StartComposites",STARTCOMPOSITES}, -#line 40 "afm_keyword_list" - {"StartCharMetrics",STARTCHARMETRICS}, -#line 22 "afm_keyword_list" - {"EndKernData",ENDKERNDATA}, -#line 14 "afm_keyword_list" - {"Descender",DESCENDER}, -#line 44 "afm_keyword_list" - {"StartKernData",STARTKERNDATA}, -#line 18 "afm_keyword_list" - {"EndCharMetrics",ENDCHARMETRICS}, -#line 20 "afm_keyword_list" - {"EndDirection",ENDDIRECTION}, -#line 11 "afm_keyword_list" - {"CharacterSet",CHARACTERSET}, -#line 42 "afm_keyword_list" - {"StartDirection",STARTDIRECTION}, -#line 19 "afm_keyword_list" - {"EndComposites",ENDCOMPOSITES}, -#line 49 "afm_keyword_list" - {"TrackKern",TRACKKERN}, -#line 15 "afm_keyword_list" - {"Descent",DESCENT}, -#line 9 "afm_keyword_list" - {"CapHeight",CAPHEIGHT}, -#line 13 "afm_keyword_list" - {"Comment",COMMENT}, -#line 10 "afm_keyword_list" - {"CharWidth",CHARWIDTH}, -#line 46 "afm_keyword_list" - {"StartTrackKern",STARTTRACKKERN}, -#line 48 "afm_keyword_list" - {"StdVW",STDVW}, -#line 38 "afm_keyword_list" - {"Notice",NOTICE}, -#line 21 "afm_keyword_list" - {"EndFontMetrics",ENDFONTMETRICS}, -#line 24 "afm_keyword_list" - {"EndTrackKern",ENDTRACKKERN}, -#line 43 "afm_keyword_list" - {"StartFontMetrics",STARTFONTMETRICS}, -#line 29 "afm_keyword_list" - {"IsBaseFont",ISBASEFONT}, -#line 17 "afm_keyword_list" - {"EncodingScheme",ENCODINGSCHEME}, -#line 31 "afm_keyword_list" - {"ItalicAngle",ITALICANGLE}, -#line 25 "afm_keyword_list" - {"FamilyName",FAMILYNAME}, -#line 58 "afm_keyword_list" - {"XHeight",XHEIGHT}, -#line 37 "afm_keyword_list" - {"N",CHARNAME}, -#line 30 "afm_keyword_list" - {"IsFixedPitch",ISFIXEDPITCH}, -#line 27 "afm_keyword_list" - {"FontName",FONTNAME}, -#line 50 "afm_keyword_list" - {"UnderlinePosition",UNDERLINEPOSITION}, -#line 51 "afm_keyword_list" - {"UnderlineThickness",UNDERLINETHICKNESS}, -#line 32 "afm_keyword_list" - {"KP",KERNPAIR}, -#line 39 "afm_keyword_list" - {"PCC",COMPCHARPIECE}, -#line 53 "afm_keyword_list" - {"Version",VERSION}, -#line 52 "afm_keyword_list" - {"V",VVECTOR}, -#line 28 "afm_keyword_list" - {"FullName",FULLNAME}, -#line 26 "afm_keyword_list" - {"FontBBox",FONTBBOX}, -#line 35 "afm_keyword_list" - {"MappingScheme",MAPPINGSCHEME}, -#line 57 "afm_keyword_list" - {"Weight",WEIGHT}, -#line 4 "afm_keyword_list" - {"Ascent",ASCENT}, -#line 3 "afm_keyword_list" - {"Ascender",ASCENDER}, - {"",NOPE}, -#line 34 "afm_keyword_list" - {"L",LIGATURE} - }; - - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) - { - register int key = hash (str, len); - - if (key <= MAX_HASH_VALUE && key >= 0) - if (len == lengthtable[key]) - { - register const char *s = wordlist[key].name; - - if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) - return &wordlist[key]; - } - } - return 0; -} diff --git a/vcl/unx/generic/fontmanager/afm_keyword_list b/vcl/unx/generic/fontmanager/afm_keyword_list index 263d76bca4d3..c9bb13467e3e 100755 --- a/vcl/unx/generic/fontmanager/afm_keyword_list +++ b/vcl/unx/generic/fontmanager/afm_keyword_list @@ -1,4 +1,8 @@ -struct hash_entry { char* name; enum parseKey eKey; }; +%language=C++ +%global-table +%null-strings +%struct-type +struct hash_entry { const char* name; enum parseKey eKey; }; %% Ascender,ASCENDER Ascent,ASCENT diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx b/vcl/unx/generic/fontmanager/fontcache.cxx index 639e394f0edd..e7a4008f07f0 100644 --- a/vcl/unx/generic/fontmanager/fontcache.cxx +++ b/vcl/unx/generic/fontmanager/fontcache.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,10 +51,13 @@ #define CACHE_MAGIC "PspFontCacheFile format 4" using namespace std; -using namespace rtl; using namespace psp; using namespace utl; +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OUStringToOString; + /* * static helpers */ @@ -404,10 +408,10 @@ void FontCache::read() } int nCollEntry = atoi( pLine ); pFont->m_nPSName = pAtoms->getAtom( ATOM_PSNAME, OUString( pLine + nTokenPos[1], nTokenPos[2]-nTokenPos[1]-1, RTL_TEXTENCODING_UTF8 ), sal_True ); - pFont->m_eItalic = (italic::type)atoi( pLine+nTokenPos[2] ); - pFont->m_eWeight = (weight::type)atoi( pLine+nTokenPos[3] ); - pFont->m_eWidth = (width::type)atoi( pLine+nTokenPos[4] ); - pFont->m_ePitch = (pitch::type)atoi( pLine+nTokenPos[5] ); + pFont->m_eItalic = (FontItalic)atoi( pLine+nTokenPos[2] ); + pFont->m_eWeight = (FontWeight)atoi( pLine+nTokenPos[3] ); + pFont->m_eWidth = (FontWidth)atoi( pLine+nTokenPos[4] ); + pFont->m_ePitch = (FontPitch)atoi( pLine+nTokenPos[5] ); pFont->m_aEncoding = (rtl_TextEncoding)atoi( pLine+nTokenPos[6] ); pFont->m_nAscend = atoi( pLine + nTokenPos[7] ); pFont->m_nDescend = atoi( pLine + nTokenPos[8] ); @@ -809,3 +813,5 @@ void FontCache::markEmptyDir( int nDirID, bool bNoFiles ) m_aCache[nDirID].m_bNoFiles = bNoFiles; m_bDoFlush = true; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index be7904c55959..c1d506d91d83 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,6 +32,7 @@ #include "fontcache.hxx" #include "impfont.hxx" #include "vcl/fontmanager.hxx" +#include "vcl/vclenum.hxx" using namespace psp; @@ -48,6 +50,12 @@ using namespace psp; #ifndef FC_FAMILYLANG // TODO: remove when baseline moves to fc>=2.2.97 #define FC_FAMILYLANG "familylang" #endif + #ifndef FC_CAPABILITY // TODO: remove when baseline moves to fc>=2.2.97 + #define FC_CAPABILITY "capability" + #endif + #ifndef FC_STYLELANG // TODO: remove when baseline moves to fc>=2.2.97 + #define FC_STYLELANG "stylelang" + #endif #ifndef FC_HINT_STYLE // TODO: remove when baseline moves to fc>=2.2.91 #define FC_HINT_STYLE "hintstyle" #define FC_HINT_NONE 0 @@ -55,6 +63,12 @@ using namespace psp; #define FC_HINT_MEDIUM 2 #define FC_HINT_FULL 3 #endif + #ifndef FC_FT_FACE + #define FC_FT_FACE "ftface" + #endif + #ifndef FC_EMBOLDEN + #define FC_EMBOLDEN "embolden" + #endif #else typedef void FcConfig; typedef void FcObjectSet; @@ -89,7 +103,14 @@ using namespace psp; #include <algorithm> using namespace osl; -using namespace rtl; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; +using ::rtl::OString; + +namespace +{ + typedef std::pair<FcChar8*, FcChar8*> lang_and_element; +} class FontCfgWrapper { @@ -98,13 +119,14 @@ class FontCfgWrapper int m_nFcVersion; FcBool (*m_pFcInit)(); + void (*m_pFcFini)(); int (*m_pFcGetVersion)(); FcConfig* (*m_pFcConfigGetCurrent)(); FcObjectSet* (*m_pFcObjectSetVaBuild)(const char*,va_list); void (*m_pFcObjectSetDestroy)(FcObjectSet* pSet); FcPattern* (*m_pFcPatternCreate)(); void (*m_pFcPatternDestroy)(FcPattern*); - FcFontSet* (*m_pFcFontList)(FcConfig*,FcPattern*,FcObjectSet*); + FcBool (*m_pFcPatternEqual)(const FcPattern*,const FcPattern*); FcFontSet* (*m_pFcConfigGetFonts)(FcConfig*,FcSetName); FcFontSet* (*m_pFcFontSetCreate)(); FcCharSet* (*m_pFcCharSetCreate)(); @@ -136,6 +158,7 @@ class FontCfgWrapper FcBool (*m_pFcPatternDel)(FcPattern*,const char*); FT_UInt (*m_pFcFreeTypeCharIndex)(FT_Face,FcChar32); + FcBool (*m_pFcPatternAddFTFace)(FcPattern*,const char*,const FT_Face); oslGenericFunction loadSymbol( const char* ); void addFontSet( FcSetName ); @@ -155,6 +178,12 @@ public: FcBool FcInit() { return m_pFcInit(); } + void FcFini() + { + //To-Do: get gtk vclplug smoketest to pass + //if (m_pFcFini) m_pFcFini(); + } + int FcGetVersion() { return m_pFcGetVersion(); } @@ -177,10 +206,10 @@ public: { return m_pFcPatternCreate(); } void FcPatternDestroy( FcPattern* pPattern ) - { m_pFcPatternDestroy( pPattern ); } + { if (m_pFcPatternDestroy) m_pFcPatternDestroy( pPattern ); } - FcFontSet* FcFontList( FcConfig* pConfig, FcPattern* pPattern, FcObjectSet* pSet ) - { return m_pFcFontList( pConfig, pPattern, pSet ); } + FcBool FcPatternEqual( const FcPattern* pPatternA, const FcPattern *pPatternB ) + { return m_pFcPatternEqual( pPatternA, pPatternB ); } FcFontSet* FcConfigGetFonts( FcConfig* pConfig, FcSetName eSet) { return m_pFcConfigGetFonts( pConfig, eSet ); } @@ -256,11 +285,20 @@ public: FT_UInt FcFreeTypeCharIndex( FT_Face face, FcChar32 ucs4 ) { return m_pFcFreeTypeCharIndex ? m_pFcFreeTypeCharIndex( face, ucs4 ) : 0; } - -public: // TODO: cleanup - FcResult FamilyFromPattern(FcPattern* pPattern, FcChar8 **family); - std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aFontNameToLocalized; - std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aLocalizedToCanonical; + FcBool FcPatternAddFTFace( FcPattern* pPattern, const char* pObject, const FT_Face nValue ) + { + return m_pFcPatternAddFTFace + ? m_pFcPatternAddFTFace( pPattern, pObject, nValue ) + : false; + } +public: + FcResult LocalizedElementFromPattern(FcPattern* pPattern, FcChar8 **family, + const char *elementtype, const char *elementlangtype); +//to-do, make private and add some cleanish accessor methods + boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aFontNameToLocalized; + boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aLocalizedToCanonical; +private: + void cacheLocalizedFontNames(FcChar8 *origfontname, FcChar8 *bestfontname, const std::vector< lang_and_element > &lang_and_elements); }; oslGenericFunction FontCfgWrapper::loadSymbol( const char* pSymbol ) @@ -296,6 +334,8 @@ FontCfgWrapper::FontCfgWrapper() m_pFcInit = (FcBool(*)()) loadSymbol( "FcInit" ); + m_pFcFini = (void(*)()) + loadSymbol( "FcFini" ); m_pFcGetVersion = (int(*)()) loadSymbol( "FcGetVersion" ); m_pFcConfigGetCurrent = (FcConfig *(*)()) @@ -308,8 +348,8 @@ FontCfgWrapper::FontCfgWrapper() loadSymbol( "FcPatternCreate" ); m_pFcPatternDestroy = (void(*)(FcPattern*)) loadSymbol( "FcPatternDestroy" ); - m_pFcFontList = (FcFontSet*(*)(FcConfig*,FcPattern*,FcObjectSet*)) - loadSymbol( "FcFontList" ); + m_pFcPatternEqual = (FcBool(*)(const FcPattern*,const FcPattern*)) + loadSymbol( "FcPatternEqual" ); m_pFcConfigGetFonts = (FcFontSet*(*)(FcConfig*,FcSetName)) loadSymbol( "FcConfigGetFonts" ); m_pFcFontSetCreate = (FcFontSet*(*)()) @@ -370,6 +410,8 @@ FontCfgWrapper::FontCfgWrapper() m_pFcFreeTypeCharIndex = (FT_UInt(*)(FT_Face,FcChar32)) loadSymbol( "FcFreeTypeCharIndex" ); + m_pFcPatternAddFTFace = (FcBool(*)(FcPattern*,const char*,const FT_Face)) + loadSymbol( "FcPatternAddFTFace" ); m_nFcVersion = FcGetVersion(); #if (OSL_DEBUG_LEVEL > 1) @@ -392,7 +434,7 @@ FontCfgWrapper::FontCfgWrapper() m_pFcObjectSetDestroy && m_pFcPatternCreate && m_pFcPatternDestroy && - m_pFcFontList && + m_pFcPatternEqual && m_pFcConfigGetFonts && m_pFcFontSetCreate && m_pFcCharSetCreate && @@ -450,41 +492,17 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName ) if( !pOrig ) return; - // filter the font sets to remove obsolete or duplicate faces + // filter the font sets to remove obsolete faces for( int i = 0; i < pOrig->nfont; ++i ) { - FcPattern* pOrigPattern = pOrig->fonts[i]; + FcPattern* pPattern = pOrig->fonts[i]; // #i115131# ignore non-outline fonts FcBool bOutline = FcFalse; - FcResult eOutRes = FcPatternGetBool( pOrigPattern, FC_OUTLINE, 0, &bOutline ); + FcResult eOutRes = FcPatternGetBool( pPattern, FC_OUTLINE, 0, &bOutline ); if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) ) continue; - // create a pattern to find eventually better alternatives - FcPattern* pBetterPattern = pOrigPattern; - if( m_nFcVersion > 20400 ) // #i115204# avoid trouble with old FC versions - { - FcPattern* pTestPattern = FcPatternDuplicate( pOrigPattern ); - FcPatternAddBool( pTestPattern, FC_OUTLINE, FcTrue ); - // TODO: ignore all attributes that are not interesting for finding dupes - // e.g. by using pattern->ImplFontAttr->pattern conversion - FcPatternDel( pTestPattern, FC_FONTVERSION ); - FcPatternDel( pTestPattern, FC_CHARSET ); - FcPatternDel( pTestPattern, FC_FILE ); - // find the font face for the dupe-search pattern - FcResult eFcResult = FcResultMatch; - pBetterPattern = FcFontMatch( FcConfigGetCurrent(), pTestPattern, &eFcResult ); - FcPatternDestroy( pTestPattern ); - if( eFcResult != FcResultMatch ) - continue; - // #i115131# double check results and eventually ignore them - eOutRes = FcPatternGetBool( pBetterPattern, FC_OUTLINE, 0, &bOutline ); - if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) ) - continue; - } - // insert best found pattern for the dupe-search pattern - // TODO: skip inserting patterns that are already known in the target fontset - FcPatternReference( pBetterPattern ); - FcFontSetAdd( m_pOutlineSet, pBetterPattern ); + FcPatternReference( pPattern ); + FcFontSetAdd( m_pOutlineSet, pPattern ); } // TODO?: FcFontSetDestroy( pOrig ); @@ -493,6 +511,90 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName ) #endif } +#ifdef ENABLE_FONTCONFIG +namespace +{ + int compareFontNames(FontCfgWrapper& rWrapper, const FcPattern *a, const FcPattern *b) + { + FcChar8 *pNameA=NULL, *pNameB=NULL; + + bool bHaveA = rWrapper.FcPatternGetString(a, FC_FAMILY, 0, &pNameA) == FcResultMatch; + bool bHaveB = rWrapper.FcPatternGetString(b, FC_FAMILY, 0, &pNameB) == FcResultMatch; + + if (bHaveA && bHaveB) + return strcmp((const char*)pNameA, (const char*)pNameB); + + return bHaveA - bHaveB; + } + + //Sort fonts so that fonts with the same family name are side-by-side, with + //those with higher version numbers first + class SortFont : public ::std::binary_function< const FcPattern*, const FcPattern*, bool > + { + private: + FontCfgWrapper& m_rWrapper; + public: + SortFont(FontCfgWrapper& rWrapper) : m_rWrapper(rWrapper) {} + + bool operator()(const FcPattern *a, const FcPattern *b) + { + int comp = compareFontNames(m_rWrapper, a, b); + if (comp != 0) + return comp < 0; + + int nVersionA=0, nVersionB=0; + + bool bHaveA = m_rWrapper.FcPatternGetInteger(a, FC_FONTVERSION, 0, &nVersionA) == FcResultMatch; + bool bHaveB = m_rWrapper.FcPatternGetInteger(b, FC_FONTVERSION, 0, &nVersionB) == FcResultMatch; + + if (bHaveA && bHaveB) + return nVersionA > nVersionB; + + return bHaveA - bHaveA; + } + }; + + //See fdo#30729 for where an old opensymbol installed system-wide can + //clobber the new opensymbol installed locally + // + //See if this font is a duplicate with equal attributes which has already been + //inserted, or if it an older version of an inserted fonts. Depends on FcFontSet + //on being sorted with SortFont + bool isPreviouslyDuplicateOrObsoleted(FontCfgWrapper& rWrapper, FcFontSet *pFSet, int i) + { + if (i == 0) + return false; + + const FcPattern *a = pFSet->fonts[i]; + const FcPattern *b = pFSet->fonts[i-1]; + + if (compareFontNames(rWrapper, a, b) != 0) + return false; + + FcPattern* pTestPatternA = rWrapper.FcPatternDuplicate(a); + rWrapper.FcPatternDel(pTestPatternA, FC_FILE); + rWrapper.FcPatternDel(pTestPatternA, FC_CHARSET); + rWrapper.FcPatternDel(pTestPatternA, FC_CAPABILITY); + rWrapper.FcPatternDel(pTestPatternA, FC_FONTVERSION); + + FcPattern* pTestPatternB = rWrapper.FcPatternDuplicate(b); + rWrapper.FcPatternDel(pTestPatternB, FC_FILE); + rWrapper.FcPatternDel(pTestPatternB, FC_CHARSET); + rWrapper.FcPatternDel(pTestPatternB, FC_CAPABILITY); + rWrapper.FcPatternDel(pTestPatternB, FC_FONTVERSION); + + bool bIsDup = false; + if (rWrapper.FcPatternEqual(pTestPatternA, pTestPatternB)) + bIsDup = true; + + rWrapper.FcPatternDestroy(pTestPatternB); + rWrapper.FcPatternDestroy(pTestPatternA); + + return bIsDup; + } +} +#endif + FcFontSet* FontCfgWrapper::getFontSet() { #ifdef ENABLE_FONTCONFIG @@ -500,8 +602,10 @@ FcFontSet* FontCfgWrapper::getFontSet() { m_pOutlineSet = FcFontSetCreate(); addFontSet( FcSetSystem ); - if( m_nFcVersion > 20400 ) // #i85462# prevent crashes + if( m_nFcVersion > 20400 ) // #i85462# prevent crashes addFontSet( FcSetApplication ); + + ::std::sort(m_pOutlineSet->fonts,m_pOutlineSet->fonts+m_pOutlineSet->nfont,SortFont(*this)); } #endif @@ -512,6 +616,7 @@ FontCfgWrapper::~FontCfgWrapper() { if( m_pOutlineSet ) FcFontSetDestroy( m_pOutlineSet ); + FcFini(); if( m_pLib ) osl_unloadModule( (oslModule)m_pLib ); } @@ -537,27 +642,25 @@ void FontCfgWrapper::release() #ifdef ENABLE_FONTCONFIG namespace { - typedef std::pair<FcChar8*, FcChar8*> lang_and_family; - class localizedsorter { rtl::OLocale maLoc; public: localizedsorter(rtl_Locale* pLoc) : maLoc(pLoc) {} - FcChar8* bestname(const std::vector<lang_and_family> &families); + FcChar8* bestname(const std::vector<lang_and_element> &elements); }; - FcChar8* localizedsorter::bestname(const std::vector<lang_and_family> &families) + FcChar8* localizedsorter::bestname(const std::vector<lang_and_element> &elements) { - FcChar8* candidate = families.begin()->second; + FcChar8* candidate = elements.begin()->second; rtl::OString sLangMatch(rtl::OUStringToOString(maLoc.getLanguage().toAsciiLowerCase(), RTL_TEXTENCODING_UTF8)); - rtl::OString sFullMatch = sLangMatch; + rtl::OString sFullMatch = sLangMatch; sFullMatch += OString('-'); sFullMatch += rtl::OUStringToOString(maLoc.getCountry().toAsciiLowerCase(), RTL_TEXTENCODING_UTF8); - std::vector<lang_and_family>::const_iterator aEnd = families.end(); + std::vector<lang_and_element>::const_iterator aEnd = elements.end(); bool alreadyclosematch = false; - for( std::vector<lang_and_family>::const_iterator aIter = families.begin(); aIter != aEnd; ++aIter ) + for( std::vector<lang_and_element>::const_iterator aIter = elements.begin(); aIter != aEnd; ++aIter ) { const char *pLang = (const char*)aIter->first; if( rtl_str_compare( pLang, sFullMatch.getStr() ) == 0) @@ -567,7 +670,10 @@ namespace break; } else if( alreadyclosematch ) - continue; + { + // override candidate only if there is a perfect match + continue; + } else if( rtl_str_compare( pLang, sLangMatch.getStr()) == 0) { // just the language matches @@ -576,7 +682,7 @@ namespace } else if( rtl_str_compare( pLang, "en") == 0) { - // fallback to the english family name + // fallback to the english element name candidate = aIter->second; } } @@ -584,27 +690,42 @@ namespace } } -FcResult FontCfgWrapper::FamilyFromPattern(FcPattern* pPattern, FcChar8 **family) +//Set up maps to quickly map between a fonts best UI name and all the rest of its names, and vice versa +void FontCfgWrapper::cacheLocalizedFontNames(FcChar8 *origfontname, FcChar8 *bestfontname, const std::vector< lang_and_element > &lang_and_elements) { - FcChar8 *origfamily; - FcResult eFamilyRes = FcPatternGetString( pPattern, FC_FAMILY, 0, &origfamily ); - *family = origfamily; + std::vector<lang_and_element>::const_iterator aEnd = lang_and_elements.end(); + for (std::vector<lang_and_element>::const_iterator aIter = lang_and_elements.begin(); aIter != aEnd; ++aIter) + { + const char *candidate = (const char*)(aIter->second); + if (rtl_str_compare(candidate, (const char*)bestfontname) != 0) + m_aFontNameToLocalized[OString(candidate)] = OString((const char*)bestfontname); + } + if (rtl_str_compare((const char*)origfontname, (const char*)bestfontname) != 0) + m_aLocalizedToCanonical[OString((const char*)bestfontname)] = OString((const char*)origfontname); +} + +FcResult FontCfgWrapper::LocalizedElementFromPattern(FcPattern* pPattern, FcChar8 **element, + const char *elementtype, const char *elementlangtype) +{ /* e. g.: ^ FC_FAMILY ^ FC_FAMILYLANG */ + FcChar8 *origelement; + FcResult eElementRes = FcPatternGetString( pPattern, elementtype, 0, &origelement ); + *element = origelement; - if( eFamilyRes == FcResultMatch) + if( eElementRes == FcResultMatch) { - FcChar8* familylang = NULL; - if (FcPatternGetString( pPattern, FC_FAMILYLANG, 0, &familylang ) == FcResultMatch) + FcChar8* elementlang = NULL; + if (FcPatternGetString( pPattern, elementlangtype, 0, &elementlang ) == FcResultMatch) { - std::vector< lang_and_family > lang_and_families; - lang_and_families.push_back(lang_and_family(familylang, *family)); + std::vector< lang_and_element > lang_and_elements; + lang_and_elements.push_back(lang_and_element(elementlang, *element)); int k = 1; while (1) { - if (FcPatternGetString( pPattern, FC_FAMILYLANG, k, &familylang ) != FcResultMatch) + if (FcPatternGetString( pPattern, elementlangtype, k, &elementlang ) != FcResultMatch) break; - if (FcPatternGetString( pPattern, FC_FAMILY, k, family ) != FcResultMatch) + if (FcPatternGetString( pPattern, elementtype, k, element ) != FcResultMatch) break; - lang_and_families.push_back(lang_and_family(familylang, *family)); + lang_and_elements.push_back(lang_and_element(elementlang, *element)); ++k; } @@ -612,21 +733,15 @@ FcResult FontCfgWrapper::FamilyFromPattern(FcPattern* pPattern, FcChar8 **family rtl_Locale* pLoc; osl_getProcessLocale(&pLoc); localizedsorter aSorter(pLoc); - *family = aSorter.bestname(lang_and_families); + *element = aSorter.bestname(lang_and_elements); - std::vector<lang_and_family>::const_iterator aEnd = lang_and_families.end(); - for (std::vector<lang_and_family>::const_iterator aIter = lang_and_families.begin(); aIter != aEnd; ++aIter) - { - const char *candidate = (const char*)(aIter->second); - if (rtl_str_compare(candidate, (const char*)(*family)) != 0) - m_aFontNameToLocalized[OString(candidate)] = OString((const char*)(*family)); - } - if (rtl_str_compare((const char*)origfamily, (const char*)(*family)) != 0) - m_aLocalizedToCanonical[OString((const char*)(*family))] = OString((const char*)origfamily); + //if this element is a fontname, map the other names to this best-name + if (rtl_str_compare(elementtype, FC_FAMILY) == 0) + cacheLocalizedFontNames(origelement, *element, lang_and_elements); } } - return eFamilyRes; + return eElementRes; } /* @@ -642,71 +757,72 @@ bool PrintFontManager::initFontconfig() namespace { - weight::type convertWeight(int weight) + FontWeight convertWeight(int weight) { // set weight if( weight <= FC_WEIGHT_THIN ) - return weight::Thin; + return WEIGHT_THIN; else if( weight <= FC_WEIGHT_ULTRALIGHT ) - return weight::UltraLight; + return WEIGHT_ULTRALIGHT; else if( weight <= FC_WEIGHT_LIGHT ) - return weight::Light; + return WEIGHT_LIGHT; else if( weight <= FC_WEIGHT_BOOK ) - return weight::SemiLight; + return WEIGHT_SEMILIGHT; else if( weight <= FC_WEIGHT_NORMAL ) - return weight::Normal; + return WEIGHT_NORMAL; else if( weight <= FC_WEIGHT_MEDIUM ) - return weight::Medium; + return WEIGHT_MEDIUM; else if( weight <= FC_WEIGHT_SEMIBOLD ) - return weight::SemiBold; + return WEIGHT_SEMIBOLD; else if( weight <= FC_WEIGHT_BOLD ) - return weight::Bold; + return WEIGHT_BOLD; else if( weight <= FC_WEIGHT_ULTRABOLD ) - return weight::UltraBold; - return weight::Black; + return WEIGHT_ULTRABOLD; + return WEIGHT_BLACK; } - italic::type convertSlant(int slant) + FontItalic convertSlant(int slant) { // set italic if( slant == FC_SLANT_ITALIC ) - return italic::Italic; + return ITALIC_NORMAL; else if( slant == FC_SLANT_OBLIQUE ) - return italic::Oblique; - return italic::Upright; + return ITALIC_OBLIQUE; + return ITALIC_NONE; } - pitch::type convertSpacing(int spacing) + FontPitch convertSpacing(int spacing) { // set pitch if( spacing == FC_MONO || spacing == FC_CHARCELL ) - return pitch::Fixed; - return pitch::Variable; + return PITCH_FIXED; + return PITCH_VARIABLE; } - width::type convertWidth(int width) + // translation: fontconfig enum -> vcl enum + FontWidth convertWidth(int width) { if (width == FC_WIDTH_ULTRACONDENSED) - return width::UltraCondensed; + return WIDTH_ULTRA_CONDENSED; else if (width == FC_WIDTH_EXTRACONDENSED) - return width::ExtraCondensed; + return WIDTH_EXTRA_CONDENSED; else if (width == FC_WIDTH_CONDENSED) - return width::Condensed; + return WIDTH_CONDENSED; else if (width == FC_WIDTH_SEMICONDENSED) - return width::SemiCondensed; + return WIDTH_SEMI_CONDENSED; else if (width == FC_WIDTH_SEMIEXPANDED) - return width::SemiExpanded; + return WIDTH_SEMI_EXPANDED; else if (width == FC_WIDTH_EXPANDED) - return width::Expanded; + return WIDTH_EXPANDED; else if (width == FC_WIDTH_EXTRAEXPANDED) - return width::ExtraExpanded; + return WIDTH_EXTRA_EXPANDED; else if (width == FC_WIDTH_ULTRAEXPANDED) - return width::UltraExpanded; - return width::Normal; + return WIDTH_ULTRA_EXPANDED; + return WIDTH_NORMAL; } } -int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl::OStringHash>& o_rVisitedPaths ) +int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, int, rtl::OStringHash>& o_rVisitedPaths ) { int nFonts = 0; @@ -732,8 +848,8 @@ int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl FcBool outline = false; FcResult eFileRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_FILE, 0, &file ); - FcResult eFamilyRes = rWrapper.FamilyFromPattern( pFSet->fonts[i], &family ); - FcResult eStyleRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_STYLE, 0, &style ); + FcResult eFamilyRes = rWrapper.LocalizedElementFromPattern( pFSet->fonts[i], &family, FC_FAMILY, FC_FAMILYLANG ); + FcResult eStyleRes = rWrapper.LocalizedElementFromPattern( pFSet->fonts[i], &style, FC_STYLE, FC_STYLELANG ); FcResult eSlantRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SLANT, 0, &slant ); FcResult eWeightRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_WEIGHT, 0, &weight ); FcResult eSpacRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SPACING, 0, &spacing ); @@ -762,6 +878,14 @@ int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl if( eOutRes == FcResultMatch && ! outline ) continue; + if (isPreviouslyDuplicateOrObsoleted(rWrapper, pFSet, i)) + { +#if OSL_DEBUG_LEVEL > 2 + fprintf(stderr, "Ditching %s as duplicate/obsolete\n", file); +#endif + continue; + } + // see if this font is already cached // update attributes std::list< PrintFont* > aFonts; @@ -833,14 +957,6 @@ int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl // set family name if( pUpdate->m_nFamilyName != nFamilyName ) { -#if 0 // fontconfig prefers nameid=16 for the family name which is all fine - // but Writer suffers from #i79878# - // the only reasonable workaround for now is to use the classic nameid=1 - pUpdate->m_aAliases.remove( pUpdate->m_nFamilyName ); - pUpdate->m_aAliases.push_back( pUpdate->m_nFamilyName ); - pUpdate->m_aAliases.remove( nFamilyName ); - pUpdate->m_nFamilyName = nFamilyName; -#endif } if( eWeightRes == FcResultMatch ) pUpdate->m_eWeight = convertWeight(weight); @@ -931,66 +1047,66 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) } static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, - italic::type eItalic, weight::type eWeight, width::type eWidth, pitch::type ePitch) + FontItalic eItalic, FontWeight eWeight, FontWidth eWidth, FontPitch ePitch) { - if( eItalic != italic::Unknown ) + if( eItalic != ITALIC_DONTKNOW ) { int nSlant = FC_SLANT_ROMAN; switch( eItalic ) { - case italic::Italic: nSlant = FC_SLANT_ITALIC;break; - case italic::Oblique: nSlant = FC_SLANT_OBLIQUE;break; + case ITALIC_NORMAL: nSlant = FC_SLANT_ITALIC;break; + case ITALIC_OBLIQUE: nSlant = FC_SLANT_OBLIQUE;break; default: break; } rWrapper.FcPatternAddInteger( pPattern, FC_SLANT, nSlant ); } - if( eWeight != weight::Unknown ) + if( eWeight != WEIGHT_DONTKNOW ) { int nWeight = FC_WEIGHT_NORMAL; switch( eWeight ) { - case weight::Thin: nWeight = FC_WEIGHT_THIN;break; - case weight::UltraLight: nWeight = FC_WEIGHT_ULTRALIGHT;break; - case weight::Light: nWeight = FC_WEIGHT_LIGHT;break; - case weight::SemiLight: nWeight = FC_WEIGHT_BOOK;break; - case weight::Normal: nWeight = FC_WEIGHT_NORMAL;break; - case weight::Medium: nWeight = FC_WEIGHT_MEDIUM;break; - case weight::SemiBold: nWeight = FC_WEIGHT_SEMIBOLD;break; - case weight::Bold: nWeight = FC_WEIGHT_BOLD;break; - case weight::UltraBold: nWeight = FC_WEIGHT_ULTRABOLD;break; - case weight::Black: nWeight = FC_WEIGHT_BLACK;break; + case WEIGHT_THIN: nWeight = FC_WEIGHT_THIN;break; + case WEIGHT_ULTRALIGHT: nWeight = FC_WEIGHT_ULTRALIGHT;break; + case WEIGHT_LIGHT: nWeight = FC_WEIGHT_LIGHT;break; + case WEIGHT_SEMILIGHT: nWeight = FC_WEIGHT_BOOK;break; + case WEIGHT_NORMAL: nWeight = FC_WEIGHT_NORMAL;break; + case WEIGHT_MEDIUM: nWeight = FC_WEIGHT_MEDIUM;break; + case WEIGHT_SEMIBOLD: nWeight = FC_WEIGHT_SEMIBOLD;break; + case WEIGHT_BOLD: nWeight = FC_WEIGHT_BOLD;break; + case WEIGHT_ULTRABOLD: nWeight = FC_WEIGHT_ULTRABOLD;break; + case WEIGHT_BLACK: nWeight = FC_WEIGHT_BLACK;break; default: break; } rWrapper.FcPatternAddInteger( pPattern, FC_WEIGHT, nWeight ); } - if( eWidth != width::Unknown ) + if( eWidth != WIDTH_DONTKNOW ) { int nWidth = FC_WIDTH_NORMAL; switch( eWidth ) { - case width::UltraCondensed: nWidth = FC_WIDTH_ULTRACONDENSED;break; - case width::ExtraCondensed: nWidth = FC_WIDTH_EXTRACONDENSED;break; - case width::Condensed: nWidth = FC_WIDTH_CONDENSED;break; - case width::SemiCondensed: nWidth = FC_WIDTH_SEMICONDENSED;break; - case width::Normal: nWidth = FC_WIDTH_NORMAL;break; - case width::SemiExpanded: nWidth = FC_WIDTH_SEMIEXPANDED;break; - case width::Expanded: nWidth = FC_WIDTH_EXPANDED;break; - case width::ExtraExpanded: nWidth = FC_WIDTH_EXTRAEXPANDED;break; - case width::UltraExpanded: nWidth = FC_WIDTH_ULTRACONDENSED;break; + case WIDTH_ULTRA_CONDENSED: nWidth = FC_WIDTH_ULTRACONDENSED;break; + case WIDTH_EXTRA_CONDENSED: nWidth = FC_WIDTH_EXTRACONDENSED;break; + case WIDTH_CONDENSED: nWidth = FC_WIDTH_CONDENSED;break; + case WIDTH_SEMI_CONDENSED: nWidth = FC_WIDTH_SEMICONDENSED;break; + case WIDTH_NORMAL: nWidth = FC_WIDTH_NORMAL;break; + case WIDTH_SEMI_EXPANDED: nWidth = FC_WIDTH_SEMIEXPANDED;break; + case WIDTH_EXPANDED: nWidth = FC_WIDTH_EXPANDED;break; + case WIDTH_EXTRA_EXPANDED: nWidth = FC_WIDTH_EXTRAEXPANDED;break; + case WIDTH_ULTRA_EXPANDED: nWidth = FC_WIDTH_ULTRACONDENSED;break; default: break; } rWrapper.FcPatternAddInteger( pPattern, FC_WIDTH, nWidth ); } - if( ePitch != pitch::Unknown ) + if( ePitch != PITCH_DONTKNOW ) { int nSpacing = FC_PROPORTIONAL; switch( ePitch ) { - case pitch::Fixed: nSpacing = FC_MONO;break; - case pitch::Variable: nSpacing = FC_PROPORTIONAL;break; + case PITCH_FIXED: nSpacing = FC_MONO;break; + case PITCH_VARIABLE: nSpacing = FC_PROPORTIONAL;break; default: break; } @@ -1002,8 +1118,8 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib, - italic::type &rItalic, weight::type &rWeight, - width::type &rWidth, pitch::type &rPitch) const + FontItalic &rItalic, FontWeight &rWeight, + FontWidth &rWidth, FontPitch &rPitch) const { rtl::OUString aName; FontCfgWrapper& rWrapper = FontCfgWrapper::get(); @@ -1020,9 +1136,15 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, const FcChar8* pTargetNameUtf8 = (FcChar8*)aTargetName.getStr(); rWrapper.FcPatternAddString( pPattern, FC_FAMILY, pTargetNameUtf8 ); - const FcChar8* pLangAttribUtf8 = (FcChar8*)rLangAttrib.getStr(); if( rLangAttrib.getLength() ) + { + const FcChar8* pLangAttribUtf8; + if (rLangAttrib.equalsIgnoreAsciiCase(OString(RTL_CONSTASCII_STRINGPARAM("pa-in")))) + pLangAttribUtf8 = (FcChar8*)"pa"; + else + pLangAttribUtf8 = (FcChar8*)rLangAttrib.getStr(); rWrapper.FcPatternAddString( pPattern, FC_LANG, pLangAttribUtf8 ); + } // Add required Unicode characters, if any if ( rMissingCodes.getLength() ) @@ -1071,7 +1193,7 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, if( eFileRes == FcResultMatch ) { OString sFamily((sal_Char*)family); - std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aFontNameToLocalized.find(sFamily); + boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aFontNameToLocalized.find(sFamily); if (aI != rWrapper.m_aFontNameToLocalized.end()) sFamily = aI->second; aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 ); @@ -1114,24 +1236,47 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, return aName; } -bool PrintFontManager::getFontOptions( - const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*), - ImplFontOptions& rOptions) const +class FontConfigFontOptions : public ImplFontOptions +{ +public: + FontConfigFontOptions() : mpPattern(0) {} + ~FontConfigFontOptions() + { + FontCfgWrapper& rWrapper = FontCfgWrapper::get(); + if( rWrapper.isValid() ) + rWrapper.FcPatternDestroy( mpPattern ); + } + virtual void *GetPattern(void * face, bool bEmbolden) const + { + FontCfgWrapper& rWrapper = FontCfgWrapper::get(); + if( rWrapper.isValid() ) + { + rWrapper.FcPatternAddFTFace(mpPattern, FC_FT_FACE, static_cast<FT_Face>(face)); + rWrapper.FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse); + } + return mpPattern; + } + FcPattern* mpPattern; +}; + +ImplFontOptions* PrintFontManager::getFontOptions( + const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*)) const { #ifndef ENABLE_FONTCONFIG (void)rInfo;(void)nSize;(void)subcallback;(void)rOptions; - return false; + return NULL; #else // ENABLE_FONTCONFIG FontCfgWrapper& rWrapper = FontCfgWrapper::get(); if( ! rWrapper.isValid() ) - return false; + return NULL; + FontConfigFontOptions* pOptions = NULL; FcConfig* pConfig = rWrapper.FcConfigGetCurrent(); FcPattern* pPattern = rWrapper.FcPatternCreate(); OString sFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 ); - std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aLocalizedToCanonical.find(sFamily); + boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aLocalizedToCanonical.find(sFamily); if (aI != rWrapper.m_aLocalizedToCanonical.end()) sFamily = aI->second; if( sFamily.getLength() ) @@ -1152,49 +1297,43 @@ bool PrintFontManager::getFontOptions( FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult ); if( pResult ) { - FcFontSet* pSet = rWrapper.FcFontSetCreate(); - rWrapper.FcFontSetAdd( pSet, pResult ); - if( pSet->nfont > 0 ) + FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool(pResult, + FC_EMBEDDED_BITMAP, 0, &embitmap); + FcResult eAntialias = rWrapper.FcPatternGetBool(pResult, + FC_ANTIALIAS, 0, &antialias); + FcResult eAutoHint = rWrapper.FcPatternGetBool(pResult, + FC_AUTOHINT, 0, &autohint); + FcResult eHinting = rWrapper.FcPatternGetBool(pResult, + FC_HINTING, 0, &hinting); + /*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger(pResult, + FC_HINT_STYLE, 0, &hintstyle); + + pOptions = new FontConfigFontOptions; + + pOptions->mpPattern = pResult; + + if( eEmbeddedBitmap == FcResultMatch ) + pOptions->meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE; + if( eAntialias == FcResultMatch ) + pOptions->meAntiAlias = antialias ? ANTIALIAS_TRUE : ANTIALIAS_FALSE; + if( eAutoHint == FcResultMatch ) + pOptions->meAutoHint = autohint ? AUTOHINT_TRUE : AUTOHINT_FALSE; + if( eHinting == FcResultMatch ) + pOptions->meHinting = hinting ? HINTING_TRUE : HINTING_FALSE; + switch (hintstyle) { - FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool(pSet->fonts[0], - FC_EMBEDDED_BITMAP, 0, &embitmap); - FcResult eAntialias = rWrapper.FcPatternGetBool(pSet->fonts[0], - FC_ANTIALIAS, 0, &antialias); - FcResult eAutoHint = rWrapper.FcPatternGetBool(pSet->fonts[0], - FC_AUTOHINT, 0, &autohint); - FcResult eHinting = rWrapper.FcPatternGetBool(pSet->fonts[0], - FC_HINTING, 0, &hinting); - /*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger( pSet->fonts[0], - FC_HINT_STYLE, 0, &hintstyle); - - if( eEmbeddedBitmap == FcResultMatch ) - rOptions.meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE; - if( eAntialias == FcResultMatch ) - rOptions.meAntiAlias = antialias ? ANTIALIAS_TRUE : ANTIALIAS_FALSE; - if( eAutoHint == FcResultMatch ) - rOptions.meAutoHint = autohint ? AUTOHINT_TRUE : AUTOHINT_FALSE; - if( eHinting == FcResultMatch ) - rOptions.meHinting = hinting ? HINTING_TRUE : HINTING_FALSE; - switch (hintstyle) - { - case FC_HINT_NONE: rOptions.meHintStyle = HINT_NONE; break; - case FC_HINT_SLIGHT: rOptions.meHintStyle = HINT_SLIGHT; break; - case FC_HINT_MEDIUM: rOptions.meHintStyle = HINT_MEDIUM; break; - default: // fall through - case FC_HINT_FULL: rOptions.meHintStyle = HINT_FULL; break; - } + case FC_HINT_NONE: pOptions->meHintStyle = HINT_NONE; break; + case FC_HINT_SLIGHT: pOptions->meHintStyle = HINT_SLIGHT; break; + case FC_HINT_MEDIUM: pOptions->meHintStyle = HINT_MEDIUM; break; + default: // fall through + case FC_HINT_FULL: pOptions->meHintStyle = HINT_FULL; break; } - // info: destroying the pSet destroys pResult implicitly - // since pResult was "added" to pSet - rWrapper.FcFontSetDestroy( pSet ); } // cleanup rWrapper.FcPatternDestroy( pPattern ); - // TODO: return true only if non-default font options are set - const bool bOK = (pResult != NULL); - return bOK; + return pOptions; #endif } @@ -1272,7 +1411,7 @@ bool PrintFontManager::initFontconfig() return false; } -int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl::OStringHash>& ) +int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, int, rtl::OStringHash>& ) { return 0; } @@ -1296,7 +1435,7 @@ int PrintFontManager::FreeTypeCharIndex( void*, sal_uInt32 ) } rtl::OUString PrintFontManager::Substitute( const rtl::OUString&, - rtl::OUString&, const rtl::OString&, italic::type, weight::type, width::type, pitch::type) const + rtl::OUString&, const rtl::OString&, FontItalic, FontWeight, FontWidth, FontPitch) const { rtl::OUString aName; return aName; @@ -1304,3 +1443,4 @@ rtl::OUString PrintFontManager::Substitute( const rtl::OUString&, #endif // ENABLE_FONTCONFIG +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index 8b9ba153e7e3..1427daedb193 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,6 +58,8 @@ #include "rtl/ustrbuf.hxx" #include "rtl/strbuf.hxx" +#include <sal/macros.h> + #include "i18npool/mslangid.hxx" @@ -71,7 +74,7 @@ #include "sal/alloca.h" #include <set> -#include <hash_set> +#include <boost/unordered_set.hpp> #include <algorithm> #include "adobeenc.tab" // get encoding table for AFM metrics @@ -96,11 +99,19 @@ using namespace vcl; using namespace utl; using namespace psp; using namespace osl; -using namespace rtl; using namespace com::sun::star::uno; using namespace com::sun::star::beans; using namespace com::sun::star::lang; +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OStringHash; +using ::rtl::OStringBuffer; +using ::rtl::OUStringBuffer; +using ::rtl::OUStringHash; +using ::rtl::OStringToOUString; +using ::rtl::OUStringToOString; + /* * static helpers */ @@ -123,83 +134,83 @@ inline sal_uInt32 getUInt32BE( const sal_uInt8*& pBuffer ) return nRet; } -static italic::type parseItalic( const ByteString& rItalic ) +static FontItalic parseItalic( const ByteString& rItalic ) { - italic::type eItalic = italic::Unknown; + FontItalic eItalic = ITALIC_DONTKNOW; if( rItalic.EqualsIgnoreCaseAscii( "i" ) ) - eItalic = italic::Italic; + eItalic = ITALIC_NORMAL; else if( rItalic.EqualsIgnoreCaseAscii( "o" ) ) - eItalic = italic::Oblique; + eItalic = ITALIC_OBLIQUE; else - eItalic = italic::Upright; + eItalic = ITALIC_NONE; return eItalic; } // ------------------------------------------------------------------------- -static weight::type parseWeight( const ByteString& rWeight ) +static FontWeight parseWeight( const ByteString& rWeight ) { - weight::type eWeight = weight::Unknown; + FontWeight eWeight = WEIGHT_DONTKNOW; if( rWeight.Search( "bold" ) != STRING_NOTFOUND ) { if( rWeight.Search( "emi" ) != STRING_NOTFOUND ) // semi, demi - eWeight = weight::SemiBold; + eWeight = WEIGHT_SEMIBOLD; else if( rWeight.Search( "ultra" ) != STRING_NOTFOUND ) - eWeight = weight::UltraBold; + eWeight = WEIGHT_ULTRABOLD; else - eWeight = weight::Bold; + eWeight = WEIGHT_BOLD; } else if( rWeight.Search( "heavy" ) != STRING_NOTFOUND ) - eWeight = weight::Bold; + eWeight = WEIGHT_BOLD; else if( rWeight.Search( "light" ) != STRING_NOTFOUND ) { if( rWeight.Search( "emi" ) != STRING_NOTFOUND ) // semi, demi - eWeight = weight::SemiLight; + eWeight = WEIGHT_SEMILIGHT; else if( rWeight.Search( "ultra" ) != STRING_NOTFOUND ) - eWeight = weight::UltraLight; + eWeight = WEIGHT_ULTRALIGHT; else - eWeight = weight::Light; + eWeight = WEIGHT_LIGHT; } else if( rWeight.Search( "black" ) != STRING_NOTFOUND ) - eWeight = weight::Black; + eWeight = WEIGHT_BLACK; else if( rWeight.Equals( "demi" ) ) - eWeight = weight::SemiBold; + eWeight = WEIGHT_SEMIBOLD; else if( rWeight.Equals( "book" ) || rWeight.Equals( "semicondensed" ) ) - eWeight = weight::Light; + eWeight = WEIGHT_LIGHT; else if( rWeight.Equals( "medium" ) || rWeight.Equals( "roman" ) ) - eWeight = weight::Medium; + eWeight = WEIGHT_MEDIUM; else - eWeight = weight::Normal; + eWeight = WEIGHT_NORMAL; return eWeight; } // ------------------------------------------------------------------------- -static width::type parseWidth( const ByteString& rWidth ) +static FontWidth parseWidth( const ByteString& rWidth ) { - width::type eWidth = width::Unknown; + FontWidth eWidth = WIDTH_DONTKNOW; if( rWidth.Equals( "bold" ) || rWidth.Equals( "semiexpanded" ) ) - eWidth = width::SemiExpanded; + eWidth = WIDTH_SEMI_EXPANDED; else if( rWidth.Equals( "condensed" ) || rWidth.Equals( "narrow" ) ) - eWidth = width::Condensed; + eWidth = WIDTH_CONDENSED; else if( rWidth.Equals( "double wide" ) || rWidth.Equals( "extraexpanded" ) || rWidth.Equals( "ultraexpanded" ) ) - eWidth = width::UltraExpanded; + eWidth = WIDTH_ULTRA_EXPANDED; else if( rWidth.Equals( "expanded" ) || rWidth.Equals( "wide" ) ) - eWidth = width::Expanded; + eWidth = WIDTH_EXPANDED; else if( rWidth.Equals( "extracondensed" ) ) - eWidth = width::ExtraCondensed; + eWidth = WIDTH_EXTRA_CONDENSED; else if( rWidth.Equals( "semicondensed" ) ) - eWidth = width::SemiCondensed; + eWidth = WIDTH_SEMI_CONDENSED; else if( rWidth.Equals( "ultracondensed" ) ) - eWidth = width::UltraCondensed; + eWidth = WIDTH_ULTRA_CONDENSED; else - eWidth = width::Normal; + eWidth = WIDTH_NORMAL; return eWidth; } @@ -344,10 +355,10 @@ PrintFontManager::PrintFont::PrintFont( fonttype::type eType ) : m_eType( eType ), m_nFamilyName( 0 ), m_nPSName( 0 ), - m_eItalic( italic::Unknown ), - m_eWidth( width::Unknown ), - m_eWeight( weight::Unknown ), - m_ePitch( pitch::Unknown ), + m_eItalic( ITALIC_DONTKNOW ), + m_eWidth( WIDTH_DONTKNOW ), + m_eWeight( WEIGHT_DONTKNOW ), + m_ePitch( PITCH_DONTKNOW ), m_aEncoding( RTL_TEXTENCODING_DONTKNOW ), m_bFontEncodingOnly( false ), m_pMetrics( NULL ), @@ -489,8 +500,8 @@ bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomPr if( pImplTTFont->nkern && pImplTTFont->kerntype == KT_MICROSOFT ) { // create a glyph -> character mapping - ::std::hash_map< sal_uInt16, sal_Unicode > aGlyphMap; - ::std::hash_map< sal_uInt16, sal_Unicode >::iterator left, right; + ::boost::unordered_map< sal_uInt16, sal_Unicode > aGlyphMap; + ::boost::unordered_map< sal_uInt16, sal_Unicode >::iterator left, right; for( i = 21; i < 0xfffd; i++ ) { sal_uInt16 nGlyph = MapChar( pTTFont, (sal_Unicode)i, 0 ); // kerning for horz only @@ -589,8 +600,8 @@ bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomPr if( pImplTTFont->nkern && pImplTTFont->kerntype == KT_APPLE_NEW ) { // create a glyph -> character mapping - ::std::hash_map< sal_uInt16, sal_Unicode > aGlyphMap; - ::std::hash_map< sal_uInt16, sal_Unicode >::iterator left, right; + ::boost::unordered_map< sal_uInt16, sal_Unicode > aGlyphMap; + ::boost::unordered_map< sal_uInt16, sal_Unicode >::iterator left, right; for( i = 21; i < 0xfffd; i++ ) { sal_uInt16 nGlyph = MapChar( pTTFont, (sal_Unicode)i, 0 ); // kerning for horz only @@ -707,7 +718,7 @@ bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomPr } #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "found %d/%d kern pairs for %s\n", + fprintf( stderr, "found %" SAL_PRI_SIZET "u/%" SAL_PRI_SIZET "u kern pairs for %s\n", m_pMetrics->m_aXKernPairs.size(), m_pMetrics->m_aYKernPairs.size(), OUStringToOString( pProvider->getString( ATOM_FAMILYNAME, m_nFamilyName ), RTL_TEXTENCODING_MS_1252 ).getStr() ); @@ -733,7 +744,7 @@ bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomPr */ static bool familyNameOverride( const OUString& i_rPSname, OUString& o_rFamilyName ) { - static std::hash_map< OUString, OUString, OUStringHash > aPSNameToFamily( 16 ); + static boost::unordered_map< OUString, OUString, OUStringHash > aPSNameToFamily( 16 ); if( aPSNameToFamily.empty() ) // initialization { aPSNameToFamily[ OUString( RTL_CONSTASCII_USTRINGPARAM( "Helvetica-Narrow" ) ) ] = @@ -745,7 +756,7 @@ static bool familyNameOverride( const OUString& i_rPSname, OUString& o_rFamilyNa aPSNameToFamily[ OUString( RTL_CONSTASCII_USTRINGPARAM( "Helvetica-Narrow-Oblique" ) ) ] = OUString( RTL_CONSTASCII_USTRINGPARAM( "Helvetica Narrow" ) ); } - std::hash_map<OUString,OUString,OUStringHash>::const_iterator it = + boost::unordered_map<OUString,OUString,OUStringHash>::const_iterator it = aPSNameToFamily.find( i_rPSname ); bool bReplaced = (it != aPSNameToFamily.end() ); if( bReplaced ) @@ -757,7 +768,6 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult { PrintFontManager& rManager( PrintFontManager::get() ); - int i; FontInfo* pInfo = NULL; parseFile( rFileName.getStr(), &pInfo, P_ALL ); if( ! pInfo || ! pInfo->numOfChars ) @@ -802,11 +812,11 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult // italic if( pInfo->gfi->italicAngle > 0 ) - m_eItalic = italic::Oblique; + m_eItalic = ITALIC_OBLIQUE; else if( pInfo->gfi->italicAngle < 0 ) - m_eItalic = italic::Italic; + m_eItalic = ITALIC_NORMAL; else - m_eItalic = italic::Upright; + m_eItalic = ITALIC_NONE; // weight ByteString aLowerWeight( pInfo->gfi->weight ); @@ -814,7 +824,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult m_eWeight = parseWeight( aLowerWeight ); // pitch - m_ePitch = pInfo->gfi->isFixedPitch ? pitch::Fixed : pitch::Variable; + m_ePitch = pInfo->gfi->isFixedPitch ? PITCH_FIXED : PITCH_VARIABLE; // encoding - only set if unknown int nAdobeEncoding = 0; @@ -858,7 +868,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult RTL_TEXTENCODING_JIS_X_0208 }; - for( unsigned int enc = 0; enc < sizeof( aEncs )/sizeof(aEncs[0]) && m_aEncoding == RTL_TEXTENCODING_DONTKNOW; enc++ ) + for( unsigned int enc = 0; enc < SAL_N_ELEMENTS( aEncs ) && m_aEncoding == RTL_TEXTENCODING_DONTKNOW; enc++ ) { sal_Int32 nIndex = 0, nOffset = 1; do @@ -971,6 +981,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult // note: this only works with single byte encodings sal_Unicode* pUnicodes = (sal_Unicode*)alloca( pInfo->numOfChars * sizeof(sal_Unicode)); CharMetricInfo* pChar = pInfo->cmi; + int i; for( i = 0; i < pInfo->numOfChars; i++, pChar++ ) { @@ -1085,8 +1096,8 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult } else if( pChar->code != -1 ) { - ::std::pair< ::std::hash_multimap< sal_uInt8, sal_Unicode >::const_iterator, - ::std::hash_multimap< sal_uInt8, sal_Unicode >::const_iterator > + ::std::pair< ::boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator, + ::boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator > aCodes = rManager.getUnicodeFromAdobeCode( pChar->code ); while( aCodes.first != aCodes.second ) { @@ -1169,13 +1180,14 @@ OString PrintFontManager::s_aEmptyOString; */ PrintFontManager& PrintFontManager::get() { - static PrintFontManager* theManager = NULL; - if( ! theManager ) + static PrintFontManager* pManager = NULL; + if( ! pManager ) { - theManager = new PrintFontManager(); - theManager->initialize(); + static PrintFontManager theManager; + pManager = &theManager; + pManager->initialize(); } - return *theManager; + return *pManager; } // ------------------------------------------------------------------------- @@ -1191,24 +1203,15 @@ PrintFontManager::PrintFontManager() : m_pFontCache( NULL ), m_bFontconfigSuccess( false ) { - for( unsigned int i = 0; i < sizeof( aAdobeCodes )/sizeof( aAdobeCodes[0] ); i++ ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS( aAdobeCodes ); i++ ) { - m_aUnicodeToAdobename.insert( ::std::hash_multimap< sal_Unicode, ::rtl::OString >::value_type( aAdobeCodes[i].aUnicode, aAdobeCodes[i].pAdobename ) ); - m_aAdobenameToUnicode.insert( ::std::hash_multimap< ::rtl::OString, sal_Unicode, ::rtl::OStringHash >::value_type( aAdobeCodes[i].pAdobename, aAdobeCodes[i].aUnicode ) ); - if( aAdobeCodes[i].aAdobeStandardCode ) - { - m_aUnicodeToAdobecode.insert( ::std::hash_multimap< sal_Unicode, sal_uInt8 >::value_type( aAdobeCodes[i].aUnicode, aAdobeCodes[i].aAdobeStandardCode ) ); - m_aAdobecodeToUnicode.insert( ::std::hash_multimap< sal_uInt8, sal_Unicode >::value_type( aAdobeCodes[i].aAdobeStandardCode, aAdobeCodes[i].aUnicode ) ); - } -#if 0 - m_aUnicodeToAdobename[ aAdobeCodes[i].aUnicode ] = aAdobeCodes[i].pAdobename; - m_aAdobenameToUnicode[ aAdobeCodes[i].pAdobename ] = aAdobeCodes[i].aUnicode; + m_aUnicodeToAdobename.insert( ::boost::unordered_multimap< sal_Unicode, ::rtl::OString >::value_type( aAdobeCodes[i].aUnicode, aAdobeCodes[i].pAdobename ) ); + m_aAdobenameToUnicode.insert( ::boost::unordered_multimap< ::rtl::OString, sal_Unicode, ::rtl::OStringHash >::value_type( aAdobeCodes[i].pAdobename, aAdobeCodes[i].aUnicode ) ); if( aAdobeCodes[i].aAdobeStandardCode ) { - m_aUnicodeToAdobecode[ aAdobeCodes[i].aUnicode ] = aAdobeCodes[i].aAdobeStandardCode; - m_aAdobecodeToUnicode[ aAdobeCodes[i].aAdobeStandardCode ] = aAdobeCodes[i].aUnicode; + m_aUnicodeToAdobecode.insert( ::boost::unordered_multimap< sal_Unicode, sal_uInt8 >::value_type( aAdobeCodes[i].aUnicode, aAdobeCodes[i].aAdobeStandardCode ) ); + m_aAdobecodeToUnicode.insert( ::boost::unordered_multimap< sal_uInt8, sal_Unicode >::value_type( aAdobeCodes[i].aAdobeStandardCode, aAdobeCodes[i].aUnicode ) ); } -#endif } } @@ -1217,7 +1220,7 @@ PrintFontManager::PrintFontManager() : PrintFontManager::~PrintFontManager() { deinitFontconfig(); - for( ::std::hash_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it ) + for( ::boost::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it ) delete (*it).second; delete m_pAtoms; if( m_pFontCache ) @@ -1228,7 +1231,7 @@ PrintFontManager::~PrintFontManager() const OString& PrintFontManager::getDirectory( int nAtom ) const { - ::std::hash_map< int, OString >::const_iterator it( m_aAtomToDir.find( nAtom ) ); + ::boost::unordered_map< int, OString >::const_iterator it( m_aAtomToDir.find( nAtom ) ); return it != m_aAtomToDir.end() ? it->second : s_aEmptyOString; } @@ -1237,7 +1240,7 @@ const OString& PrintFontManager::getDirectory( int nAtom ) const int PrintFontManager::getDirectoryAtom( const OString& rDirectory, bool bCreate ) { int nAtom = 0; - ::std::hash_map< OString, int, OStringHash >::const_iterator it + ::boost::unordered_map< OString, int, OStringHash >::const_iterator it ( m_aDirToAtom.find( rDirectory ) ); if( it != m_aDirToAtom.end() ) nAtom = it->second; @@ -1301,7 +1304,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co // first look for an adjacent file static const char* pSuffix[] = { ".afm", ".AFM" }; - for( unsigned int i = 0; i < sizeof(pSuffix)/sizeof(pSuffix[0]); i++ ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS(pSuffix); i++ ) { ByteString aName( rFontFile ); aName.Erase( aName.Len()-4 ); @@ -1421,7 +1424,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co fontID PrintFontManager::findFontBuiltinID( int nPSNameAtom ) const { fontID nID = 0; - ::std::hash_map< fontID, PrintFont* >::const_iterator it; + ::boost::unordered_map< fontID, PrintFont* >::const_iterator it; for( it = m_aFonts.begin(); nID == 0 && it != m_aFonts.end(); ++it ) { if( it->second->m_eType == fonttype::Builtin && @@ -1437,12 +1440,12 @@ fontID PrintFontManager::findFontFileID( int nDirID, const OString& rFontFile ) { fontID nID = 0; - ::std::hash_map< OString, ::std::set< fontID >, OStringHash >::const_iterator set_it = m_aFontFileToFontID.find( rFontFile ); + ::boost::unordered_map< OString, ::std::set< fontID >, OStringHash >::const_iterator set_it = m_aFontFileToFontID.find( rFontFile ); if( set_it != m_aFontFileToFontID.end() ) { for( ::std::set< fontID >::const_iterator font_it = set_it->second.begin(); font_it != set_it->second.end() && ! nID; ++font_it ) { - ::std::hash_map< fontID, PrintFont* >::const_iterator it = m_aFonts.find( *font_it ); + ::boost::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.find( *font_it ); if( it != m_aFonts.end() ) { switch( it->second->m_eType ) @@ -1529,9 +1532,9 @@ bool PrintFontManager::parseXLFD( const OString& rXLFD, XLFDEntry& rEntry ) // evaluate pitch if( aPitch.toChar() == 'c' || aPitch.toChar() == 'm' ) - rEntry.ePitch = pitch::Fixed; + rEntry.ePitch = PITCH_FIXED; else - rEntry.ePitch = pitch::Variable; + rEntry.ePitch = PITCH_VARIABLE; OString aToken = aEnc.toAsciiLowerCase(); // get encoding @@ -1691,42 +1694,42 @@ OString PrintFontManager::getXLFD( PrintFont* pFont ) const aXLFD.append( '-' ); switch( pFont->m_eWeight ) { - case weight::Thin: aXLFD.append("thin");break; - case weight::UltraLight: aXLFD.append("ultralight");break; - case weight::Light: aXLFD.append("light");break; - case weight::SemiLight: aXLFD.append("semilight");break; - case weight::Normal: aXLFD.append("normal");break; - case weight::Medium: aXLFD.append("medium");break; - case weight::SemiBold: aXLFD.append("semibold");break; - case weight::Bold: aXLFD.append("bold");break; - case weight::UltraBold: aXLFD.append("ultrabold");break; - case weight::Black: aXLFD.append("black");break; + case WEIGHT_THIN: aXLFD.append("thin");break; + case WEIGHT_ULTRALIGHT: aXLFD.append("ultralight");break; + case WEIGHT_LIGHT: aXLFD.append("light");break; + case WEIGHT_SEMILIGHT: aXLFD.append("semilight");break; + case WEIGHT_NORMAL: aXLFD.append("normal");break; + case WEIGHT_MEDIUM: aXLFD.append("medium");break; + case WEIGHT_SEMIBOLD: aXLFD.append("semibold");break; + case WEIGHT_BOLD: aXLFD.append("bold");break; + case WEIGHT_ULTRABOLD: aXLFD.append("ultrabold");break; + case WEIGHT_BLACK: aXLFD.append("black");break; default: break; } aXLFD.append('-'); switch( pFont->m_eItalic ) { - case italic::Upright: aXLFD.append('r');break; - case italic::Oblique: aXLFD.append('o');break; - case italic::Italic: aXLFD.append('i');break; + case ITALIC_NONE: aXLFD.append('r');break; + case ITALIC_OBLIQUE: aXLFD.append('o');break; + case ITALIC_NORMAL: aXLFD.append('i');break; default: break; } aXLFD.append('-'); switch( pFont->m_eWidth ) { - case width::UltraCondensed: aXLFD.append("ultracondensed");break; - case width::ExtraCondensed: aXLFD.append("extracondensed");break; - case width::Condensed: aXLFD.append("condensed");break; - case width::SemiCondensed: aXLFD.append("semicondensed");break; - case width::Normal: aXLFD.append("normal");break; - case width::SemiExpanded: aXLFD.append("semiexpanded");break; - case width::Expanded: aXLFD.append("expanded");break; - case width::ExtraExpanded: aXLFD.append("extraexpanded");break; - case width::UltraExpanded: aXLFD.append("ultraexpanded");break; + case WIDTH_ULTRA_CONDENSED: aXLFD.append("ultracondensed");break; + case WIDTH_EXTRA_CONDENSED: aXLFD.append("extracondensed");break; + case WIDTH_CONDENSED: aXLFD.append("condensed");break; + case WIDTH_SEMI_CONDENSED: aXLFD.append("semicondensed");break; + case WIDTH_NORMAL: aXLFD.append("normal");break; + case WIDTH_SEMI_EXPANDED: aXLFD.append("semiexpanded");break; + case WIDTH_EXPANDED: aXLFD.append("expanded");break; + case WIDTH_EXTRA_EXPANDED: aXLFD.append("extraexpanded");break; + case WIDTH_ULTRA_EXPANDED: aXLFD.append("ultraexpanded");break; default: break; } aXLFD.append("-utf8-0-0-0-0-"); - aXLFD.append( pFont->m_ePitch == pitch::Fixed ? "m" : "p" ); + aXLFD.append( pFont->m_ePitch == PITCH_FIXED ? "m" : "p" ); aXLFD.append("-0-"); const char* pEnc = rtl_getBestUnixCharsetFromTextEncoding( pFont->m_aEncoding ); if( ! pEnc ) @@ -1804,6 +1807,29 @@ OUString PrintFontManager::convertTrueTypeName( void* pRecord ) const return aValue; } +//fdo#33349.There exists an archaic Berling Antiqua font which has a "Times New +//Roman" name field in it. We don't want the "Times New Roman" name to take +//precedence in this case. We take Berling Antiqua as a higher priority name, +//and erase the "Times New Roman" name +namespace +{ + bool isBadTNR(const OUString &rName, ::std::set< OUString >& rSet) + { + bool bRet = false; + if (rName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Berling Antiqua"))) + { + ::std::set< OUString >::iterator aEnd = rSet.end(); + ::std::set< OUString >::iterator aI = rSet.find(OUString(RTL_CONSTASCII_USTRINGPARAM("Times New Roman"))); + if (aI != aEnd) + { + bRet = true; + rSet.erase(aI); + } + } + return bRet; + } +} + // ------------------------------------------------------------------------- void PrintFontManager::analyzeTrueTypeFamilyName( void* pTTFont, ::std::list< OUString >& rNames ) const @@ -1841,7 +1867,7 @@ void PrintFontManager::analyzeTrueTypeFamilyName( void* pTTFont, ::std::list< OU } OUString aName = convertTrueTypeName( pNameRecords + i ); aSet.insert( aName ); - if( nMatch > nLastMatch ) + if( nMatch > nLastMatch || isBadTNR(aName, aSet) ) { nLastMatch = nMatch; aFamily = aName; @@ -1920,40 +1946,40 @@ bool PrintFontManager::analyzeTrueTypeFile( PrintFont* pFont ) const pFont->m_nPSName = m_pAtoms->getAtom( ATOM_PSNAME, String( ByteString( aInfo.psname ), aEncoding ), sal_True ); switch( aInfo.weight ) { - case FW_THIN: pFont->m_eWeight = weight::Thin; break; - case FW_EXTRALIGHT: pFont->m_eWeight = weight::UltraLight; break; - case FW_LIGHT: pFont->m_eWeight = weight::Light; break; - case FW_MEDIUM: pFont->m_eWeight = weight::Medium; break; - case FW_SEMIBOLD: pFont->m_eWeight = weight::SemiBold; break; - case FW_BOLD: pFont->m_eWeight = weight::Bold; break; - case FW_EXTRABOLD: pFont->m_eWeight = weight::UltraBold; break; - case FW_BLACK: pFont->m_eWeight = weight::Black; break; + case FW_THIN: pFont->m_eWeight = WEIGHT_THIN; break; + case FW_EXTRALIGHT: pFont->m_eWeight = WEIGHT_ULTRALIGHT; break; + case FW_LIGHT: pFont->m_eWeight = WEIGHT_LIGHT; break; + case FW_MEDIUM: pFont->m_eWeight = WEIGHT_MEDIUM; break; + case FW_SEMIBOLD: pFont->m_eWeight = WEIGHT_SEMIBOLD; break; + case FW_BOLD: pFont->m_eWeight = WEIGHT_BOLD; break; + case FW_EXTRABOLD: pFont->m_eWeight = WEIGHT_ULTRABOLD; break; + case FW_BLACK: pFont->m_eWeight = WEIGHT_BLACK; break; case FW_NORMAL: - default: pFont->m_eWeight = weight::Normal; break; + default: pFont->m_eWeight = WEIGHT_NORMAL; break; } switch( aInfo.width ) { - case FWIDTH_ULTRA_CONDENSED: pFont->m_eWidth = width::UltraCondensed; break; - case FWIDTH_EXTRA_CONDENSED: pFont->m_eWidth = width::ExtraCondensed; break; - case FWIDTH_CONDENSED: pFont->m_eWidth = width::Condensed; break; - case FWIDTH_SEMI_CONDENSED: pFont->m_eWidth = width::SemiCondensed; break; - case FWIDTH_SEMI_EXPANDED: pFont->m_eWidth = width::SemiExpanded; break; - case FWIDTH_EXPANDED: pFont->m_eWidth = width::Expanded; break; - case FWIDTH_EXTRA_EXPANDED: pFont->m_eWidth = width::ExtraExpanded; break; - case FWIDTH_ULTRA_EXPANDED: pFont->m_eWidth = width::UltraExpanded; break; + case FWIDTH_ULTRA_CONDENSED: pFont->m_eWidth = WIDTH_ULTRA_CONDENSED; break; + case FWIDTH_EXTRA_CONDENSED: pFont->m_eWidth = WIDTH_EXTRA_CONDENSED; break; + case FWIDTH_CONDENSED: pFont->m_eWidth = WIDTH_CONDENSED; break; + case FWIDTH_SEMI_CONDENSED: pFont->m_eWidth = WIDTH_SEMI_CONDENSED; break; + case FWIDTH_SEMI_EXPANDED: pFont->m_eWidth = WIDTH_SEMI_EXPANDED; break; + case FWIDTH_EXPANDED: pFont->m_eWidth = WIDTH_EXPANDED; break; + case FWIDTH_EXTRA_EXPANDED: pFont->m_eWidth = WIDTH_EXTRA_EXPANDED; break; + case FWIDTH_ULTRA_EXPANDED: pFont->m_eWidth = WIDTH_ULTRA_EXPANDED; break; case FWIDTH_NORMAL: - default: pFont->m_eWidth = width::Normal; break; + default: pFont->m_eWidth = WIDTH_NORMAL; break; } - pFont->m_ePitch = aInfo.pitch ? pitch::Fixed : pitch::Variable; - pFont->m_eItalic = aInfo.italicAngle == 0 ? italic::Upright : ( aInfo.italicAngle < 0 ? italic::Italic : italic::Oblique ); + pFont->m_ePitch = aInfo.pitch ? PITCH_FIXED : PITCH_VARIABLE; + pFont->m_eItalic = aInfo.italicAngle == 0 ? ITALIC_NONE : ( aInfo.italicAngle < 0 ? ITALIC_NORMAL : ITALIC_OBLIQUE ); // #104264# there are fonts that set italic angle 0 although they are // italic; use macstyle bit here if( aInfo.italicAngle == 0 && (aInfo.macStyle & 2) ) - pFont->m_eItalic = italic::Italic; + pFont->m_eItalic = ITALIC_NORMAL; pFont->m_aEncoding = aInfo.symbolEncoded ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UCS2; @@ -2104,7 +2130,7 @@ void PrintFontManager::initialize() // initialize may be called twice in the future { - for( ::std::hash_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it ) + for( ::boost::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it ) delete (*it).second; m_nNextFontID = 1; m_aFonts.clear(); @@ -2156,7 +2182,7 @@ void PrintFontManager::initialize() } // protect against duplicate paths - std::hash_map< OString, int, OStringHash > visited_dirs; + boost::unordered_map< OString, int, OStringHash > visited_dirs; // now that all global and local font dirs are known to fontconfig // check that there are fonts actually managed by fontconfig @@ -2222,7 +2248,7 @@ void PrintFontManager::initialize() if( pDIR ) { // read fonts.dir if possible - ::std::hash_map< OString, ::std::list<OString>, OStringHash > aFontsDir; + ::boost::unordered_map< OString, ::std::list<OString>, OStringHash > aFontsDir; int nDirID = getDirectoryAtom( aPath, true ); // #i38367# no fonts.dir in our own directories anymore std::list< int >::const_iterator priv_dir; @@ -2270,7 +2296,7 @@ void PrintFontManager::initialize() if( findFontFileID( nDirID, aFileName ) == 0 ) { ::std::list<OString> aXLFDs; - ::std::hash_map< OString, ::std::list<OString>, OStringHash >::const_iterator it = + ::boost::unordered_map< OString, ::std::list<OString>, OStringHash >::const_iterator it = aFontsDir.find( aFileName ); if( it != aFontsDir.end() ) aXLFDs = (*it).second; @@ -2401,22 +2427,22 @@ void PrintFontManager::initialize() #endif // part three - fill in family styles - ::std::hash_map< fontID, PrintFont* >::iterator font_it; + ::boost::unordered_map< fontID, PrintFont* >::iterator font_it; for (font_it = m_aFonts.begin(); font_it != m_aFonts.end(); ++font_it) { - ::std::hash_map< int, family::type >::const_iterator it = + ::boost::unordered_map< int, FontFamily >::const_iterator it = m_aFamilyTypes.find( font_it->second->m_nFamilyName ); if (it != m_aFamilyTypes.end()) continue; const ::rtl::OUString& rFamily = m_pAtoms->getString( ATOM_FAMILYNAME, font_it->second->m_nFamilyName); - family::type eType = matchFamilyName( rFamily ); + FontFamily eType = matchFamilyName( rFamily ); m_aFamilyTypes[ font_it->second->m_nFamilyName ] = eType; } #if OSL_DEBUG_LEVEL > 1 aStep3 = times( &tms ); - fprintf( stderr, "PrintFontManager::initialize: collected %d fonts (%d builtin, %d cached)\n", m_aFonts.size(), nBuiltinFonts, nCached ); + fprintf( stderr, "PrintFontManager::initialize: collected %" SAL_PRI_SIZET "u fonts (%d builtin, %d cached)\n", m_aFonts.size(), nBuiltinFonts, nCached ); double fTick = (double)sysconf( _SC_CLK_TCK ); fprintf( stderr, "Step 1 took %lf seconds\n", (double)(aStep1 - aStart)/fTick ); fprintf( stderr, "Step 2 took %lf seconds\n", (double)(aStep2 - aStep1)/fTick ); @@ -2433,22 +2459,22 @@ void PrintFontManager::initialize() // ------------------------------------------------------------------------- inline bool -equalPitch (psp::pitch::type from, psp::pitch::type to) +equalPitch (FontPitch from, FontPitch to) { return from == to; } inline bool -equalWeight (psp::weight::type from, psp::weight::type to) +equalWeight (FontWeight from, FontWeight to) { return from > to ? (from - to) <= 3 : (to - from) <= 3; } inline bool -equalItalic (psp::italic::type from, psp::italic::type to) +equalItalic (FontItalic from, FontItalic to) { - if ( (from == psp::italic::Italic) || (from == psp::italic::Oblique) ) - return (to == psp::italic::Italic) || (to == psp::italic::Oblique); + if ( (from == ITALIC_NORMAL) || (from == ITALIC_OBLIQUE) ) + return (to == ITALIC_NORMAL) || (to == ITALIC_OBLIQUE); return to == from; } inline bool @@ -2463,15 +2489,15 @@ namespace { struct BuiltinFontIdentifier { OUString aFamily; - italic::type eItalic; - weight::type eWeight; - pitch::type ePitch; + FontItalic eItalic; + FontWeight eWeight; + FontPitch ePitch; rtl_TextEncoding aEncoding; BuiltinFontIdentifier( const OUString& rFam, - italic::type eIt, - weight::type eWg, - pitch::type ePt, + FontItalic eIt, + FontWeight eWg, + FontPitch ePt, rtl_TextEncoding enc ) : aFamily( rFam ), eItalic( eIt ), @@ -2502,7 +2528,7 @@ namespace { void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDParser* pParser, bool bUseOverrideMetrics ) { rFontIDs.clear(); - std::hash_map< fontID, PrintFont* >::const_iterator it; + boost::unordered_map< fontID, PrintFont* >::const_iterator it; /* * Note: there are two easy steps making this faster: @@ -2524,7 +2550,7 @@ void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDPa if( pParser ) { std::set<int> aBuiltinPSNames; - std::hash_set< BuiltinFontIdentifier, + boost::unordered_set< BuiltinFontIdentifier, BuiltinFontIdentifierHash > aBuiltinFonts; @@ -2535,7 +2561,7 @@ void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDPa for( std::vector<fontID>::const_iterator over = m_aOverrideFonts.begin(); over != m_aOverrideFonts.end(); ++over ) { - std::hash_map<fontID,PrintFont*>::const_iterator font_it = m_aFonts.find( *over ); + boost::unordered_map<fontID,PrintFont*>::const_iterator font_it = m_aFonts.find( *over ); DBG_ASSERT( font_it != m_aFonts.end(), "override to nonexistant font" ); if( font_it != m_aFonts.end() ) aOverridePSNames[ font_it->second->m_nPSName ] = *over; @@ -2625,12 +2651,12 @@ void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDPa void PrintFontManager::fillPrintFontInfo( PrintFont* pFont, FastPrintFontInfo& rInfo ) const { - ::std::hash_map< int, family::type >::const_iterator style_it = + ::boost::unordered_map< int, FontFamily >::const_iterator style_it = m_aFamilyTypes.find( pFont->m_nFamilyName ); rInfo.m_eType = pFont->m_eType; rInfo.m_aFamilyName = m_pAtoms->getString( ATOM_FAMILYNAME, pFont->m_nFamilyName ); rInfo.m_aStyleName = pFont->m_aStyleName; - rInfo.m_eFamilyStyle = style_it != m_aFamilyTypes.end() ? style_it->second : family::Unknown; + rInfo.m_eFamilyStyle = style_it != m_aFamilyTypes.end() ? style_it->second : FAMILY_DONTKNOW; rInfo.m_eItalic = pFont->m_eItalic; rInfo.m_eWidth = pFont->m_eWidth; rInfo.m_eWeight = pFont->m_eWeight; @@ -2769,47 +2795,47 @@ int PrintFontManager::getFontFaceNumber( fontID nFontID ) const // ------------------------------------------------------------------------- -family::type PrintFontManager::matchFamilyName( const ::rtl::OUString& rFamily ) const +FontFamily PrintFontManager::matchFamilyName( const ::rtl::OUString& rFamily ) const { typedef struct { const char* mpName; sal_uInt16 mnLength; - family::type meType; + FontFamily meType; } family_t; #define InitializeClass( p, a ) p, sizeof(p) - 1, a const family_t pFamilyMatch[] = { - { InitializeClass( "arial", family::Swiss ) }, - { InitializeClass( "arioso", family::Script ) }, - { InitializeClass( "avant garde", family::Swiss ) }, - { InitializeClass( "avantgarde", family::Swiss ) }, - { InitializeClass( "bembo", family::Roman ) }, - { InitializeClass( "bookman", family::Roman ) }, - { InitializeClass( "conga", family::Roman ) }, - { InitializeClass( "courier", family::Modern ) }, - { InitializeClass( "curl", family::Script ) }, - { InitializeClass( "fixed", family::Modern ) }, - { InitializeClass( "gill", family::Swiss ) }, - { InitializeClass( "helmet", family::Modern ) }, - { InitializeClass( "helvetica", family::Swiss ) }, - { InitializeClass( "international", family::Modern ) }, - { InitializeClass( "lucida", family::Swiss ) }, - { InitializeClass( "new century schoolbook", family::Roman ) }, - { InitializeClass( "palatino", family::Roman ) }, - { InitializeClass( "roman", family::Roman ) }, - { InitializeClass( "sans serif", family::Swiss ) }, - { InitializeClass( "sansserif", family::Swiss ) }, - { InitializeClass( "serf", family::Roman ) }, - { InitializeClass( "serif", family::Roman ) }, - { InitializeClass( "times", family::Roman ) }, - { InitializeClass( "utopia", family::Roman ) }, - { InitializeClass( "zapf chancery", family::Script ) }, - { InitializeClass( "zapfchancery", family::Script ) } + { InitializeClass( "arial", FAMILY_SWISS ) }, + { InitializeClass( "arioso", FAMILY_SCRIPT ) }, + { InitializeClass( "avant garde", FAMILY_SWISS ) }, + { InitializeClass( "avantgarde", FAMILY_SWISS ) }, + { InitializeClass( "bembo", FAMILY_ROMAN ) }, + { InitializeClass( "bookman", FAMILY_ROMAN ) }, + { InitializeClass( "conga", FAMILY_ROMAN ) }, + { InitializeClass( "courier", FAMILY_MODERN ) }, + { InitializeClass( "curl", FAMILY_SCRIPT ) }, + { InitializeClass( "fixed", FAMILY_MODERN ) }, + { InitializeClass( "gill", FAMILY_SWISS ) }, + { InitializeClass( "helmet", FAMILY_MODERN ) }, + { InitializeClass( "helvetica", FAMILY_SWISS ) }, + { InitializeClass( "international", FAMILY_MODERN ) }, + { InitializeClass( "lucida", FAMILY_SWISS ) }, + { InitializeClass( "new century schoolbook", FAMILY_ROMAN ) }, + { InitializeClass( "palatino", FAMILY_ROMAN ) }, + { InitializeClass( "roman", FAMILY_ROMAN ) }, + { InitializeClass( "sans serif", FAMILY_SWISS ) }, + { InitializeClass( "sansserif", FAMILY_SWISS ) }, + { InitializeClass( "serf", FAMILY_ROMAN ) }, + { InitializeClass( "serif", FAMILY_ROMAN ) }, + { InitializeClass( "times", FAMILY_ROMAN ) }, + { InitializeClass( "utopia", FAMILY_ROMAN ) }, + { InitializeClass( "zapf chancery", FAMILY_SCRIPT ) }, + { InitializeClass( "zapfchancery", FAMILY_SCRIPT ) } }; rtl::OString aFamily = rtl::OUStringToOString( rFamily, RTL_TEXTENCODING_ASCII_US ); sal_uInt32 nLower = 0; - sal_uInt32 nUpper = sizeof(pFamilyMatch) / sizeof(pFamilyMatch[0]); + sal_uInt32 nUpper = SAL_N_ELEMENTS(pFamilyMatch); while( nLower < nUpper ) { @@ -2831,20 +2857,20 @@ family::type PrintFontManager::matchFamilyName( const ::rtl::OUString& rFamily ) return pHaystack->meType; } - return family::Unknown; + return FAMILY_DONTKNOW; } // ------------------------------------------------------------------------- -family::type PrintFontManager::getFontFamilyType( fontID nFontID ) const +FontFamily PrintFontManager::getFontFamilyType( fontID nFontID ) const { PrintFont* pFont = getFont( nFontID ); if( !pFont ) - return family::Unknown; + return FAMILY_DONTKNOW; - ::std::hash_map< int, family::type >::const_iterator it = + ::boost::unordered_map< int, FontFamily >::const_iterator it = m_aFamilyTypes.find( pFont->m_nFamilyName ); - return (it != m_aFamilyTypes.end()) ? it->second : family::Unknown; + return (it != m_aFamilyTypes.end()) ? it->second : FAMILY_DONTKNOW; } @@ -2896,7 +2922,7 @@ OString PrintFontManager::getFontFile( PrintFont* pFont ) const if( pFont && pFont->m_eType == fonttype::Type1 ) { Type1FontFile* pPSFont = static_cast< Type1FontFile* >(pFont); - ::std::hash_map< int, OString >::const_iterator it = m_aAtomToDir.find( pPSFont->m_nDirectory ); + ::boost::unordered_map< int, OString >::const_iterator it = m_aAtomToDir.find( pPSFont->m_nDirectory ); aPath = it->second; aPath += "/"; aPath += pPSFont->m_aFontFile; @@ -2904,7 +2930,7 @@ OString PrintFontManager::getFontFile( PrintFont* pFont ) const else if( pFont && pFont->m_eType == fonttype::TrueType ) { TrueTypeFontFile* pTTFont = static_cast< TrueTypeFontFile* >(pFont); - ::std::hash_map< int, OString >::const_iterator it = m_aAtomToDir.find( pTTFont->m_nDirectory ); + ::boost::unordered_map< int, OString >::const_iterator it = m_aAtomToDir.find( pTTFont->m_nDirectory ); aPath = it->second; aPath += "/"; aPath += pTTFont->m_aFontFile; @@ -3018,7 +3044,7 @@ void PrintFontManager::hasVerticalSubstitutions( fontID nFontID, if( ! pFont->m_pMetrics || ! ( pFont->m_pMetrics->m_aPages[ code >> 11 ] & ( 1 << ( ( code >> 8 ) & 7 ) ) ) ) pFont->queryMetricPage( code >> 8, m_pAtoms ); - ::std::hash_map< sal_Unicode, bool >::const_iterator it = pFont->m_pMetrics->m_bVerticalSubstitutions.find( code ); + ::boost::unordered_map< sal_Unicode, bool >::const_iterator it = pFont->m_pMetrics->m_bVerticalSubstitutions.find( code ); pHasSubst[i] = it != pFont->m_pMetrics->m_bVerticalSubstitutions.end(); } } @@ -3123,7 +3149,7 @@ bool PrintFontManager::getMetrics( fontID nFontID, const sal_Unicode* pString, i { int effectiveCode = pString[i]; effectiveCode |= bVertical ? 1 << 16 : 0; - ::std::hash_map< int, CharacterMetric >::const_iterator it = + ::boost::unordered_map< int, CharacterMetric >::const_iterator it = pFont->m_pMetrics->m_aMetrics.find( effectiveCode ); // if no vertical metrics are available assume rotated horizontal metrics if( bVertical && (it == pFont->m_pMetrics->m_aMetrics.end()) ) @@ -3141,6 +3167,10 @@ bool PrintFontManager::getMetrics( fontID nFontID, const sal_Unicode* pString, i bool PrintFontManager::getMetrics( fontID nFontID, sal_Unicode minCharacter, sal_Unicode maxCharacter, CharacterMetric* pArray, bool bVertical ) const { + OSL_PRECOND(minCharacter <= maxCharacter, "invalid char. range"); + if (minCharacter > maxCharacter) + return false; + PrintFont* pFont = getFont( nFontID ); if( ! pFont ) return false; @@ -3168,7 +3198,7 @@ bool PrintFontManager::getMetrics( fontID nFontID, sal_Unicode minCharacter, sal { int effectiveCode = code; effectiveCode |= bVertical ? 1 << 16 : 0; - ::std::hash_map< int, CharacterMetric >::const_iterator it = + ::boost::unordered_map< int, CharacterMetric >::const_iterator it = pFont->m_pMetrics->m_aMetrics.find( effectiveCode ); // if no vertical metrics are available assume rotated horizontal metrics if( bVertical && (it == pFont->m_pMetrics->m_aMetrics.end()) ) @@ -3327,7 +3357,7 @@ int PrintFontManager::importFonts( const ::std::list< OString >& rFiles, bool bL { // remove all fonts for the same file // discarding their font ids - ::std::hash_map< fontID, PrintFont* >::iterator current, next; + ::boost::unordered_map< fontID, PrintFont* >::iterator current, next; current = m_aFonts.begin(); OString aFileName( OUStringToOString( aTo.GetName(), aEncoding ) ); while( current != m_aFonts.end() ) @@ -3483,7 +3513,7 @@ bool PrintFontManager::getFileDuplicates( fontID nFont, ::std::list< fontID >& r if( ! aFile.getLength() ) return false; - for( ::std::hash_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it ) + for( ::boost::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it ) { if( nFont != it->first ) { @@ -3506,7 +3536,7 @@ bool PrintFontManager::removeFonts( const ::std::list< fontID >& rFonts ) ::std::list< fontID > aDuplicates; for( ::std::list< fontID >::const_iterator it = rFonts.begin(); it != rFonts.end(); ++it ) { - ::std::hash_map< fontID, PrintFont* >::const_iterator haveFont = m_aFonts.find( *it ); + ::boost::unordered_map< fontID, PrintFont* >::const_iterator haveFont = m_aFonts.find( *it ); if( haveFont == m_aFonts.end() ) continue; @@ -3842,7 +3872,7 @@ void PrintFontManager::getGlyphWidths( fontID nFont, rUnicodeEnc.clear(); rWidths.clear(); rWidths.reserve( pFont->m_pMetrics->m_aMetrics.size() ); - for( std::hash_map< int, CharacterMetric >::const_iterator it = + for( boost::unordered_map< int, CharacterMetric >::const_iterator it = pFont->m_pMetrics->m_aMetrics.begin(); it != pFont->m_pMetrics->m_aMetrics.end(); ++it ) { @@ -3879,8 +3909,8 @@ const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( font std::list< OString > PrintFontManager::getAdobeNameFromUnicode( sal_Unicode aChar ) const { - std::pair< std::hash_multimap< sal_Unicode, rtl::OString >::const_iterator, - std::hash_multimap< sal_Unicode, rtl::OString >::const_iterator > range + std::pair< boost::unordered_multimap< sal_Unicode, rtl::OString >::const_iterator, + boost::unordered_multimap< sal_Unicode, rtl::OString >::const_iterator > range = m_aUnicodeToAdobename.equal_range( aChar ); std::list< OString > aRet; @@ -3900,8 +3930,8 @@ std::list< OString > PrintFontManager::getAdobeNameFromUnicode( sal_Unicode aCha // ------------------------------------------------------------------------- std::list< sal_Unicode > PrintFontManager::getUnicodeFromAdobeName( const rtl::OString& rName ) const { - std::pair< std::hash_multimap< rtl::OString, sal_Unicode, rtl::OStringHash >::const_iterator, - std::hash_multimap< rtl::OString, sal_Unicode, rtl::OStringHash >::const_iterator > range + std::pair< boost::unordered_multimap< rtl::OString, sal_Unicode, rtl::OStringHash >::const_iterator, + boost::unordered_multimap< rtl::OString, sal_Unicode, rtl::OStringHash >::const_iterator > range = m_aAdobenameToUnicode.equal_range( rName ); std::list< sal_Unicode > aRet; @@ -3976,53 +4006,53 @@ bool PrintFontManager::readOverrideMetrics() const NamedValue* pProps = aMetrics.getConstArray(); for( sal_Int32 n = 0; n < nProps; n++ ) { - if( pProps[n].Name.equalsAscii( "FamilyName" ) ) + if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FamilyName" ) ) ) pFont->m_nFamilyName = m_pAtoms->getAtom( ATOM_FAMILYNAME, getString(pProps[n].Value), sal_True ); - else if( pProps[n].Name.equalsAscii( "PSName" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PSName" ) ) ) pFont->m_nPSName = m_pAtoms->getAtom( ATOM_PSNAME, getString(pProps[n].Value), sal_True ); - else if( pProps[n].Name.equalsAscii( "StyleName" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StyleName" ) ) ) pFont->m_aStyleName = getString(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "Italic" ) ) - pFont->m_eItalic = static_cast<italic::type>(getInt(pProps[n].Value)); - else if( pProps[n].Name.equalsAscii( "Width" ) ) - pFont->m_eWidth = static_cast<width::type>(getInt(pProps[n].Value)); - else if( pProps[n].Name.equalsAscii( "Weight" ) ) - pFont->m_eWeight = static_cast<weight::type>(getInt(pProps[n].Value)); - else if( pProps[n].Name.equalsAscii( "Pitch" ) ) - pFont->m_ePitch = static_cast<pitch::type>(getInt(pProps[n].Value)); - else if( pProps[n].Name.equalsAscii( "Encoding" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Italic" ) ) ) + pFont->m_eItalic = static_cast<FontItalic>(getInt(pProps[n].Value)); + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Width" ) ) ) + pFont->m_eWidth = static_cast<FontWidth>(getInt(pProps[n].Value)); + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Weight" ) ) ) + pFont->m_eWeight = static_cast<FontWeight>(getInt(pProps[n].Value)); + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Pitch" ) ) ) + pFont->m_ePitch = static_cast<FontPitch>(getInt(pProps[n].Value)); + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Encoding" ) ) ) pFont->m_aEncoding = static_cast<rtl_TextEncoding>(getInt(pProps[n].Value)); - else if( pProps[n].Name.equalsAscii( "FontEncodingOnly" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FontEncodingOnly" ) ) ) pFont->m_bFontEncodingOnly = getBool(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "GlobalMetricXWidth" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GlobalMetricXWidth" ) ) ) pFont->m_aGlobalMetricX.width = getInt(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "GlobalMetricXHeight" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GlobalMetricXHeight" ) ) ) pFont->m_aGlobalMetricX.height = getInt(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "GlobalMetricYWidth" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GlobalMetricYWidth" ) ) ) pFont->m_aGlobalMetricY.width = getInt(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "GlobalMetricYHeight" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GlobalMetricYHeight" ) ) ) pFont->m_aGlobalMetricY.height = getInt(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "Ascend" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Ascend" ) ) ) pFont->m_nAscend = getInt(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "Descend" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Descend" ) ) ) pFont->m_nDescend = getInt(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "Leading" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Leading" ) ) ) pFont->m_nLeading = getInt(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "XMin" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "XMin" ) ) ) pFont->m_nXMin = getInt(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "YMin" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "YMin" ) ) ) pFont->m_nYMin = getInt(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "XMax" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "XMax" ) ) ) pFont->m_nXMax = getInt(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "YMax" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "YMax" ) ) ) pFont->m_nYMax = getInt(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "VerticalSubstitutes" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VerticalSubstitutes" ) ) ) pFont->m_bHaveVerticalSubstitutedGlyphs = getBool(pProps[n].Value); - else if( pProps[n].Name.equalsAscii( "EncodingVector" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EncodingVector" ) ) ) { Sequence< NamedValue > aEncoding; pProps[n].Value >>= aEncoding; @@ -4035,7 +4065,7 @@ bool PrintFontManager::readOverrideMetrics() pFont->m_aEncodingVector[ cCode ] = nGlyph; } } - else if( pProps[n].Name.equalsAscii( "NonEncoded" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "NonEncoded" ) ) ) { Sequence< NamedValue > aEncoding; pProps[n].Value >>= aEncoding; @@ -4048,7 +4078,7 @@ bool PrintFontManager::readOverrideMetrics() pFont->m_aNonEncoded[ cCode ] = OUStringToOString(aGlyphName,RTL_TEXTENCODING_ASCII_US); } } - else if( pProps[n].Name.equalsAscii( "CharacterMetrics" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharacterMetrics" ) ) ) { // fill pFont->m_pMetrics->m_aMetrics // expect triples of int: int -> CharacterMetric.{ width, height } @@ -4062,7 +4092,7 @@ bool PrintFontManager::readOverrideMetrics() pFont->m_pMetrics->m_aMetrics[ pInts[m] ].height = static_cast<short int>(pInts[m+2]); } } - else if( pProps[n].Name.equalsAscii( "XKernPairs" ) ) + else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "XKernPairs" ) ) ) { // fill pFont->m_pMetrics->m_aXKernPairs // expection name: <unicode1><unicode2> value: ((height << 16)| width) @@ -4102,3 +4132,5 @@ bool PrintFontManager::readOverrideMetrics() return true; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/fontmanager/helper.cxx b/vcl/unx/generic/fontmanager/helper.cxx index 05213a52597c..4b0d327a9a03 100644 --- a/vcl/unx/generic/fontmanager/helper.cxx +++ b/vcl/unx/generic/fontmanager/helper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,7 +42,12 @@ #include "osl/process.h" #include "rtl/bootstrap.hxx" -using namespace rtl; +using ::rtl::Bootstrap; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; +using ::rtl::OString; +using ::rtl::OStringToOUString; +using ::rtl::OUStringToOString; namespace psp { @@ -276,11 +282,11 @@ bool psp::convertPfbToPfa( ::osl::File& rInFile, ::osl::File& rOutFile ) if( buffer[0] != 0x80 ) // test for pfb m_agic number { // this migt be a pfa font already - sal_uInt64 nWrite = 0; if( ! rInFile.read( buffer+6, 9, nRead ) && nRead == 9 && ( ! std::strncmp( (char*)buffer, "%!FontType1-", 12 ) || ! std::strncmp( (char*)buffer, "%!PS-AdobeFont-", 15 ) ) ) { + sal_uInt64 nWrite = 0; if( rOutFile.write( buffer, 15, nWrite ) || nWrite != 15 ) bSuccess = false; while( bSuccess && @@ -402,3 +408,4 @@ void psp::splitPath( OString& rPath, OString& rDir, OString& rBase ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/fontmanager/parseAFM.cxx b/vcl/unx/generic/fontmanager/parseAFM.cxx index e1a33b4d1b5d..82d94f2518e0 100644 --- a/vcl/unx/generic/fontmanager/parseAFM.cxx +++ b/vcl/unx/generic/fontmanager/parseAFM.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * (C) 1988, 1989, 1990 by Adobe Systems Incorporated. All rights reserved. * @@ -332,7 +333,7 @@ static char *linetoken( FileInputStream* stream ) * * The algorithm is a standard Knuth binary search. */ -#include "afm_hash.cpp" +#include "afm_hash.hpp" static inline enum parseKey recognize( register char* ident, int len) { @@ -548,95 +549,6 @@ static int parseGlobals( FileInputStream* fp, register GlobalFontInfo* gfi ) } /* parseGlobals */ -#if 0 -/************************* initializeArray ************************/ - -/* Unmapped character codes are (at Adobe Systems) assigned the - * width of the space character (if one exists) else they get the - * value of 250 ems. This function initializes all entries in the - * char widths array to have this value. Then any mapped character - * codes will be replaced with the width of the appropriate character - * when parsing the character metric section. - - * This function parses the Character Metrics Section looking - * for a space character (by comparing character names). If found, - * the width of the space character will be used to initialize the - * values in the array of character widths. - * - * Before returning, the position of the read/write pointer of the - * FileInputStream is reset to be where it was upon entering this function. - */ - -static int initializeArray( FileInputStream* fp, register int* cwi) -{ - bool cont = true, found = false; - unsigned int opos = fp->tell(); - int code = 0, width = 0, i = 0, error = 0, tokenlen; - register char *keyword; - - while (cont) - { - keyword = token(fp,tokenlen); - if (keyword == NULL) - { - error = earlyEOF; - break; /* get out of loop */ - } - switch(recognize(keyword,tokenlen)) - { - case COMMENT: - keyword = linetoken(fp); - break; - case CODE: - if ((keyword = token(fp,tokenlen)) != NULL) - code = atoi(keyword); - break; - case CODEHEX: - if ((keyword = token(fp,tokenlen)) != NULL) - sscanf(keyword,"<%x>", &code); - break; - case XWIDTH: - if ((keyword = token(fp,tokenlen)) != NULL) - width = atoi(keyword); - break; - case X0WIDTH: - (void) token(fp,tokenlen); - break; - case CHARNAME: - if ((keyword = token(fp,tokenlen)) != NULL) - if (MATCH(keyword, Space)) - { - cont = false; - found = true; - } - break; - case ENDCHARMETRICS: - cont = false; - break; - case ENDFONTMETRICS: - cont = false; - error = normalEOF; - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - if (!found) - width = 250; - - for (i = 0; i < 256; ++i) - cwi[i] = width; - - fp->seek(opos); - - return(error); - -} /* initializeArray */ -#endif - /************************* parseCharWidths **************************/ /* This function is called by "parseFile". It will parse the AFM file @@ -1509,7 +1421,7 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) void freeFontInfo (FontInfo *fi) { - int i, j; + int i; if (fi->gfi) { @@ -1563,6 +1475,7 @@ freeFontInfo (FontInfo *fi) for (i = 0; i < fi->numOfComps; i++) { free (fi->ccd[i].ccName); + int j; for (j = 0; j < fi->ccd[i].numOfPieces; j++) free (fi->ccd[i].pieces[j].pccName); @@ -1575,3 +1488,5 @@ freeFontInfo (FontInfo *fi) } } // namspace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/fontmanager/parseAFM.hxx b/vcl/unx/generic/fontmanager/parseAFM.hxx index cfebde696c14..0c390bd8cf8d 100644 --- a/vcl/unx/generic/fontmanager/parseAFM.hxx +++ b/vcl/unx/generic/fontmanager/parseAFM.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * (C) 1988, 1989 by Adobe Systems Incorporated. All rights reserved. * @@ -332,3 +333,5 @@ int parseFile( const char* pFilename, FontInfo **fi, FLAGS flags ); void freeFontInfo(FontInfo *fi); } // namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/cdeint.cxx b/vcl/unx/generic/gdi/cdeint.cxx index af635f38e9bc..fc516099630f 100644 --- a/vcl/unx/generic/gdi/cdeint.cxx +++ b/vcl/unx/generic/gdi/cdeint.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -75,7 +76,6 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) int nStringCount; XTextProperty aTextProperty; aTextProperty.value = 0; - int i; static Atom nResMgrAtom = XInternAtom( mpDisplay, "RESOURCE_MANAGER", False ); @@ -91,6 +91,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) // *n*ColorPalette: palettefile ByteString aLines; + int i; for( i=0; i < nStringCount; i++ ) aLines += ppStringList[i]; for( i = aLines.GetTokenCount( '\n' )-1; i >= 0; i-- ) @@ -127,7 +128,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) ; int nNumber = aLine.Copy( ++nPos ).ToInt32(); - DBG_TRACE2( "found palette %d in resource \"%s\"", nNumber, aLine.GetBuffer() ); + OSL_TRACE( "found palette %d in resource \"%s\"", nNumber, aLine.GetBuffer() ); // found no documentation what this number actually means; // might be the screen number. 0 seems to be the right one @@ -135,7 +136,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) if( nNumber ) continue; - DBG_TRACE1( "Palette file is \"%s\".\n", aPaletteFile.GetBuffer() ); + OSL_TRACE( "Palette file is \"%s\".\n", aPaletteFile.GetBuffer() ); String aPath( aHomeDir ); aPath.AppendAscii( "/.dt/palettes/" ); @@ -157,7 +158,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) aStream.ReadLine( aBuffer ); // format is "#RRRRGGGGBBBB" - DBG_TRACE1( "\t\"%s\".\n", aBuffer.GetBuffer() ); + OSL_TRACE( "\t\"%s\".\n", aBuffer.GetBuffer() ); if( aBuffer.Len() ) { @@ -171,7 +172,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) | ( getHexDigit( pArr[8] ) << 4 ) ); - DBG_TRACE1( "\t\t%lx\n", aColors[nIndex].GetColor() ); + OSL_TRACE( "\t\t%lx\n", aColors[nIndex].GetColor() ); } } @@ -228,17 +229,9 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) aStyleSettings.SetDialogColor( aColors[1] ); aStyleSettings.SetMenuColor( aColors[1] ); aStyleSettings.SetMenuBarColor( aColors[1] ); - if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY ) - aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - // calculate Checked color - Color aColor2 = aStyleSettings.GetLightColor(); - sal_uInt8 nRed = (sal_uInt8)(((sal_uInt16)aColors[1].GetRed() + (sal_uInt16)aColor2.GetRed())/2); - sal_uInt8 nGreen = (sal_uInt8)(((sal_uInt16)aColors[1].GetGreen() + (sal_uInt16)aColor2.GetGreen())/2); - sal_uInt8 nBlue = (sal_uInt8)(((sal_uInt16)aColors[1].GetBlue() + (sal_uInt16)aColor2.GetBlue())/2); - aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); - } + aStyleSettings.SetCheckedColorSpecialCase( ); } rSettings.SetStyleSettings( aStyleSettings ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/dtint.cxx b/vcl/unx/generic/gdi/dtint.cxx index d14389cd0438..df1826df90f5 100644 --- a/vcl/unx/generic/gdi/dtint.cxx +++ b/vcl/unx/generic/gdi/dtint.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,9 +64,10 @@ #endif -using namespace rtl; using namespace vcl_sal; +using ::rtl::OUString; + String DtIntegrator::aHomeDir; DtIntegrator::DtIntegrator() : @@ -137,3 +139,5 @@ void DtIntegrator::GetSystemLook( AllSettings& rSettings ) aStyleSettings.SetCursorBlinkTime( 500 ); rSettings.SetStyleSettings( aStyleSettings ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/dtsetenum.hxx b/vcl/unx/generic/gdi/dtsetenum.hxx index 5406ac870a43..7973758d9f0d 100644 --- a/vcl/unx/generic/gdi/dtsetenum.hxx +++ b/vcl/unx/generic/gdi/dtsetenum.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -144,3 +145,5 @@ enum DtSetEnum }; #endif // _VCL_DTSETENUM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/gcach_xpeer.cxx b/vcl/unx/generic/gdi/gcach_xpeer.cxx index 3cd828c24065..644295048e77 100644 --- a/vcl/unx/generic/gdi/gcach_xpeer.cxx +++ b/vcl/unx/generic/gdi/gcach_xpeer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -649,27 +650,51 @@ X11GlyphCache::X11GlyphCache( X11GlyphPeer& rPeer ) // --------------------------------------------------------------------------- -static X11GlyphPeer* pX11GlyphPeer = NULL; -static X11GlyphCache* pX11GlyphCache = NULL; +namespace +{ + struct GlyphCacheHolder + { + private: + X11GlyphPeer* m_pX11GlyphPeer; + X11GlyphCache* m_pX11GlyphCache; + public: + GlyphCacheHolder() + { + m_pX11GlyphPeer = new X11GlyphPeer(); + m_pX11GlyphCache = new X11GlyphCache( *m_pX11GlyphPeer ); + } + void release() + { + delete m_pX11GlyphCache; + delete m_pX11GlyphPeer; + m_pX11GlyphCache = NULL; + m_pX11GlyphPeer = NULL; + } + X11GlyphCache& getGlyphCache() + { + return *m_pX11GlyphCache; + } + ~GlyphCacheHolder() + { + release(); + } + }; + + struct theGlyphCacheHolder : + public rtl::Static<GlyphCacheHolder, theGlyphCacheHolder> + {}; +} X11GlyphCache& X11GlyphCache::GetInstance() { - if( !pX11GlyphCache ) - { - pX11GlyphPeer = new X11GlyphPeer(); - pX11GlyphCache = new X11GlyphCache( *pX11GlyphPeer ); - } - return *pX11GlyphCache; + return theGlyphCacheHolder::get().getGlyphCache(); } // --------------------------------------------------------------------------- void X11GlyphCache::KillInstance() { - delete pX11GlyphCache; - delete pX11GlyphPeer; - pX11GlyphCache = NULL; - pX11GlyphPeer = NULL; + return theGlyphCacheHolder::get().release(); } // =========================================================================== @@ -681,3 +706,4 @@ void X11SalGraphics::releaseGlyphPeer() // =========================================================================== +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/gcach_xpeer.hxx b/vcl/unx/generic/gdi/gcach_xpeer.hxx index a65c75174858..d2b4ec259e8e 100644 --- a/vcl/unx/generic/gdi/gcach_xpeer.hxx +++ b/vcl/unx/generic/gdi/gcach_xpeer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -81,12 +82,15 @@ private: class X11GlyphCache : public GlyphCache { public: - X11GlyphPeer& GetPeer() { return reinterpret_cast<X11GlyphPeer&>( mrPeer ); } -static X11GlyphCache& GetInstance(); -static void KillInstance(); - -private: - X11GlyphCache( X11GlyphPeer& ); + X11GlyphCache( X11GlyphPeer& ); + X11GlyphPeer& GetPeer() + { + return static_cast<X11GlyphPeer&>(mrPeer); + } + static X11GlyphCache& GetInstance(); + static void KillInstance(); }; #endif // _SV_GCACH_XPEER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/pspgraphics.cxx b/vcl/unx/generic/gdi/pspgraphics.cxx index e68568a81aa9..f5546da6e785 100644 --- a/vcl/unx/generic/gdi/pspgraphics.cxx +++ b/vcl/unx/generic/gdi/pspgraphics.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,7 +59,9 @@ #endif using namespace psp; -using namespace rtl; + +using ::rtl::OUString; +using ::rtl::OString; // ----- Implementation of PrinterBmp by means of SalBitmap/BitmapBuffer --------------- @@ -145,7 +148,7 @@ SalPrinterBmp::SalPrinterBmp (BitmapBuffer* pBuffer) : mpFncGetPixel = BitmapReadAccess::GetPixelFor_32BIT_TC_MASK; break; default: - DBG_ERROR("Error: SalPrinterBmp::SalPrinterBmp() unknown bitmap format"); + OSL_FAIL("Error: SalPrinterBmp::SalPrinterBmp() unknown bitmap format"); break; } } @@ -190,7 +193,7 @@ SalPrinterBmp::GetDepth () const default: nDepth = 1; - DBG_ERROR ("Error: unsupported bitmap depth in SalPrinterBmp::GetDepth()"); + OSL_FAIL("Error: unsupported bitmap depth in SalPrinterBmp::GetDepth()"); break; } @@ -281,7 +284,7 @@ void PspGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) } } -sal_uInt16 PspGraphics::GetBitCount() +sal_uInt16 PspGraphics::GetBitCount() const { return m_pPrinterGfx->GetBitCount(); } @@ -447,12 +450,12 @@ sal_Bool PspGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void void PspGraphics::copyBits( const SalTwoRect*, SalGraphics* ) { - DBG_ERROR( "Error: PrinterGfx::CopyBits() not implemented" ); + OSL_FAIL( "Error: PrinterGfx::CopyBits() not implemented" ); } void PspGraphics::copyArea ( long,long,long,long,long,long,sal_uInt16 ) { - DBG_ERROR( "Error: PrinterGfx::CopyArea() not implemented" ); + OSL_FAIL( "Error: PrinterGfx::CopyArea() not implemented" ); } void PspGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap ) @@ -474,21 +477,21 @@ void PspGraphics::drawBitmap( const SalTwoRect*, const SalBitmap&, const SalBitmap& ) { - DBG_ERROR("Error: no PrinterGfx::DrawBitmap() for transparent bitmap"); + OSL_FAIL("Error: no PrinterGfx::DrawBitmap() for transparent bitmap"); } void PspGraphics::drawBitmap( const SalTwoRect*, const SalBitmap&, SalColor ) { - DBG_ERROR("Error: no PrinterGfx::DrawBitmap() for transparent color"); + OSL_FAIL("Error: no PrinterGfx::DrawBitmap() for transparent color"); } void PspGraphics::drawMask( const SalTwoRect*, const SalBitmap &, SalColor ) { - DBG_ERROR("Error: PrinterGfx::DrawMask() not implemented"); + OSL_FAIL("Error: PrinterGfx::DrawMask() not implemented"); } SalBitmap* PspGraphics::getBitmap( long, long, long, long ) @@ -499,13 +502,13 @@ SalBitmap* PspGraphics::getBitmap( long, long, long, long ) SalColor PspGraphics::getPixel( long, long ) { - DBG_ERROR ("Warning: PrinterGfx::GetPixel() not implemented"); + OSL_FAIL("Warning: PrinterGfx::GetPixel() not implemented"); return 0; } void PspGraphics::invert(long,long,long,long,SalInvert) { - DBG_ERROR ("Warning: PrinterGfx::Invert() not implemented"); + OSL_FAIL("Warning: PrinterGfx::Invert() not implemented"); } //========================================================================== @@ -722,14 +725,6 @@ static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx #ifdef ENABLE_GRAPHITE else if (pGrLayout) { - #if 0 // HACK: disabled for now due to #i114460#, see #desc12 there - // TODO: get rid of glyph->string mapping altogether for printing - // TODO: fix GraphiteServerFontLayout's returned aCharPosAry - // TODO: fix PrinterGfx's caching? - pText = pGrLayout->getTextPtr(); - nMinCharPos = pGrLayout->getMinCharPos(); - nMaxCharPos = pGrLayout->getMaxCharPos(); - #endif } #endif } @@ -786,6 +781,13 @@ const ImplFontCharMap* PspGraphics::GetImplFontCharMap() const return pIFCMap; } +bool PspGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const +{ + if (!m_pServerFont[0]) + return false; + return m_pServerFont[0]->GetFontCapabilities(rFontCapabilities); +} + sal_uInt16 PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) { // release all fonts that are to be overridden @@ -810,13 +812,13 @@ sal_uInt16 PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel bool bArtBold = false; if( pEntry->meItalic == ITALIC_OBLIQUE || pEntry->meItalic == ITALIC_NORMAL ) { - psp::italic::type eItalic = m_pPrinterGfx->GetFontMgr().getFontItalic( nID ); - if( eItalic != psp::italic::Italic && eItalic != psp::italic::Oblique ) + FontItalic eItalic = m_pPrinterGfx->GetFontMgr().getFontItalic( nID ); + if( eItalic != ITALIC_NORMAL && eItalic != ITALIC_OBLIQUE ) bArtItalic = true; } int nWeight = (int)pEntry->meWeight; int nRealWeight = (int)m_pPrinterGfx->GetFontMgr().getFontWeight( nID ); - if( nRealWeight <= (int)psp::weight::Medium && nWeight > (int)WEIGHT_MEDIUM ) + if( nRealWeight <= (int)WEIGHT_MEDIUM && nWeight > (int)WEIGHT_MEDIUM ) { bArtBold = true; } @@ -884,7 +886,7 @@ void PspGraphics::GetDevFontSubstList( OutputDevice* pOutDev ) const psp::PrinterInfo& rInfo = psp::PrinterInfoManager::get().getPrinterInfo( m_pJobData->m_aPrinterName ); if( rInfo.m_bPerformFontSubstitution ) { - for( std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator it = rInfo.m_aFontSubstitutes.begin(); it != rInfo.m_aFontSubstitutes.end(); ++it ) + for( boost::unordered_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator it = rInfo.m_aFontSubstitutes.begin(); it != rInfo.m_aFontSubstitutes.end(); ++it ) pOutDev->ImplAddDevFontSubstitute( it->first, it->second, FONT_SUBSTITUTE_ALWAYS ); } } @@ -939,7 +941,7 @@ sal_uLong PspGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData *pKernPa return nHavePairs; } -sal_Bool PspGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) +sal_Bool PspGraphics::GetGlyphBoundRect( sal_GlyphId nGlyphIndex, Rectangle& rRect ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) @@ -949,13 +951,13 @@ sal_Bool PspGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) if( !pSF ) return sal_False; - nGlyphIndex &= ~GF_FONTMASK; + nGlyphIndex &= GF_IDXMASK; const GlyphMetric& rGM = pSF->GetGlyphMetric( nGlyphIndex ); rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() ); return sal_True; } -sal_Bool PspGraphics::GetGlyphOutline( long nGlyphIndex, +sal_Bool PspGraphics::GetGlyphOutline( sal_GlyphId nGlyphIndex, ::basegfx::B2DPolyPolygon& rB2DPolyPoly ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; @@ -966,7 +968,7 @@ sal_Bool PspGraphics::GetGlyphOutline( long nGlyphIndex, if( !pSF ) return sal_False; - nGlyphIndex &= ~GF_FONTMASK; + nGlyphIndex &= GF_IDXMASK; if( pSF->GetGlyphOutline( nGlyphIndex, rB2DPolyPoly ) ) return sal_True; @@ -989,13 +991,9 @@ SalLayout* PspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel { #ifdef ENABLE_GRAPHITE // Is this a Graphite font? - if (GraphiteFontAdaptor::IsGraphiteEnabledFont(*m_pServerFont[nFallbackLevel])) + if (GraphiteServerFontLayout::IsGraphiteEnabledFont(m_pServerFont[nFallbackLevel])) { - sal_Int32 xdpi, ydpi; - GetResolution(xdpi, ydpi); - GraphiteFontAdaptor * pGrfont = new GraphiteFontAdaptor( *m_pServerFont[nFallbackLevel], xdpi, ydpi); - if (!pGrfont) return NULL; - pLayout = new GraphiteServerFontLayout(pGrfont); + pLayout = new GraphiteServerFontLayout(*m_pServerFont[nFallbackLevel]); } else #endif @@ -1184,106 +1182,16 @@ void PspGraphics::DoGetGlyphWidths( psp::fontID aFont, } // ---------------------------------------------------------------------------- -FontWidth PspGraphics::ToFontWidth (psp::width::type eWidth) -{ - switch (eWidth) - { - case psp::width::UltraCondensed: return WIDTH_ULTRA_CONDENSED; - case psp::width::ExtraCondensed: return WIDTH_EXTRA_CONDENSED; - case psp::width::Condensed: return WIDTH_CONDENSED; - case psp::width::SemiCondensed: return WIDTH_SEMI_CONDENSED; - case psp::width::Normal: return WIDTH_NORMAL; - case psp::width::SemiExpanded: return WIDTH_SEMI_EXPANDED; - case psp::width::Expanded: return WIDTH_EXPANDED; - case psp::width::ExtraExpanded: return WIDTH_EXTRA_EXPANDED; - case psp::width::UltraExpanded: return WIDTH_ULTRA_EXPANDED; - case psp::width::Unknown: return WIDTH_DONTKNOW; - default: - DBG_ERROR( "unknown width mapping" ); - break; - } - return WIDTH_DONTKNOW; -} - -FontWeight PspGraphics::ToFontWeight (psp::weight::type eWeight) -{ - switch (eWeight) - { - case psp::weight::Thin: return WEIGHT_THIN; - case psp::weight::UltraLight: return WEIGHT_ULTRALIGHT; - case psp::weight::Light: return WEIGHT_LIGHT; - case psp::weight::SemiLight: return WEIGHT_SEMILIGHT; - case psp::weight::Normal: return WEIGHT_NORMAL; - case psp::weight::Medium: return WEIGHT_MEDIUM; - case psp::weight::SemiBold: return WEIGHT_SEMIBOLD; - case psp::weight::Bold: return WEIGHT_BOLD; - case psp::weight::UltraBold: return WEIGHT_ULTRABOLD; - case psp::weight::Black: return WEIGHT_BLACK; - case psp::weight::Unknown: return WEIGHT_DONTKNOW; - default: - DBG_ERROR( "unknown weight mapping" ); - break; - } - return WEIGHT_DONTKNOW; -} - -FontPitch PspGraphics::ToFontPitch (psp::pitch::type ePitch) -{ - switch (ePitch) - { - case psp::pitch::Fixed: return PITCH_FIXED; - case psp::pitch::Variable: return PITCH_VARIABLE; - case psp::pitch::Unknown: return PITCH_DONTKNOW; - default: - DBG_ERROR( "unknown pitch mapping" ); - break; - } - return PITCH_DONTKNOW; -} - -FontItalic PspGraphics::ToFontItalic (psp::italic::type eItalic) -{ - switch (eItalic) - { - case psp::italic::Upright: return ITALIC_NONE; - case psp::italic::Oblique: return ITALIC_OBLIQUE; - case psp::italic::Italic: return ITALIC_NORMAL; - case psp::italic::Unknown: return ITALIC_DONTKNOW; - default: - DBG_ERROR( "unknown italic mapping" ); - break; - } - return ITALIC_DONTKNOW; -} - -FontFamily PspGraphics::ToFontFamily (psp::family::type eFamily) -{ - switch (eFamily) - { - case psp::family::Decorative: return FAMILY_DECORATIVE; - case psp::family::Modern: return FAMILY_MODERN; - case psp::family::Roman: return FAMILY_ROMAN; - case psp::family::Script: return FAMILY_SCRIPT; - case psp::family::Swiss: return FAMILY_SWISS; - case psp::family::System: return FAMILY_SYSTEM; - case psp::family::Unknown: return FAMILY_DONTKNOW; - default: - DBG_ERROR( "unknown family mapping" ); - break; - } - return FAMILY_DONTKNOW; -} - ImplDevFontAttributes PspGraphics::Info2DevFontAttributes( const psp::FastPrintFontInfo& rInfo ) { ImplDevFontAttributes aDFA; aDFA.maName = rInfo.m_aFamilyName; aDFA.maStyleName = rInfo.m_aStyleName; - aDFA.meFamily = ToFontFamily (rInfo.m_eFamilyStyle); - aDFA.meWeight = ToFontWeight (rInfo.m_eWeight); - aDFA.meItalic = ToFontItalic (rInfo.m_eItalic); - aDFA.meWidthType = ToFontWidth (rInfo.m_eWidth); - aDFA.mePitch = ToFontPitch (rInfo.m_ePitch); + aDFA.meFamily = rInfo.m_eFamilyStyle; + aDFA.meWeight = rInfo.m_eWeight; + aDFA.meItalic = rInfo.m_eItalic; + aDFA.meWidthType = rInfo.m_eWidth; + aDFA.mePitch = rInfo.m_ePitch; aDFA.mbSymbolFlag = (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL); aDFA.mbSubsettable = rInfo.m_bSubsettable; aDFA.mbEmbeddable = rInfo.m_bEmbeddable; @@ -1478,7 +1386,7 @@ SystemGraphicsData PspGraphics::GetGraphicsData() const SystemGraphicsData aRes; aRes.nSize = sizeof(aRes); aRes.hDrawable = 0; - aRes.pRenderFormat = 0; + aRes.pXRenderFormat = 0; return aRes; } @@ -1502,3 +1410,5 @@ bool PspGraphics::supportsOperation( OutDevSupportType ) const { return false; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx index 732ae465df52..3349e6ef3c01 100644 --- a/vcl/unx/generic/gdi/salbmp.cxx +++ b/vcl/unx/generic/gdi/salbmp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,6 +41,7 @@ #include <vcl/bitmap.hxx> #include <vcl/salbtype.hxx> +#include <com/sun/star/beans/XFastPropertySet.hpp> #include <tools/prex.h> #include "unx/Xproto.h" @@ -73,7 +75,8 @@ sal_uLong X11SalBitmap::mnCacheInstCount = 0; X11SalBitmap::X11SalBitmap() : mpDIB( NULL ), - mpDDB( NULL ) + mpDDB( NULL ), + mbGrey( false ) { } @@ -193,7 +196,8 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, int nScreen, long nDrawableDepth, long nX, long nY, - long nWidth, long nHeight ) + long nWidth, long nHeight, + bool bGrey ) { BitmapBuffer* pDIB = NULL; @@ -210,7 +214,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, // so better catch the XError pXLib->PushXErrorLevel( true ); XImage* pImage = XGetImage( pXDisp, aDrawable, nX, nY, nWidth, nHeight, AllPlanes, ZPixmap ); - bool bWasError = pXLib->HasXErrorOccured() && pXLib->GetLastXErrorRequestCode() == X_GetImage; + bool bWasError = pXLib->HasXErrorOccurred() && pXLib->GetLastXErrorRequestCode() == X_GetImage; pXLib->PopXErrorLevel(); if( ! bWasError && pImage && pImage->data ) @@ -304,6 +308,21 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, rPal[ 0 ] = Color( COL_BLACK ); rPal[ 1 ] = Color( COL_WHITE ); } + else if( pImage->depth == 8 && bGrey ) + { + rPal.SetEntryCount( 256 ); + pDstPal = &rPal; + + for( sal_uInt16 i = 0; i < 256; i++ ) + { + BitmapColor& rBmpCol = rPal[ i ]; + + rBmpCol.SetRed( i ); + rBmpCol.SetGreen( i ); + rBmpCol.SetBlue( i ); + } + + } else if( aSrcBuf.mnBitCount <= 8 ) { const SalColormap& rColMap = pSalDisp->GetColormap( nScreen ); @@ -347,7 +366,8 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long mpDDB->ImplGetDepth(), 0, 0, mpDDB->ImplGetWidth(), - mpDDB->ImplGetHeight() ); + mpDDB->ImplGetHeight(), + mbGrey ); } if( mpDIB && mpDIB->mnWidth && mpDIB->mnHeight ) @@ -430,6 +450,20 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long (*pPal)[ 0 ] = Color( COL_BLACK ); (*pPal)[ 1 ] = Color( COL_WHITE ); } + else if( pImage->depth == 8 && mbGrey ) + { + pPal = new BitmapPalette( 256 ); + + for( sal_uInt16 i = 0; i < 256; i++ ) + { + BitmapColor& rBmpCol = (*pPal)[ i ]; + + rBmpCol.SetRed( i ); + rBmpCol.SetGreen( i ); + rBmpCol.SetBlue( i ); + } + + } else if( pImage->depth <= 8 ) { const SalColormap& rColMap = pSalDisp->GetColormap( nScreen ); @@ -594,7 +628,8 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable aDrawable, mpDDB->ImplGetDepth(), 0, 0, mpDDB->ImplGetWidth(), - mpDDB->ImplGetHeight() ); + mpDDB->ImplGetHeight(), + mbGrey ); } delete mpDDB, const_cast<X11SalBitmap*>(this)->mpDDB = NULL; @@ -747,6 +782,33 @@ bool X11SalBitmap::Create( const SalBitmap&, sal_uInt16 ) // ----------------------------------------------------------------------------- +bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, Size& rSize, bool bMask ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, ::com::sun::star::uno::UNO_QUERY ); + if( xFastPropertySet.get() ) { + sal_Int32 depth; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > args; + + if( xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args ) { + long pixmapHandle; + if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) { + + mbGrey = bMask; + bool bSuccess = ImplCreateFromDrawable( pixmapHandle, 0, depth, 0, 0, (long) rSize.Width(), (long) rSize.Height() ); + bool bFreePixmap = false; + if( bSuccess && (args[0] >>= bFreePixmap) && bFreePixmap ) + XFreePixmap( GetX11SalData()->GetDisplay()->GetDisplay(), pixmapHandle ); + + return bSuccess; + } + } + } + + return false; +} + +// ----------------------------------------------------------------------------- + void X11SalBitmap::Destroy() { if( mpDIB ) @@ -801,7 +863,7 @@ BitmapBuffer* X11SalBitmap::AcquireBuffer( bool ) mpDIB = ImplCreateDIB( mpDDB->ImplGetPixmap(), mpDDB->ImplGetScreen(), mpDDB->ImplGetDepth(), - 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight() ); + 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight(), mbGrey ); } return mpDIB; @@ -1094,3 +1156,5 @@ void ImplSalBitmapCache::ImplClear() maBmpList.Clear(); mnTotalSize = 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/salcvt.cxx b/vcl/unx/generic/gdi/salcvt.cxx index c699cdb12335..b67b5828bf13 100644 --- a/vcl/unx/generic/gdi/salcvt.cxx +++ b/vcl/unx/generic/gdi/salcvt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,6 @@ SalConverterCache::~SalConverterCache() // ---> FIXME #include <stdio.h> -// <--- rtl_UnicodeToTextConverter SalConverterCache::GetU2TConverter( rtl_TextEncoding nEncoding ) @@ -65,7 +65,6 @@ SalConverterCache::GetU2TConverter( rtl_TextEncoding nEncoding ) // ---> FIXME if ( rConverter.mpU2T == NULL ) fprintf( stderr, "failed to create Unicode -> %i converter\n", nEncoding); -// <--- } return rConverter.mpU2T; } @@ -85,7 +84,6 @@ SalConverterCache::GetT2UConverter( rtl_TextEncoding nEncoding ) // ---> FIXME if ( rConverter.mpT2U == NULL ) fprintf( stderr, "failed to create %i -> Unicode converter\n", nEncoding ); -// <--- } return rConverter.mpT2U; } @@ -288,7 +286,6 @@ SalConverterCache::EncodingHasChar( rtl_TextEncoding nEncoding, // ---> FIXME if ( aConverter == NULL ) return False; - // <--- sal_Char pConversionBuffer[ 32 ]; sal_uInt32 nConversionInfo; @@ -339,3 +336,4 @@ SalConverterCache::ConvertStringUTF16( const sal_Unicode *pText, int nTextLen, return nSize; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/salcvt.hxx b/vcl/unx/generic/gdi/salcvt.hxx index 6d0e3bf9650c..896ae4f30b36 100644 --- a/vcl/unx/generic/gdi/salcvt.hxx +++ b/vcl/unx/generic/gdi/salcvt.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,4 @@ class SalConverterCache { #endif /* SAL_CONVERTER_CACHE_HXX_ */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index 39205ab2e321..b1b8d337430d 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -102,8 +103,8 @@ X11SalGraphics::X11SalGraphics() m_pVDev = NULL; m_pDeleteColormap = NULL; hDrawable_ = None; - m_aRenderPicture = 0; - m_pRenderFormat = NULL; + m_aXRenderPicture = 0; + m_pXRenderFormat = NULL; mpClipRegion = NULL; pPaintRegion_ = NULL; @@ -184,8 +185,8 @@ void X11SalGraphics::freeResources() if( m_pDeleteColormap ) delete m_pDeleteColormap, m_pColormap = m_pDeleteColormap = NULL; - if( m_aRenderPicture ) - XRenderPeer::GetInstance().FreePicture( m_aRenderPicture ), m_aRenderPicture = 0; + if( m_aXRenderPicture ) + XRenderPeer::GetInstance().FreePicture( m_aXRenderPicture ), m_aXRenderPicture = 0; bPenGC_ = bFontGC_ = bBrushGC_ = bMonoGC_ = bCopyGC_ = bInvertGC_ = bInvert50GC_ = bStippleGC_ = bTrackingGC_ = false; } @@ -206,10 +207,10 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen ) hDrawable_ = aDrawable; SetXRenderFormat( NULL ); - if( m_aRenderPicture ) + if( m_aXRenderPicture ) { - XRenderPeer::GetInstance().FreePicture( m_aRenderPicture ); - m_aRenderPicture = 0; + XRenderPeer::GetInstance().FreePicture( m_aXRenderPicture ); + m_aXRenderPicture = 0; } if( hDrawable_ ) @@ -222,22 +223,10 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen ) void X11SalGraphics::Init( SalFrame *pFrame, Drawable aTarget, int nScreen ) { -#if 0 // TODO: use SetDrawable() instead - m_pColormap = &GetX11SalData()->GetDisplay()->GetColormap(nScreen); - hDrawable_ = aTarget; - m_nScreen = nScreen; - SetXRenderFormat( NULL ); - if( m_aRenderPicture ) - XRenderPeer::GetInstance().FreePicture( m_aRenderPicture ), m_aRenderPicture = 0; - nPenPixel_ = GetPixel( nPenColor_ ); - nTextPixel_ = GetPixel( nTextColor_ ); - nBrushPixel_ = GetPixel( nBrushColor_ ); -#else m_pColormap = &GetX11SalData()->GetDisplay()->GetColormap(nScreen); m_nScreen = nScreen; SetDrawable( aTarget, nScreen ); -#endif bWindow_ = sal_True; m_pFrame = pFrame; @@ -258,10 +247,8 @@ void X11SalGraphics::SetClipRegion( GC pGC, XLIB_Region pXReg ) const int n = 0; XLIB_Region Regions[3]; - if( mpClipRegion /* && !XEmptyRegion( mpClipRegion ) */ ) + if( mpClipRegion ) Regions[n++] = mpClipRegion; -// if( pPaintRegion_ /* && !XEmptyRegion( pPaintRegion_ ) */ ) -// Regions[n++] = pPaintRegion_; if( pXReg && !XEmptyRegion( pXReg ) ) Regions[n++] = pXReg; @@ -274,8 +261,7 @@ void X11SalGraphics::SetClipRegion( GC pGC, XLIB_Region pXReg ) const { XLIB_Region pTmpRegion = XCreateRegion(); XIntersectRegion( Regions[0], Regions[1], pTmpRegion ); -// if( 3 == n ) -// XIntersectRegion( Regions[2], pTmpRegion, pTmpRegion ); + XSetRegion( pDisplay, pGC, pTmpRegion ); XDestroyRegion( pTmpRegion ); } @@ -320,7 +306,6 @@ GC X11SalGraphics::SelectBrush() if( !pBrushGC_ ) { XGCValues values; - // values.subwindow_mode = IncludeInferiors; values.subwindow_mode = ClipByChildren; values.fill_rule = EvenOddRule; // Pict import/ Gradient values.graphics_exposures = False; @@ -530,19 +515,16 @@ void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // cons { // different x- and y- resolutions are usually artifacts of // a wrongly calculated screen size. - //if( (13*rDPIX >= 10*rDPIY) && (13*rDPIY >= 10*rDPIX) ) //+-30% - { #ifdef DEBUG - printf("Forcing Resolution from %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 " to %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 "\n", - rDPIX,rDPIY,rDPIY,rDPIY); + printf("Forcing Resolution from %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 " to %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 "\n", + rDPIX,rDPIY,rDPIY,rDPIY); #endif - rDPIX = rDPIY; // y-resolution is more trustworthy - } + rDPIX = rDPIY; // y-resolution is more trustworthy } } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -sal_uInt16 X11SalGraphics::GetBitCount() // const +sal_uInt16 X11SalGraphics::GetBitCount() const { return GetVisual().GetDepth(); } @@ -1017,41 +999,32 @@ XID X11SalGraphics::GetXRenderPicture() { XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); - if( !m_aRenderPicture ) + if( !m_aXRenderPicture ) { // check xrender support for matching visual - // find a XRenderPictFormat compatible with the Drawable - XRenderPictFormat* pVisualFormat = static_cast<XRenderPictFormat*>(GetXRenderFormat()); - if( !pVisualFormat ) - { - Visual* pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual(); - pVisualFormat = rRenderPeer.FindVisualFormat( pVisual ); - if( !pVisualFormat ) - return 0; - // cache the XRenderPictFormat - SetXRenderFormat( static_cast<void*>(pVisualFormat) ); - } - + XRenderPictFormat* pXRenderFormat = GetXRenderFormat(); + if( !pXRenderFormat ) + return 0; // get the matching xrender target for drawable - m_aRenderPicture = rRenderPeer.CreatePicture( hDrawable_, pVisualFormat, 0, NULL ); + m_aXRenderPicture = rRenderPeer.CreatePicture( hDrawable_, pXRenderFormat, 0, NULL ); } -#if 0 - // setup clipping so the callers don't have to do it themselves - // TODO: avoid clipping if already set correctly - if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) - rRenderPeer.SetPictureClipRegion( aDstPic, mpClipRegion ); - else -#endif { // reset clip region // TODO: avoid clip reset if already done XRenderPictureAttributes aAttr; aAttr.clip_mask = None; - rRenderPeer.ChangePicture( m_aRenderPicture, CPClipMask, &aAttr ); + rRenderPeer.ChangePicture( m_aXRenderPicture, CPClipMask, &aAttr ); } - return m_aRenderPicture; + return m_aXRenderPicture; +} + +XRenderPictFormat* X11SalGraphics::GetXRenderFormat() const +{ + if( m_pXRenderFormat == NULL ) + m_pXRenderFormat = XRenderPeer::GetInstance().FindVisualFormat( GetVisual().visual ); + return m_pXRenderFormat; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -1063,11 +1036,11 @@ SystemGraphicsData X11SalGraphics::GetGraphicsData() const aRes.nSize = sizeof(aRes); aRes.pDisplay = GetXDisplay(); aRes.hDrawable = hDrawable_; - aRes.pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual(); + aRes.pVisual = GetVisual().visual; aRes.nScreen = m_nScreen; - aRes.nDepth = GetDisplay()->GetVisual( m_nScreen ).GetDepth(); - aRes.aColormap = GetDisplay()->GetColormap( m_nScreen ).GetXColormap(); - aRes.pRenderFormat = m_pRenderFormat; + aRes.nDepth = GetBitCount(); + aRes.aColormap = GetColormap().GetXColormap(); + aRes.pXRenderFormat = m_pXRenderFormat; return aRes; } @@ -1271,3 +1244,4 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx index 314797946ecf..1382fff3d1c1 100644 --- a/vcl/unx/generic/gdi/salgdi2.cxx +++ b/vcl/unx/generic/gdi/salgdi2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,26 +46,12 @@ #include "printergfx.hxx" #include "vcl/bmpacc.hxx" +#include <outdata.hxx> #undef SALGDI2_TESTTRANS // -=-= debugging =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -#if 0 - -static void sal_PrintImage( char *s, XImage*p ) -{ - fprintf( stderr, "%s %d %d %d\n", s, p->depth, p->width, p->height ); - int nW = Min( 64, p->width*p->bits_per_pixel >> 3 ); - for( int i = 0; i < Min( 16, p->height ); i++ ) - { - for( int j = 0; j < nW; j++ ) - fprintf( stderr, "%02X", (UINT8)p->data[i*p->bytes_per_line+j] ); - fprintf( stderr, "\n" ); - } -} - -#endif // DBG_UTIL // ----------------------------------------------------------------------------- @@ -643,7 +630,22 @@ void X11SalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSa { // set foreground/background values for 1Bit bitmaps XGetGCValues( pXDisp, aGC, nValues, &aOldVal ); - aNewVal.foreground = rColMap.GetWhitePixel(), aNewVal.background = rColMap.GetBlackPixel(); + + aNewVal.foreground = rColMap.GetWhitePixel(); + aNewVal.background = rColMap.GetBlackPixel(); + + //fdo#33455 handle 1 bit depth pngs with palette entries + //to set fore/back colors + if (const BitmapBuffer* pBitmapBuffer = const_cast<SalBitmap&>(rSalBitmap).AcquireBuffer(true)) + { + const BitmapPalette& rPalette = pBitmapBuffer->maPalette; + if (rPalette.GetEntryCount() == 2) + { + aNewVal.foreground = rColMap.GetPixel(ImplColorToSal(rPalette[0])); + aNewVal.background = rColMap.GetPixel(ImplColorToSal(rPalette[1])); + } + } + XChangeGC( pXDisp, aGC, nValues, &aNewVal ); } @@ -943,7 +945,7 @@ void X11SalGraphics::drawBitmap( const SalTwoRect*, const SalBitmap&, SalColor ) { - DBG_ERROR( "::DrawBitmap with transparent color not supported" ); + OSL_FAIL( "::DrawBitmap with transparent color not supported" ); } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -1149,3 +1151,4 @@ bool X11SalGraphics::supportsOperation( OutDevSupportType eType ) const return bRet; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx index f5204a16d1ad..dce2e5ccb793 100644 --- a/vcl/unx/generic/gdi/salgdi3.cxx +++ b/vcl/unx/generic/gdi/salgdi3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,6 +45,7 @@ #include "rtl/tencinfo.h" #include "osl/file.hxx" +#include "osl/module.hxx" #include "tools/string.hxx" #include "tools/debug.hxx" @@ -53,6 +55,8 @@ #include "i18npool/mslangid.hxx" +#include <boost/unordered_set.hpp> + #include <vcl/sysdata.hxx> #include "printergfx.hxx" #include "vcl/fontmanager.hxx" @@ -75,7 +79,6 @@ #include "outdev.h" -#include <hash_set> #ifdef ENABLE_GRAPHITE #include <graphite_layout.hxx> @@ -108,8 +111,7 @@ struct _XRegion BOX *rects; BOX extents; }; -using namespace rtl; - +using ::rtl::OUString; // =========================================================================== // PspKernInfo allows on-demand-querying of psprint provided kerning info (#i29881#) @@ -134,8 +136,6 @@ void PspKernInfo::Initialize() const if( rKernPairs.empty() ) return; - // feed psprint's kerning list into a lookup-friendly container - maUnicodeKernPairs.resize( rKernPairs.size() ); PspKernPairs::const_iterator it = rKernPairs.begin(); for(; it != rKernPairs.end(); ++it ) { @@ -181,21 +181,6 @@ X11SalGraphics::GetFontGC() bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLevel ) { -#ifdef HDU_DEBUG - ByteString aReqName( "NULL" ); - if( pEntry ) - aReqName = ByteString( pEntry->maName, RTL_TEXTENCODING_UTF8 ); - ByteString aUseName( "NULL" ); - if( pEntry && pEntry->mpFontData ) - aUseName = ByteString( pEntry->mpFontData->GetFamilyName(), RTL_TEXTENCODING_UTF8 ); - fprintf( stderr, "SetFont(lvl=%d,\"%s\", %d*%d, naa=%d,b=%d,i=%d) => \"%s\"\n", - nFallbackLevel, aReqName.GetBuffer(), - !pEntry?-1:pEntry->mnWidth, !pEntry?-1:pEntry->mnHeight, - !pEntry?-1:pEntry->mbNonAntialiased, - !pEntry?-1:pEntry->meWeight, !pEntry?-1:pEntry->meItalic, - aUseName.GetBuffer() ); -#endif - // release all no longer needed font resources for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) { @@ -245,22 +230,21 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev return false; } +ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize); + void ImplServerFontEntry::HandleFontOptions( void ) { - bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions& ); - if( !mpServerFont ) return; if( !mbGotFontOptions ) { // get and cache the font options mbGotFontOptions = true; - mbValidFontOptions = GetFCFontOptions( *maFontSelData.mpFontData, - maFontSelData.mnHeight, maFontOptions ); + mpFontOptions.reset(GetFCFontOptions( *maFontSelData.mpFontData, + maFontSelData.mnHeight )); } // apply the font options - if( mbValidFontOptions ) - mpServerFont->SetFontOptions( maFontOptions ); + mpServerFont->SetFontOptions( mpFontOptions ); } //-------------------------------------------------------------------------- @@ -270,7 +254,7 @@ namespace { class CairoWrapper { private: - oslModule mpCairoLib; + osl::Module mpCairoLib; cairo_surface_t* (*mp_xlib_surface_create_with_xrender_format)(Display *, Drawable , Screen *, XRenderPictFormat *, int , int ); void (*mp_surface_destroy)(cairo_surface_t *); @@ -279,6 +263,7 @@ private: void (*mp_clip)(cairo_t*); void (*mp_rectangle)(cairo_t*, double, double, double, double); cairo_font_face_t * (*mp_ft_font_face_create_for_ft_face)(FT_Face, int); + cairo_font_face_t * (*mp_ft_font_face_create_for_pattern)(void*); void (*mp_set_font_face)(cairo_t *, cairo_font_face_t *); void (*mp_font_face_destroy)(cairo_font_face_t *); void (*mp_matrix_init_identity)(cairo_matrix_t *); @@ -290,7 +275,7 @@ private: void (*mp_set_font_options)(cairo_t *, const void *); void (*mp_ft_font_options_substitute)(const void*, void*); - bool canEmbolden() const { return false; } + bool canEmbolden() const { return mp_ft_font_face_create_for_pattern != NULL; } CairoWrapper(); public: @@ -308,6 +293,12 @@ public: { (*mp_rectangle)(cr, x, y, width, height); } cairo_font_face_t* ft_font_face_create_for_ft_face(FT_Face face, int load_flags) { return (*mp_ft_font_face_create_for_ft_face)(face, load_flags); } + cairo_font_face_t* ft_font_face_create_for_pattern(void *pattern) + { + return mp_ft_font_face_create_for_pattern + ? (*mp_ft_font_face_create_for_pattern)(pattern) + : NULL; + } void set_font_face(cairo_t *cr, cairo_font_face_t *font_face) { (*mp_set_font_face)(cr, font_face); } void font_face_destroy(cairo_font_face_t *font_face) @@ -340,7 +331,6 @@ CairoWrapper& CairoWrapper::get() } CairoWrapper::CairoWrapper() -: mpCairoLib( NULL ) { static const char* pDisableCairoText = getenv( "SAL_DISABLE_CAIROTEXT" ); if( pDisableCairoText && (pDisableCairoText[0] != '0') ) @@ -351,8 +341,7 @@ CairoWrapper::CairoWrapper() return; OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libcairo.so.2" )); - mpCairoLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT ); - if( !mpCairoLib ) + if ( !mpCairoLib.load( aLibName, SAL_LOADMODULE_DEFAULT ) ) return; #ifdef DEBUG @@ -377,6 +366,8 @@ CairoWrapper::CairoWrapper() osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_rectangle" ); mp_ft_font_face_create_for_ft_face = (cairo_font_face_t * (*)(FT_Face, int)) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_ft_face" ); + mp_ft_font_face_create_for_pattern = (cairo_font_face_t * (*)(void*)) + osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_pattern" ); mp_set_font_face = (void (*)(cairo_t *, cairo_font_face_t *)) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_face" ); mp_font_face_destroy = (void (*)(cairo_font_face_t *)) @@ -418,8 +409,7 @@ CairoWrapper::CairoWrapper() mp_ft_font_options_substitute ) ) { - osl_unloadModule( mpCairoLib ); - mpCairoLib = NULL; + mpCairoLib.unload(); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "not all needed symbols were found\n" ); #endif @@ -454,9 +444,9 @@ CairoFontsCache::~CairoFontsCache() } } -void CairoFontsCache::CacheFont(void *pFont, void* pId) +void CairoFontsCache::CacheFont(void *pFont, const CairoFontsCache::CacheId &rId) { - maLRUFonts.push_front( std::pair<void*, void *>(pFont, pId) ); + maLRUFonts.push_front( std::pair<void*, CairoFontsCache::CacheId>(pFont, rId) ); if (maLRUFonts.size() > 8) { CairoWrapper &rCairo = CairoWrapper::get(); @@ -465,11 +455,11 @@ void CairoFontsCache::CacheFont(void *pFont, void* pId) } } -void* CairoFontsCache::FindCachedFont(void *pId) +void* CairoFontsCache::FindCachedFont(const CairoFontsCache::CacheId &rId) { LRUFonts::iterator aEnd = maLRUFonts.end(); for (LRUFonts::iterator aI = maLRUFonts.begin(); aI != aEnd; ++aI) - if (aI->second == pId) + if (aI->second == rId) return aI->first; return NULL; } @@ -494,15 +484,7 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) return; // find a XRenderPictFormat compatible with the Drawable - XRenderPictFormat* pVisualFormat = static_cast<XRenderPictFormat*>(GetXRenderFormat()); - if( !pVisualFormat ) - { - Visual* pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual(); - pVisualFormat = XRenderPeer::GetInstance().FindVisualFormat( pVisual ); - // cache the XRenderPictFormat - SetXRenderFormat( static_cast<void*>(pVisualFormat) ); - } - + XRenderPictFormat* pVisualFormat = GetXRenderFormat(); DBG_ASSERT( pVisualFormat!=NULL, "no matching XRenderPictFormat for text" ); if( !pVisualFormat ) return; @@ -548,12 +530,21 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) cairo_font_face_t* font_face = NULL; - void *pId = rFont.GetFtFace(); - font_face = (cairo_font_face_t*)m_aCairoFontsCache.FindCachedFont(pId); + void* pFace = rFont.GetFtFace(); + CairoFontsCache::CacheId aId; + aId.mpFace = pFace; + aId.mpOptions = rFont.GetFontOptions().get(); + aId.mbEmbolden = rFont.NeedsArtificialBold(); + font_face = (cairo_font_face_t*)m_aCairoFontsCache.FindCachedFont(aId); if (!font_face) { - font_face = rCairo.ft_font_face_create_for_ft_face(pId, rFont.GetLoadFlags()); - m_aCairoFontsCache.CacheFont(font_face, pId); + const ImplFontOptions *pOptions = rFont.GetFontOptions().get(); + void *pPattern = pOptions ? pOptions->GetPattern(pFace, aId.mbEmbolden) : NULL; + if (pPattern) + font_face = rCairo.ft_font_face_create_for_pattern(pPattern); + if (!font_face) + font_face = rCairo.ft_font_face_create_for_ft_face(pFace, rFont.GetLoadFlags()); + m_aCairoFontsCache.CacheFont(font_face, aId); } rCairo.set_font_face(cr, font_face); @@ -958,6 +949,13 @@ const ImplFontCharMap* X11SalGraphics::GetImplFontCharMap() const return pIFCMap; } +bool X11SalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rGetImplFontCapabilities) const +{ + if (!mpServerFont[0]) + return false; + return mpServerFont[0]->GetFontCapabilities(rGetImplFontCapabilities); +} + // ---------------------------------------------------------------------------- // // SalGraphics @@ -1097,106 +1095,17 @@ void cairosubcallback( void* pPattern ) rCairo.ft_font_options_substitute( pFontOptions, pPattern ); } -bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize, - ImplFontOptions& rFontOptions) +ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize) { - // TODO: get rid of these insane enum-conversions - // e.g. by using the classic vclenum values inside VCL - psp::FastPrintFontInfo aInfo; - // set family name + aInfo.m_aFamilyName = rFontAttributes.GetFamilyName(); - // set italic - switch( rFontAttributes.GetSlant() ) - { - case ITALIC_NONE: - aInfo.m_eItalic = psp::italic::Upright; - break; - case ITALIC_NORMAL: - aInfo.m_eItalic = psp::italic::Italic; - break; - case ITALIC_OBLIQUE: - aInfo.m_eItalic = psp::italic::Oblique; - break; - default: - aInfo.m_eItalic = psp::italic::Unknown; - break; - } - // set weight - switch( rFontAttributes.GetWeight() ) - { - case WEIGHT_THIN: - aInfo.m_eWeight = psp::weight::Thin; - break; - case WEIGHT_ULTRALIGHT: - aInfo.m_eWeight = psp::weight::UltraLight; - break; - case WEIGHT_LIGHT: - aInfo.m_eWeight = psp::weight::Light; - break; - case WEIGHT_SEMILIGHT: - aInfo.m_eWeight = psp::weight::SemiLight; - break; - case WEIGHT_NORMAL: - aInfo.m_eWeight = psp::weight::Normal; - break; - case WEIGHT_MEDIUM: - aInfo.m_eWeight = psp::weight::Medium; - break; - case WEIGHT_SEMIBOLD: - aInfo.m_eWeight = psp::weight::SemiBold; - break; - case WEIGHT_BOLD: - aInfo.m_eWeight = psp::weight::Bold; - break; - case WEIGHT_ULTRABOLD: - aInfo.m_eWeight = psp::weight::UltraBold; - break; - case WEIGHT_BLACK: - aInfo.m_eWeight = psp::weight::Black; - break; - default: - aInfo.m_eWeight = psp::weight::Unknown; - break; - } - // set width - switch( rFontAttributes.GetWidthType() ) - { - case WIDTH_ULTRA_CONDENSED: - aInfo.m_eWidth = psp::width::UltraCondensed; - break; - case WIDTH_EXTRA_CONDENSED: - aInfo.m_eWidth = psp::width::ExtraCondensed; - break; - case WIDTH_CONDENSED: - aInfo.m_eWidth = psp::width::Condensed; - break; - case WIDTH_SEMI_CONDENSED: - aInfo.m_eWidth = psp::width::SemiCondensed; - break; - case WIDTH_NORMAL: - aInfo.m_eWidth = psp::width::Normal; - break; - case WIDTH_SEMI_EXPANDED: - aInfo.m_eWidth = psp::width::SemiExpanded; - break; - case WIDTH_EXPANDED: - aInfo.m_eWidth = psp::width::Expanded; - break; - case WIDTH_EXTRA_EXPANDED: - aInfo.m_eWidth = psp::width::ExtraExpanded; - break; - case WIDTH_ULTRA_EXPANDED: - aInfo.m_eWidth = psp::width::UltraExpanded; - break; - default: - aInfo.m_eWidth = psp::width::Unknown; - break; - } + aInfo.m_eItalic = rFontAttributes.GetSlant(); + aInfo.m_eWeight = rFontAttributes.GetWeight(); + aInfo.m_eWidth = rFontAttributes.GetWidthType(); const psp::PrintFontManager& rPFM = psp::PrintFontManager::get(); - bool bOK = rPFM.getFontOptions( aInfo, nSize, cairosubcallback, rFontOptions); - return bOK; + return rPFM.getFontOptions(aInfo, nSize, cairosubcallback); } // ---------------------------------------------------------------------------- @@ -1236,7 +1145,7 @@ X11SalGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData *pKernPairs ) // --------------------------------------------------------------------------- -sal_Bool X11SalGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) +sal_Bool X11SalGraphics::GetGlyphBoundRect( sal_GlyphId nGlyphIndex, Rectangle& rRect ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) @@ -1246,7 +1155,7 @@ sal_Bool X11SalGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) if( !pSF ) return sal_False; - nGlyphIndex &= ~GF_FONTMASK; + nGlyphIndex &= GF_IDXMASK; const GlyphMetric& rGM = pSF->GetGlyphMetric( nGlyphIndex ); rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() ); return sal_True; @@ -1254,7 +1163,7 @@ sal_Bool X11SalGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) // --------------------------------------------------------------------------- -sal_Bool X11SalGraphics::GetGlyphOutline( long nGlyphIndex, +sal_Bool X11SalGraphics::GetGlyphOutline( sal_GlyphId nGlyphIndex, ::basegfx::B2DPolyPolygon& rPolyPoly ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; @@ -1265,7 +1174,7 @@ sal_Bool X11SalGraphics::GetGlyphOutline( long nGlyphIndex, if( !pSF ) return sal_False; - nGlyphIndex &= ~GF_FONTMASK; + nGlyphIndex &= GF_IDXMASK; if( pSF->GetGlyphOutline( nGlyphIndex, rPolyPoly ) ) return sal_True; @@ -1284,16 +1193,9 @@ SalLayout* X11SalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe #ifdef ENABLE_GRAPHITE // Is this a Graphite font? if (!bDisableGraphite_ && - GraphiteFontAdaptor::IsGraphiteEnabledFont(*mpServerFont[nFallbackLevel])) + GraphiteServerFontLayout::IsGraphiteEnabledFont(mpServerFont[nFallbackLevel])) { - sal_Int32 xdpi, ydpi; - - xdpi = GetDisplay()->GetResolution().A(); - ydpi = GetDisplay()->GetResolution().B(); - - GraphiteFontAdaptor * pGrfont = new GraphiteFontAdaptor( *mpServerFont[nFallbackLevel], xdpi, ydpi); - if (!pGrfont) return NULL; - pLayout = new GraphiteServerFontLayout(pGrfont); + pLayout = new GraphiteServerFontLayout(*mpServerFont[nFallbackLevel]); } else #endif @@ -1415,6 +1317,11 @@ class FcPreMatchSubstititution { public: bool FindFontSubstitute( ImplFontSelectData& ) const; + +private: + typedef ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > + CachedFontMapType; + mutable CachedFontMapType maCachedFontMap; }; class FcGlyphFallbackSubstititution @@ -1465,120 +1372,18 @@ static ImplFontSelectData GetFcSubstitute(const ImplFontSelectData &rFontSelData const rtl::OString aLangAttrib = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage ); - psp::italic::type eItalic = psp::italic::Unknown; - if( rFontSelData.GetSlant() != ITALIC_DONTKNOW ) - { - switch( rFontSelData.GetSlant() ) - { - case ITALIC_NONE: eItalic = psp::italic::Upright; break; - case ITALIC_NORMAL: eItalic = psp::italic::Italic; break; - case ITALIC_OBLIQUE: eItalic = psp::italic::Oblique; break; - default: - break; - } - } - - psp::weight::type eWeight = psp::weight::Unknown; - if( rFontSelData.GetWeight() != WEIGHT_DONTKNOW ) - { - switch( rFontSelData.GetWeight() ) - { - case WEIGHT_THIN: eWeight = psp::weight::Thin; break; - case WEIGHT_ULTRALIGHT: eWeight = psp::weight::UltraLight; break; - case WEIGHT_LIGHT: eWeight = psp::weight::Light; break; - case WEIGHT_SEMILIGHT: eWeight = psp::weight::SemiLight; break; - case WEIGHT_NORMAL: eWeight = psp::weight::Normal; break; - case WEIGHT_MEDIUM: eWeight = psp::weight::Medium; break; - case WEIGHT_SEMIBOLD: eWeight = psp::weight::SemiBold; break; - case WEIGHT_BOLD: eWeight = psp::weight::Bold; break; - case WEIGHT_ULTRABOLD: eWeight = psp::weight::UltraBold; break; - case WEIGHT_BLACK: eWeight = psp::weight::Black; break; - default: - break; - } - } - - psp::width::type eWidth = psp::width::Unknown; - if( rFontSelData.GetWidthType() != WIDTH_DONTKNOW ) - { - switch( rFontSelData.GetWidthType() ) - { - case WIDTH_ULTRA_CONDENSED: eWidth = psp::width::UltraCondensed; break; - case WIDTH_EXTRA_CONDENSED: eWidth = psp::width::ExtraCondensed; break; - case WIDTH_CONDENSED: eWidth = psp::width::Condensed; break; - case WIDTH_SEMI_CONDENSED: eWidth = psp::width::SemiCondensed; break; - case WIDTH_NORMAL: eWidth = psp::width::Normal; break; - case WIDTH_SEMI_EXPANDED: eWidth = psp::width::SemiExpanded; break; - case WIDTH_EXPANDED: eWidth = psp::width::Expanded; break; - case WIDTH_EXTRA_EXPANDED: eWidth = psp::width::ExtraExpanded; break; - case WIDTH_ULTRA_EXPANDED: eWidth = psp::width::UltraExpanded; break; - default: - break; - } - } - - psp::pitch::type ePitch = psp::pitch::Unknown; - if( rFontSelData.GetPitch() != PITCH_DONTKNOW ) - { - switch( rFontSelData.GetPitch() ) - { - case PITCH_FIXED: ePitch=psp::pitch::Fixed; break; - case PITCH_VARIABLE: ePitch=psp::pitch::Variable; break; - default: - break; - } - } + FontItalic eItalic = rFontSelData.GetSlant(); + FontWeight eWeight = rFontSelData.GetWeight(); + FontWidth eWidth = rFontSelData.GetWidthType(); + FontPitch ePitch = rFontSelData.GetPitch(); const psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); aRet.maSearchName = rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch); - switch (eItalic) - { - case psp::italic::Upright: aRet.meItalic = ITALIC_NONE; break; - case psp::italic::Italic: aRet.meItalic = ITALIC_NORMAL; break; - case psp::italic::Oblique: aRet.meItalic = ITALIC_OBLIQUE; break; - default: - break; - } - - switch (eWeight) - { - case psp::weight::Thin: aRet.meWeight = WEIGHT_THIN; break; - case psp::weight::UltraLight: aRet.meWeight = WEIGHT_ULTRALIGHT; break; - case psp::weight::Light: aRet.meWeight = WEIGHT_LIGHT; break; - case psp::weight::SemiLight: aRet.meWeight = WEIGHT_SEMILIGHT; break; - case psp::weight::Normal: aRet.meWeight = WEIGHT_NORMAL; break; - case psp::weight::Medium: aRet.meWeight = WEIGHT_MEDIUM; break; - case psp::weight::SemiBold: aRet.meWeight = WEIGHT_SEMIBOLD; break; - case psp::weight::Bold: aRet.meWeight = WEIGHT_BOLD; break; - case psp::weight::UltraBold: aRet.meWeight = WEIGHT_ULTRABOLD; break; - case psp::weight::Black: aRet.meWeight = WEIGHT_BLACK; break; - default: - break; - } - - switch (eWidth) - { - case psp::width::UltraCondensed: aRet.meWidthType = WIDTH_ULTRA_CONDENSED; break; - case psp::width::ExtraCondensed: aRet.meWidthType = WIDTH_EXTRA_CONDENSED; break; - case psp::width::Condensed: aRet.meWidthType = WIDTH_CONDENSED; break; - case psp::width::SemiCondensed: aRet.meWidthType = WIDTH_SEMI_CONDENSED; break; - case psp::width::Normal: aRet.meWidthType = WIDTH_NORMAL; break; - case psp::width::SemiExpanded: aRet.meWidthType = WIDTH_SEMI_EXPANDED; break; - case psp::width::Expanded: aRet.meWidthType = WIDTH_EXPANDED; break; - case psp::width::ExtraExpanded: aRet.meWidthType = WIDTH_EXTRA_EXPANDED; break; - case psp::width::UltraExpanded: aRet.meWidthType = WIDTH_ULTRA_EXPANDED; break; - default: - break; - } - - switch (ePitch) - { - case psp::pitch::Fixed: aRet.mePitch = PITCH_FIXED; break; - case psp::pitch::Variable: aRet.mePitch = PITCH_VARIABLE; break; - default: - break; - } + aRet.meItalic = eItalic; + aRet.meWeight = eWeight; + aRet.meWidthType = eWidth; + aRet.mePitch = ePitch; return aRet; } @@ -1610,12 +1415,20 @@ bool FcPreMatchSubstititution::FindFontSubstitute( ImplFontSelectData &rFontSelD || 0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "opensymbol", 10) ) return false; + CachedFontMapType::const_iterator itr = maCachedFontMap.find(rFontSelData.maTargetName); + if (itr != maCachedFontMap.end()) + { + // Cached substitution pair + rFontSelData.maSearchName = itr->second; + return true; + } + rtl::OUString aDummy; const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, aDummy ); - // TODO: cache the font substitution suggestion - // FC doing it would be preferable because it knows the invariables - // e.g. FC knows the FC rule that all Arial gets replaced by LiberationSans - // whereas we would have to check for every size or attribute + + maCachedFontMap.insert( + CachedFontMapType::value_type(rFontSelData.maTargetName, aOut.maSearchName)); + if( !aOut.maSearchName.Len() ) return false; @@ -1684,3 +1497,4 @@ bool FcGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFon // =========================================================================== +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/salprnpsp.cxx b/vcl/unx/generic/gdi/salprnpsp.cxx index 0a278cab971f..009621a9e22e 100644 --- a/vcl/unx/generic/gdi/salprnpsp.cxx +++ b/vcl/unx/generic/gdi/salprnpsp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,10 +66,15 @@ #include "print.h" #include "salptype.hxx" +#include <com/sun/star/beans/PropertyValue.hpp> + using namespace psp; -using namespace rtl; using namespace com::sun::star; +using ::rtl::OUString; +using ::rtl::OUStringHash; +using ::rtl::OUStringToOString; + /* * static helpers */ @@ -400,7 +406,7 @@ SalInfoPrinter* X11SalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueIn // set/clear backwards compatibility flag bool bStrictSO52Compatibility = false; - std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it = + boost::unordered_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it = pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) ); if( compat_it != pJobSetup->maValueMap.end() ) @@ -637,7 +643,7 @@ sal_Bool PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup ) { // set/clear backwards compatibility flag bool bStrictSO52Compatibility = false; - std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it = + boost::unordered_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it = pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) ); if( compat_it != pJobSetup->maValueMap.end() ) @@ -676,17 +682,6 @@ sal_Bool PspSalInfoPrinter::SetData( // merge papersize if necessary if( nSetDataFlags & SAL_JOBSET_PAPERSIZE ) { - int nWidth, nHeight; - if( pJobSetup->meOrientation == ORIENTATION_PORTRAIT ) - { - nWidth = pJobSetup->mnPaperWidth; - nHeight = pJobSetup->mnPaperHeight; - } - else - { - nWidth = pJobSetup->mnPaperHeight; - nHeight = pJobSetup->mnPaperWidth; - } String aPaper; if( pJobSetup->mePaperFormat == PAPER_USER ) @@ -964,7 +959,7 @@ sal_Bool PspSalPrinter::StartJob( bool bDirect, ImplJobSetup* pJobSetup ) { - vcl_sal::PrinterUpdate::jobStarted(); + GetSalData()->m_pInstance->jobStartedPrinterUpdate(); m_bFax = false; m_bPdf = false; @@ -995,8 +990,8 @@ sal_Bool PspSalPrinter::StartJob( m_aTmpFile = getTmpName(); nMode = S_IRUSR | S_IWUSR; - ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it; - it = pJobSetup->maValueMap.find( ::rtl::OUString::createFromAscii( "FAX#" ) ); + ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it; + it = pJobSetup->maValueMap.find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAX#")) ); if( it != pJobSetup->maValueMap.end() ) m_aFaxNr = it->second; @@ -1025,7 +1020,7 @@ sal_Bool PspSalPrinter::StartJob( // set/clear backwards compatibility flag bool bStrictSO52Compatibility = false; - std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it = + boost::unordered_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it = pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) ); if( compat_it != pJobSetup->maValueMap.end() ) @@ -1066,7 +1061,7 @@ sal_Bool PspSalPrinter::EndJob() } } } - vcl_sal::PrinterUpdate::jobEnded(); + GetSalData()->m_pInstance->jobEndedPrinterUpdate(); return bSuccess; } @@ -1075,7 +1070,7 @@ sal_Bool PspSalPrinter::EndJob() sal_Bool PspSalPrinter::AbortJob() { sal_Bool bAbort = m_aPrintJob.AbortJob() ? sal_True : sal_False; - vcl_sal::PrinterUpdate::jobEnded(); + GetSalData()->m_pInstance->jobEndedPrinterUpdate(); return bAbort; } @@ -1382,15 +1377,30 @@ sal_Bool PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJo } +namespace x11 +{ + class PrinterUpdate + { + static Timer* pPrinterUpdateTimer; + static int nActiveJobs; + + static void doUpdate(); + DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* ); + public: + static void update(X11SalInstance &rInstance); + static void jobStarted() { nActiveJobs++; } + static void jobEnded(); + }; +} /* - * vcl::PrinterUpdate + * x11::PrinterUpdate */ -Timer* vcl_sal::PrinterUpdate::pPrinterUpdateTimer = NULL; -int vcl_sal::PrinterUpdate::nActiveJobs = 0; +Timer* x11::PrinterUpdate::pPrinterUpdateTimer = NULL; +int x11::PrinterUpdate::nActiveJobs = 0; -void vcl_sal::PrinterUpdate::doUpdate() +void x11::PrinterUpdate::doUpdate() { ::psp::PrinterInfoManager& rManager( ::psp::PrinterInfoManager::get() ); if( rManager.checkPrintersChanged( false ) ) @@ -1405,7 +1415,7 @@ void vcl_sal::PrinterUpdate::doUpdate() // ----------------------------------------------------------------------- -IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, EMPTYARG ) +IMPL_STATIC_LINK_NOINSTANCE( x11::PrinterUpdate, UpdateTimerHdl, void*, EMPTYARG ) { if( nActiveJobs < 1 ) { @@ -1421,12 +1431,12 @@ IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, EMPT // ----------------------------------------------------------------------- -void vcl_sal::PrinterUpdate::update() +void x11::PrinterUpdate::update(X11SalInstance &rInstance) { if( Application::GetSettings().GetMiscSettings().GetDisablePrinting() ) return; - if( ! static_cast< X11SalInstance* >(GetSalData()->m_pInstance)->isPrinterInit() ) + if( ! rInstance.isPrinterInit() ) { // #i45389# start background printer detection psp::PrinterInfoManager::get(); @@ -1439,14 +1449,24 @@ void vcl_sal::PrinterUpdate::update() { pPrinterUpdateTimer = new Timer(); pPrinterUpdateTimer->SetTimeout( 500 ); - pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, vcl_sal::PrinterUpdate, UpdateTimerHdl ) ); + pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, x11::PrinterUpdate, UpdateTimerHdl ) ); pPrinterUpdateTimer->Start(); } } +void X11SalInstance::updatePrinterUpdate() +{ + x11::PrinterUpdate::update(*this); +} + +void X11SalInstance::jobStartedPrinterUpdate() +{ + x11::PrinterUpdate::jobStarted(); +} + // ----------------------------------------------------------------------- -void vcl_sal::PrinterUpdate::jobEnded() +void x11::PrinterUpdate::jobEnded() { nActiveJobs--; if( nActiveJobs < 1 ) @@ -1460,3 +1480,10 @@ void vcl_sal::PrinterUpdate::jobEnded() } } } + +void X11SalInstance::jobEndedPrinterUpdate() +{ + x11::PrinterUpdate::jobEnded(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index 9f18ba6388ea..0bb34519bd8f 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -69,7 +70,8 @@ SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics, } nDX = (long)w; nDY = (long)h; - if( !pVDev->Init( GetX11SalData()->GetDisplay(), nDX, nDY, nBitCount, nScreen, pData->hDrawable, pData->pRenderFormat ) ) + if( !pVDev->Init( GetX11SalData()->GetDisplay(), nDX, nDY, nBitCount, nScreen, pData->hDrawable, + static_cast< XRenderPictFormat* >( pData->pXRenderFormat )) ) { delete pVDev; return NULL; @@ -137,7 +139,7 @@ sal_Bool X11SalVirtualDevice::Init( SalDisplay *pDisplay, sal_uInt16 nBitCount, int nScreen, Pixmap hDrawable, - void* pRenderFormatVoid ) + XRenderPictFormat* pXRenderFormat ) { SalColormap* pColormap = NULL; bool bDeleteColormap = false; @@ -145,11 +147,10 @@ sal_Bool X11SalVirtualDevice::Init( SalDisplay *pDisplay, pDisplay_ = pDisplay; pGraphics_ = new X11SalGraphics(); m_nScreen = nScreen; - if( pRenderFormatVoid ) { - XRenderPictFormat *pRenderFormat = ( XRenderPictFormat* )pRenderFormatVoid; - pGraphics_->SetXRenderFormat( pRenderFormat ); - if( pRenderFormat->colormap ) - pColormap = new SalColormap( pDisplay, pRenderFormat->colormap, m_nScreen ); + if( pXRenderFormat ) { + pGraphics_->SetXRenderFormat( pXRenderFormat ); + if( pXRenderFormat->colormap ) + pColormap = new SalColormap( pDisplay, pXRenderFormat->colormap, m_nScreen ); else pColormap = new SalColormap( nBitCount ); bDeleteColormap = true; @@ -272,3 +273,4 @@ void X11SalVirtualDevice::GetSize( long& rWidth, long& rHeight ) rHeight = GetHeight(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/xrender_peer.cxx b/vcl/unx/generic/gdi/xrender_peer.cxx index 32e656bcbf5f..eda3254958f0 100644 --- a/vcl/unx/generic/gdi/xrender_peer.cxx +++ b/vcl/unx/generic/gdi/xrender_peer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,6 +38,8 @@ #include <unx/saldata.hxx> #include <unx/saldisp.hxx> +using ::rtl::OUString; +using ::rtl::OUStringToOString; #include <xrender_peer.hxx> using namespace rtl; @@ -166,16 +169,10 @@ void XRenderPeer::InitRenderLib() int,int,unsigned int,unsigned int))pFunc; pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderCompositeTrapezoids" ); -#if 0 // not having trapezoid support is supported - if( !pFunc ) return; -#endif mpXRenderCompositeTrapezoids = (void(*)(Display*,int,Picture,Picture, const XRenderPictFormat*,int,int,const XTrapezoid*,int))pFunc; pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderAddTraps" ); -#if 0 // not having trapezoid support is supported - if( !pFunc ) return; -#endif mpXRenderAddTraps = (void(*)(Display*,Picture,int,int,const _XTrap*,int))pFunc; #endif // XRENDER_LINK @@ -245,3 +242,5 @@ sal_uInt32 XRenderPeer::InitRenderText() } // --------------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/xrender_peer.hxx b/vcl/unx/generic/gdi/xrender_peer.hxx index 89dccfcef40b..f9417bb2be95 100644 --- a/vcl/unx/generic/gdi/xrender_peer.hxx +++ b/vcl/unx/generic/gdi/xrender_peer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -277,16 +278,6 @@ inline void XRenderPeer::FreeGlyph( GlyphSet aGS, Glyph nGlyphId ) const // #108209# disabled because of crash potential, // the glyph leak is not too bad because they will // be cleaned up when the glyphset is released -#if 0 // TODO: reenable when it works without problems - if( mnRenderVersion >= 0x05 ) - { -#ifdef XRENDER_LINK - XRenderFreeGlyphs( mpDisplay, aGS, &nGlyphId, 1 ); -#else - (*mpXRenderFreeGlyphs)( mpDisplay, aGS, &nGlyphId, 1 ); -#endif - } -#endif } inline void XRenderPeer::CompositeString32( Picture aSrc, Picture aDst, @@ -385,3 +376,5 @@ inline XRenderColor GetXRenderColor( const SalColor& rSalColor, double fTranspar //===================================================================== #endif // _SV_XRENDER_PEER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx index 00058bf24461..3235aa9a58fa 100644 --- a/vcl/unx/generic/plugadapt/salplug.cxx +++ b/vcl/unx/generic/plugadapt/salplug.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,30 +36,20 @@ #include "salinst.hxx" #include "unx/saldata.hxx" +#include "unx/desktops.hxx" #include "vcl/printerinfomanager.hxx" #include <cstdio> #include <unistd.h> -using namespace rtl; - +using ::rtl::OUString; +using ::rtl::OUStringBuffer; extern "C" { typedef SalInstance*(*salFactoryProc)( oslModule pModule); } static oslModule pCloseModule = NULL; -enum { - DESKTOP_NONE = 0, - DESKTOP_UNKNOWN, - DESKTOP_GNOME, - DESKTOP_KDE, - DESKTOP_KDE4, - DESKTOP_CDE -}; - -static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KDE4", "CDE" }; - static SalInstance* tryInstance( const OUString& rModuleBase ) { SalInstance* pInst = NULL; @@ -93,7 +84,8 @@ static SalInstance* tryInstance( const OUString& rModuleBase ) * So make sure libgtk+ & co are still mapped into memory when * atk-bridge's atexit handler gets called. */ - if( rModuleBase.equalsAscii("gtk") ) + if( rModuleBase.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("gtk")) || + rModuleBase.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("gtk3")) ) { pCloseModule = NULL; } @@ -101,7 +93,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase ) * #i109007# KDE3 seems to have the same problem; an atexit cleanup * handler, which cannot be resolved anymore if the plugin is already unloaded. */ - else if( rModuleBase.equalsAscii("kde") ) + else if( rModuleBase.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("kde")) ) { pCloseModule = NULL; } @@ -130,42 +122,38 @@ static SalInstance* tryInstance( const OUString& rModuleBase ) return pInst; } -static const rtl::OUString& get_desktop_environment() +static DesktopType get_desktop_environment() { - static rtl::OUString aRet; - if( ! aRet.getLength() ) + OUStringBuffer aModName( 128 ); + aModName.appendAscii( SAL_DLLPREFIX"desktop_detector" ); + aModName.appendAscii( SAL_DLLPOSTFIX ); + OUString aModule = aModName.makeStringAndClear(); + + oslModule aMod = osl_loadModuleRelative( + reinterpret_cast< oslGenericFunction >( &tryInstance ), aModule.pData, + SAL_LOADMODULE_DEFAULT ); + DesktopType ret = DESKTOP_UNKNOWN; + if( aMod ) { - OUStringBuffer aModName( 128 ); - aModName.appendAscii( SAL_DLLPREFIX"desktop_detector" ); - aModName.appendAscii( SAL_DLLPOSTFIX ); - aModName.appendAscii( SAL_DLLEXTENSION ); - OUString aModule = aModName.makeStringAndClear(); - - oslModule aMod = osl_loadModuleRelative( - reinterpret_cast< oslGenericFunction >( &tryInstance ), aModule.pData, - SAL_LOADMODULE_DEFAULT ); - if( aMod ) - { - rtl::OUString (*pSym)() = (rtl::OUString(*)()) - osl_getAsciiFunctionSymbol( aMod, "get_desktop_environment" ); - if( pSym ) - aRet = pSym(); - } - osl_unloadModule( aMod ); + DesktopType (*pSym)() = (DesktopType(*)()) + osl_getAsciiFunctionSymbol( aMod, "get_desktop_environment" ); + if( pSym ) + ret = pSym(); } - return aRet; + osl_unloadModule( aMod ); + return ret; } static SalInstance* autodetect_plugin() { static const char* pKDEFallbackList[] = { - "kde4", "kde", "gtk", "gen", 0 + "kde4", "kde", "gtk3", "gtk", "gen", 0 }; static const char* pStandardFallbackList[] = { - "gtk", "gen", 0 + "gtk3", "gtk", "gen", 0 }; static const char* pHeadlessFallbackList[] = @@ -173,21 +161,21 @@ static SalInstance* autodetect_plugin() "svp", 0 }; - const rtl::OUString& desktop( get_desktop_environment() ); + DesktopType desktop = get_desktop_environment(); const char ** pList = pStandardFallbackList; int nListEntry = 0; // no server at all: dummy plugin - if ( desktop.equalsAscii( desktop_strings[DESKTOP_NONE] ) ) + if ( desktop == DESKTOP_NONE ) pList = pHeadlessFallbackList; - else if ( desktop.equalsAscii( desktop_strings[DESKTOP_GNOME] ) ) + else if ( desktop == DESKTOP_GNOME ) pList = pStandardFallbackList; - else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE] ) ) + else if( desktop == DESKTOP_KDE ) { pList = pKDEFallbackList; nListEntry = 1; } - else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) ) + else if( desktop == DESKTOP_KDE4 ) pList = pKDEFallbackList; SalInstance* pInst = NULL; @@ -212,8 +200,11 @@ static SalInstance* check_headless_plugin() for( int i = 0; i < nParams; i++ ) { osl_getCommandArg( i, &aParam.pData ); - if( aParam.equalsAscii( "-headless" ) ) + if( aParam.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("-headless")) || + aParam.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("--headless")) ) + { return tryInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "svp" ) ) ); + } } return NULL; } @@ -224,17 +215,19 @@ SalInstance *CreateSalInstance() static const char* pUsePlugin = getenv( "SAL_USE_VCLPLUGIN" ); - if( !(pUsePlugin && *pUsePlugin) ) - pInst = check_headless_plugin(); - else + pInst = check_headless_plugin(); + + if( !pInst && pUsePlugin && *pUsePlugin ) pInst = tryInstance( OUString::createFromAscii( pUsePlugin ) ); if( ! pInst ) pInst = autodetect_plugin(); - // fallback to gen - if( ! pInst ) - pInst = tryInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "gen" ) ) ); + // fallback, try everything + const char* pPlugin[] = { "gtk3", "gtk", "kde4", "kde", "gen", 0 }; + + for ( int i = 0; !pInst && pPlugin[ i ]; ++i ) + pInst = tryInstance( OUString::createFromAscii( pPlugin[ i ] ) ); if( ! pInst ) { @@ -277,15 +270,24 @@ void DeInitSalMain() void SalAbort( const XubString& rErrorText ) { if( !rErrorText.Len() ) - std::fprintf( stderr, "Application Error" ); + std::fprintf( stderr, "Application Error\n" ); else - std::fprintf( stderr, ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() ); - abort(); + std::fprintf( stderr, "%s\n", ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() ); + exit(-1); } +static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KDE4", "CDE" }; + const OUString& SalGetDesktopEnvironment() { - return get_desktop_environment(); + static rtl::OUString aRet; + if( aRet.isEmpty()) + { + rtl::OUStringBuffer buf( 8 ); + buf.appendAscii( desktop_strings[ get_desktop_environment() ] ); + aRet = buf.makeStringAndClear(); + } + return aRet; } SalData::SalData() : @@ -299,3 +301,5 @@ SalData::~SalData() { psp::PrinterInfoManager::release(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index 97fe10f4d7ce..a850ec14bb28 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -138,7 +139,13 @@ public: using namespace psp; using namespace osl; -using namespace rtl; + +using ::rtl::OUString; +using ::rtl::OUStringBuffer; +using ::rtl::OUStringToOString; +using ::rtl::OStringToOUString; +using ::rtl::OUStringHash; +using ::rtl::OString; /* * CUPSWrapper class @@ -439,7 +446,6 @@ void CUPSManager::runDests() #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "starting cupsGetDests\n" ); #endif - int nDests = 0; cups_dest_t* pDests = NULL; // #i86306# prepare against really broken CUPS installations / missing servers @@ -459,7 +465,7 @@ void CUPSManager::runDests() // prepare against a signal during FcInit or FcConfigGetCurrent if( sigsetjmp( aViolationBuffer, ~0 ) == 0 ) { - nDests = m_pCUPSWrapper->cupsGetDests( &pDests ); + int nDests = m_pCUPSWrapper->cupsGetDests( &pDests ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "came out of cupsGetDests\n" ); #endif @@ -593,7 +599,7 @@ void CUPSManager::initialize() // behaviour aPrinter.m_aInfo.m_pParser = NULL; aPrinter.m_aInfo.m_aContext.setParser( NULL ); - std::hash_map< OUString, PPDContext, OUStringHash >::const_iterator c_it = m_aDefaultContexts.find( aPrinterName ); + boost::unordered_map< OUString, PPDContext, OUStringHash >::const_iterator c_it = m_aDefaultContexts.find( aPrinterName ); if( c_it != m_aDefaultContexts.end() ) { aPrinter.m_aInfo.m_pParser = c_it->second.getParser(); @@ -611,7 +617,7 @@ void CUPSManager::initialize() // remove everything that is not a CUPS printer and not // a special purpose printer (PDF, Fax) std::list< OUString > aRemovePrinters; - for( std::hash_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.begin(); + for( boost::unordered_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.begin(); it != m_aPrinters.end(); ++it ) { if( m_aCUPSDestMap.find( it->first ) != m_aCUPSDestMap.end() ) @@ -698,7 +704,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter ) { if( m_nDests && m_pDests && ! isCUPSDisabled() ) { - std::hash_map< OUString, int, OUStringHash >::iterator dest_it = + boost::unordered_map< OUString, int, OUStringHash >::iterator dest_it = m_aCUPSDestMap.find( aPrinter ); if( dest_it != m_aCUPSDestMap.end() ) { @@ -794,13 +800,13 @@ void CUPSManager::setupJobContextData( ) { #ifdef ENABLE_CUPS - std::hash_map< OUString, int, OUStringHash >::iterator dest_it = + boost::unordered_map< OUString, int, OUStringHash >::iterator dest_it = m_aCUPSDestMap.find( rData.m_aPrinterName ); if( dest_it == m_aCUPSDestMap.end() ) return PrinterInfoManager::setupJobContextData( rData ); - std::hash_map< OUString, Printer, OUStringHash >::iterator p_it = + boost::unordered_map< OUString, Printer, OUStringHash >::iterator p_it = m_aPrinters.find( rData.m_aPrinterName ); if( p_it == m_aPrinters.end() ) // huh ? { @@ -869,7 +875,6 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner { rNumOptions = 0; *rOptions = NULL; - int i; // emit features ordered to OrderDependency // ignore features that are set to default @@ -877,6 +882,7 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner // sanity check if( rJob.m_pParser == rJob.m_aContext.getParser() && rJob.m_pParser ) { + int i; int nKeys = rJob.m_aContext.countValuesModified(); ::std::vector< const PPDKey* > aKeys( nKeys ); for( i = 0; i < nKeys; i++ ) @@ -919,7 +925,7 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit osl::MutexGuard aGuard( m_aCUPSMutex ); - std::hash_map< OUString, int, OUStringHash >::iterator dest_it = + boost::unordered_map< OUString, int, OUStringHash >::iterator dest_it = m_aCUPSDestMap.find( rPrintername ); if( dest_it == m_aCUPSDestMap.end() ) { @@ -928,7 +934,7 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit } #ifdef ENABLE_CUPS - std::hash_map< FILE*, OString, FPtrHash >::const_iterator it = m_aSpoolFiles.find( pFile ); + boost::unordered_map< FILE*, OString, FPtrHash >::const_iterator it = m_aSpoolFiles.find( pFile ); if( it != m_aSpoolFiles.end() ) { fclose( pFile ); @@ -1055,7 +1061,7 @@ bool CUPSManager::setDefaultPrinter( const OUString& rName ) { bool bSuccess = false; #ifdef ENABLE_CUPS - std::hash_map< OUString, int, OUStringHash >::iterator nit = + boost::unordered_map< OUString, int, OUStringHash >::iterator nit = m_aCUPSDestMap.find( rName ); if( nit != m_aCUPSDestMap.end() && m_aCUPSMutex.tryToAcquire() ) { @@ -1081,10 +1087,10 @@ bool CUPSManager::writePrinterConfig() bool bDestModified = false; rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - for( std::hash_map< OUString, Printer, OUStringHash >::iterator prt = + for( boost::unordered_map< OUString, Printer, OUStringHash >::iterator prt = m_aPrinters.begin(); prt != m_aPrinters.end(); ++prt ) { - std::hash_map< OUString, int, OUStringHash >::iterator nit = + boost::unordered_map< OUString, int, OUStringHash >::iterator nit = m_aCUPSDestMap.find( prt->first ); if( nit == m_aCUPSDestMap.end() ) continue; @@ -1140,7 +1146,7 @@ const char* CUPSManager::authenticateUser( const char* /*pIn*/ ) const char* pRet = NULL; #ifdef ENABLE_CUPS - OUString aLib = OUString::createFromAscii( _XSALSET_LIBNAME ); + OUString aLib(RTL_CONSTASCII_USTRINGPARAM( _XSALSET_LIBNAME )); oslModule pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY ); if( pLib ) { @@ -1171,3 +1177,5 @@ const char* CUPSManager::authenticateUser( const char* /*pIn*/ ) return pRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index 811f93bcb826..03d676470ecb 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,7 +37,6 @@ #include "sal/alloca.h" using namespace psp; -using namespace rtl; JobData& JobData::operator=(const JobData& rRight) { @@ -168,9 +168,10 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes ) // now append the PPDContext stream buffer aStream.WriteLine( "PPDContexData" ); sal_uLong nBytes; - void* pContextBuffer = m_aContext.getStreamableBuffer( nBytes ); + char* pContextBuffer = m_aContext.getStreamableBuffer( nBytes ); if( nBytes ) aStream.Write( pContextBuffer, nBytes ); + delete [] pContextBuffer; // success pData = rtl_allocateMemory( bytes = aStream.Tell() ); @@ -252,7 +253,7 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa { rJobData.m_aContext.setParser( rJobData.m_pParser ); int nBytes = bytes - aStream.Tell(); - void* pRemain = alloca( bytes - aStream.Tell() ); + char* pRemain = (char*)alloca( bytes - aStream.Tell() ); aStream.Read( pRemain, nBytes ); rJobData.m_aContext.rebuildFromStreamBuffer( pRemain, nBytes ); bContext = true; @@ -263,3 +264,5 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa return bVersion && bPrinter && bOrientation && bCopies && bContext && bMargin && bPSLevel && bPDFDevice && bColorDevice && bColorDepth; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 9a85d02db894..3246e18fc806 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #include <stdlib.h> #include <stdio.h> -#include <hash_map> +#include <boost/unordered_map.hpp> #include "vcl/ppdparser.hxx" #include "vcl/strhelper.hxx" @@ -48,6 +49,9 @@ #include "osl/thread.h" #include "rtl/strbuf.hxx" #include "rtl/ustrbuf.hxx" +#include "rtl/instance.hxx" +#include <sal/macros.h> +#include <salhelper/linkhelper.hxx> #include "com/sun/star/lang/Locale.hpp" @@ -77,8 +81,8 @@ namespace psp } }; - 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; + typedef boost::unordered_map< com::sun::star::lang::Locale, rtl::OUString, LocaleHash, LocaleEqual > translation_map; + typedef boost::unordered_map< rtl::OUString, translation_map, rtl::OUStringHash > key_translation_map; key_translation_map m_aTranslations; public: @@ -243,10 +247,34 @@ namespace psp } return aResult; } + + class PPDCache + { + public: + std::list< PPDParser* > aAllParsers; + boost::unordered_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >* pAllPPDFiles; + PPDCache() + : pAllPPDFiles(NULL) + {} + ~PPDCache() + { + while( aAllParsers.begin() != aAllParsers.end() ) + { + delete aAllParsers.front(); + aAllParsers.pop_front(); + } + delete pAllPPDFiles; + pAllPPDFiles = NULL; + } + }; } using namespace psp; -using namespace rtl; + +using ::rtl::OUString; +using ::rtl::OStringBuffer; +using ::rtl::OUStringHash; + #undef DBG_ASSERT #if defined DBG_UTIL || (OSL_DEBUG_LEVEL > 1) @@ -256,8 +284,10 @@ using namespace rtl; #define DBG_ASSERT( x, y ) #endif -std::list< PPDParser* > PPDParser::aAllParsers; -std::hash_map< OUString, OUString, OUStringHash >* PPDParser::pAllPPDFiles = NULL; +namespace +{ + struct thePPDCache : public rtl::Static<PPDCache, thePPDCache> {}; +} class PPDDecompressStream { @@ -367,29 +397,19 @@ void PPDDecompressStream::ReadLine( ByteString& o_rLine ) static osl::FileBase::RC resolveLink( const rtl::OUString& i_rURL, rtl::OUString& o_rResolvedURL, rtl::OUString& o_rBaseName, osl::FileStatus::Type& o_rType, int nLinkLevel = 10 ) { - osl::DirectoryItem aLinkItem; - osl::FileBase::RC aRet = osl::FileBase::E_None; + salhelper::LinkResolver aResolver(osl_FileStatus_Mask_FileName | + osl_FileStatus_Mask_Type | + osl_FileStatus_Mask_FileURL); - if( ( aRet = osl::DirectoryItem::get( i_rURL, aLinkItem ) ) == osl::FileBase::E_None ) + osl::FileBase::RC aRet = aResolver.fetchFileStatus(i_rURL, nLinkLevel); + + if (aRet == osl::FileBase::E_None) { - osl::FileStatus aStatus( FileStatusMask_FileName | FileStatusMask_Type | FileStatusMask_LinkTargetURL ); - if( ( aRet = aLinkItem.getFileStatus( aStatus ) ) == osl::FileBase::E_None ) - { - if( aStatus.getFileType() == osl::FileStatus::Link ) - { - if( nLinkLevel > 0 ) - aRet = resolveLink( aStatus.getLinkTargetURL(), o_rResolvedURL, o_rBaseName, o_rType, nLinkLevel-1 ); - else - aRet = osl::FileBase::E_MULTIHOP; - } - else - { - o_rResolvedURL = i_rURL; - o_rBaseName = aStatus.getFileName(); - o_rType = aStatus.getFileType(); - } - } + o_rResolvedURL = aResolver.m_aStatus.getFileURL(); + o_rBaseName = aResolver.m_aStatus.getFileName(); + o_rType = aResolver.m_aStatus.getFileType(); } + return aRet; } @@ -402,7 +422,9 @@ void PPDParser::scanPPDDir( const String& rDir ) } const pSuffixes[] = { { ".PS", 3 }, { ".PPD", 4 }, { ".PS.GZ", 6 }, { ".PPD.GZ", 7 } }; - const int nSuffixes = sizeof(pSuffixes)/sizeof(pSuffixes[0]); + const int nSuffixes = SAL_N_ELEMENTS(pSuffixes); + + PPDCache &rPPDCache = thePPDCache::get(); osl::Directory aDir( rDir ); if ( aDir.open() == osl::FileBase::E_None ) @@ -412,7 +434,7 @@ void PPDParser::scanPPDDir( const String& rDir ) INetURLObject aPPDDir(rDir); while( aDir.getNextItem( aItem ) == osl::FileBase::E_None ) { - osl::FileStatus aStatus( FileStatusMask_FileName ); + osl::FileStatus aStatus( osl_FileStatus_Mask_FileName ); if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None ) { rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 ); @@ -437,7 +459,7 @@ void PPDParser::scanPPDDir( const String& rDir ) { if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) ) { - (*pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName(); + (*rPPDCache.pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName(); break; } } @@ -456,10 +478,11 @@ void PPDParser::scanPPDDir( const String& rDir ) void PPDParser::initPPDFiles() { - if( pAllPPDFiles ) + PPDCache &rPPDCache = thePPDCache::get(); + if( rPPDCache.pAllPPDFiles ) return; - pAllPPDFiles = new std::hash_map< OUString, OUString, OUStringHash >(); + rPPDCache.pAllPPDFiles = new boost::unordered_map< OUString, OUString, OUStringHash >(); // check installation directories std::list< OUString > aPathList; @@ -469,7 +492,7 @@ void PPDParser::initPPDFiles() INetURLObject aPPDDir( *ppd_it, INET_PROT_FILE, INetURLObject::ENCODE_ALL ); scanPPDDir( aPPDDir.GetMainURL( INetURLObject::NO_DECODE ) ); } - if( pAllPPDFiles->find( OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) ) == pAllPPDFiles->end() ) + if( rPPDCache.pAllPPDFiles->find( OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) ) == rPPDCache.pAllPPDFiles->end() ) { // last try: search in directory of executable (mainly for setup) OUString aExe; @@ -478,11 +501,11 @@ void PPDParser::initPPDFiles() INetURLObject aDir( aExe ); aDir.removeSegment(); #ifdef DEBUG - fprintf( stderr, "scanning last chance dir: %s\n", OUStringToOString( aDir.GetMainURL( INetURLObject::NO_DECODE ), osl_getThreadTextEncoding() ).getStr() ); + fprintf( stderr, "scanning last chance dir: %s\n", rtl::OUStringToOString( aDir.GetMainURL( INetURLObject::NO_DECODE ), osl_getThreadTextEncoding() ).getStr() ); #endif scanPPDDir( aDir.GetMainURL( INetURLObject::NO_DECODE ) ); #ifdef DEBUG - fprintf( stderr, "SGENPRT %s\n", pAllPPDFiles->find( OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) ) == pAllPPDFiles->end() ? "not found" : "found" ); + fprintf( stderr, "SGENPRT %s\n", rPPDCache.pAllPPDFiles->find( OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) ) == rPPDCache.pAllPPDFiles->end() ? "not found" : "found" ); #endif } } @@ -490,17 +513,19 @@ void PPDParser::initPPDFiles() void PPDParser::getKnownPPDDrivers( std::list< rtl::OUString >& o_rDrivers, bool bRefresh ) { + PPDCache &rPPDCache = thePPDCache::get(); + if( bRefresh ) { - delete pAllPPDFiles; - pAllPPDFiles = NULL; + delete rPPDCache.pAllPPDFiles; + rPPDCache.pAllPPDFiles = NULL; } initPPDFiles(); o_rDrivers.clear(); - std::hash_map< OUString, OUString, OUStringHash >::const_iterator it; - for( it = pAllPPDFiles->begin(); it != pAllPPDFiles->end(); ++it ) + boost::unordered_map< OUString, OUString, OUStringHash >::const_iterator it; + for( it = rPPDCache.pAllPPDFiles->begin(); it != rPPDCache.pAllPPDFiles->end(); ++it ) o_rDrivers.push_back( it->first ); } @@ -511,7 +536,8 @@ String PPDParser::getPPDFile( const String& rFile ) PPDDecompressStream aStream( aPPD.PathToFileName() ); if( ! aStream.IsOpen() ) { - std::hash_map< OUString, OUString, OUStringHash >::const_iterator it; + boost::unordered_map< OUString, OUString, OUStringHash >::const_iterator it; + PPDCache &rPPDCache = thePPDCache::get(); bool bRetry = true; do @@ -525,23 +551,23 @@ String PPDParser::getPPDFile( const String& rFile ) aBase = aBase.copy( nLastIndex+1 ); do { - it = pAllPPDFiles->find( aBase ); + it = rPPDCache.pAllPPDFiles->find( aBase ); nLastIndex = aBase.lastIndexOf( sal_Unicode( '.' ) ); if( nLastIndex > 0 ) aBase = aBase.copy( 0, nLastIndex ); - } while( it == pAllPPDFiles->end() && nLastIndex > 0 ); + } while( it == rPPDCache.pAllPPDFiles->end() && nLastIndex > 0 ); - if( it == pAllPPDFiles->end() && bRetry ) + if( it == rPPDCache.pAllPPDFiles->end() && bRetry ) { // a new file ? rehash - delete pAllPPDFiles; pAllPPDFiles = NULL; + delete rPPDCache.pAllPPDFiles; rPPDCache.pAllPPDFiles = NULL; bRetry = false; // note this is optimized for office start where // no new files occur and initPPDFiles is called only once } - } while( ! pAllPPDFiles ); + } while( ! rPPDCache.pAllPPDFiles ); - if( it != pAllPPDFiles->end() ) + if( it != rPPDCache.pAllPPDFiles->end() ) aStream.Open( it->second ); } @@ -620,12 +646,13 @@ const PPDParser* PPDParser::getParser( const String& rFile ) if( ! aFile.Len() ) { #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "Could not get printer PPD file \"%s\" !\n", OUStringToOString( rFile, osl_getThreadTextEncoding() ).getStr() ); + fprintf( stderr, "Could not get printer PPD file \"%s\" !\n", ::rtl::OUStringToOString( rFile, osl_getThreadTextEncoding() ).getStr() ); #endif return NULL; } - for( ::std::list< PPDParser* >::const_iterator it = aAllParsers.begin(); it != aAllParsers.end(); ++it ) + PPDCache &rPPDCache = thePPDCache::get(); + for( ::std::list< PPDParser* >::const_iterator it = rPPDCache.aAllParsers.begin(); it != rPPDCache.aAllParsers.end(); ++it ) if( (*it)->m_aFile == aFile ) return *it; @@ -644,24 +671,13 @@ const PPDParser* PPDParser::getParser( const String& rFile ) { // this may actually be the SGENPRT parser, // so ensure uniquness here - aAllParsers.remove( pNewParser ); + rPPDCache.aAllParsers.remove( pNewParser ); // insert new parser to list - aAllParsers.push_front( pNewParser ); + rPPDCache.aAllParsers.push_front( pNewParser ); } return pNewParser; } -void PPDParser::freeAll() -{ - while( aAllParsers.begin() != aAllParsers.end() ) - { - delete aAllParsers.front(); - aAllParsers.pop_front(); - } - delete pAllPPDFiles; - pAllPPDFiles = NULL; -} - PPDParser::PPDParser( const String& rFile ) : m_aFile( rFile ), m_bType42Capable( false ), @@ -750,9 +766,8 @@ PPDParser::PPDParser( const String& rFile ) : case PPDKey::AnySetup: pSetupType = "AnySetup";break; default: break; }; - fprintf( stderr, "\t\"%s\" (\"%s\") (%d values) OrderDependency: %d %s\n", + fprintf( stderr, "\t\"%s\" (%d values) OrderDependency: %d %s\n", BSTRING( pKey->getKey() ).GetBuffer(), - BSTRING( pKey->m_aUITranslation ).GetBuffer(), pKey->countValues(), pKey->m_nOrderDependency, pSetupType ); @@ -772,12 +787,10 @@ PPDParser::PPDParser( const String& rFile ) : case eNo: pVType = "no";break; default: break; }; - fprintf( stderr, "option: \"%s\" (\"%s\"), value: type %s \"%s\" (\"%s\")\n", + fprintf( stderr, "option: \"%s\", value: type %s \"%s\"\n", BSTRING( pValue->m_aOption ).GetBuffer(), - BSTRING( pValue->m_aOptionTranslation ).GetBuffer(), pVType, - BSTRING( pValue->m_aValue ).GetBuffer(), - BSTRING( pValue->m_aValueTranslation ).GetBuffer() ); + BSTRING( pValue->m_aValue ).GetBuffer() ); } } fprintf( stderr, "constraints: (%d found)\n", m_aConstraints.size() ); @@ -1270,7 +1283,7 @@ void PPDParser::parseConstraint( const ByteString& rLine ) } else // constraint for nonexistent keys; this happens - // e.g. in HP4PLUS3 (#75636#) + // e.g. in HP4PLUS3 bFailed = true; } } @@ -1318,13 +1331,9 @@ bool PPDParser::getMargins( ImLLy = StringToDouble( GetCommandLineToken( 1, aArea ) ); ImURx = StringToDouble( GetCommandLineToken( 2, aArea ) ); ImURy = StringToDouble( GetCommandLineToken( 3, aArea ) ); -// sscanf( m_pImageableAreas->getValue( nImArea )->m_aValue.GetStr(), -// "%lg%lg%lg%lg", &ImLLx, &ImLLy, &ImURx, &ImURy ); aArea = m_pPaperDimensions->getValue( nPDim )->m_aValue; PDWidth = StringToDouble( GetCommandLineToken( 0, aArea ) ); PDHeight = StringToDouble( GetCommandLineToken( 1, aArea ) ); -// sscanf( m_pPaperDimensions->getValue( nPDim )->m_aValue.GetStr(), -// "%lg%lg", &PDWidth, &PDHeight ); rLeft = (int)(ImLLx + 0.5); rLower = (int)(ImLLy + 0.5); rUpper = (int)(PDHeight - ImURy + 0.5); @@ -1493,13 +1502,14 @@ void PPDParser::getResolutionFromString( const String& rString, int& rXRes, int& rYRes ) const { - int nPos = 0, nDPIPos; + int nDPIPos; rXRes = rYRes = 300; nDPIPos = rString.SearchAscii( "dpi" ); if( nDPIPos != STRING_NOTFOUND ) { + int nPos = 0; if( ( nPos = rString.Search( 'x' ) ) != STRING_NOTFOUND ) { rXRes = rString.Copy( 0, nPos ).ToInt32(); @@ -2033,7 +2043,7 @@ void PPDContext::getUnconstrainedValues( const PPDKey* pKey, ::std::list< const // ------------------------------------------------------------------- -void* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const +char* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const { rBytes = 0; if( ! m_aCurrentValues.size() ) @@ -2054,9 +2064,9 @@ void* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const rBytes += 1; // for '\0' } rBytes += 1; - void* pBuffer = new char[ rBytes ]; + char* pBuffer = new char[ rBytes ]; memset( pBuffer, 0, rBytes ); - char* pRun = (char*)pBuffer; + char* pRun = pBuffer; for( it = m_aCurrentValues.begin(); it != m_aCurrentValues.end(); ++it ) { ByteString aCopy( it->first->getKey(), RTL_TEXTENCODING_MS_1252 ); @@ -2079,14 +2089,14 @@ void* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const // ------------------------------------------------------------------- -void PPDContext::rebuildFromStreamBuffer( void* pBuffer, sal_uLong nBytes ) +void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes ) { if( ! m_pParser ) return; m_aCurrentValues.clear(); - char* pRun = (char*)pBuffer; + char* pRun = pBuffer; while( nBytes && *pRun ) { ByteString aLine( pRun ); @@ -2164,3 +2174,5 @@ void PPDContext::getPageSize( String& rPaper, int& rWidth, int& rHeight ) const } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index 7108d7fb2a5c..e29855c939d1 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,22 +47,29 @@ #include "i18npool/paper.hxx" #include "rtl/strbuf.hxx" +#include <sal/macros.h> #include "osl/thread.hxx" #include "osl/mutex.hxx" #include "osl/process.h" +#include <boost/scoped_ptr.hpp> + // filename of configuration files #define PRINT_FILENAME "psprint.conf" // the group of the global defaults #define GLOBAL_DEFAULTS_GROUP "__Global_Printer_Defaults__" -#include <hash_set> +#include <boost/unordered_set.hpp> using namespace psp; -using namespace rtl; using namespace osl; +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OStringToOUString; +using ::rtl::OUStringHash; + namespace psp { class SystemQueueInfo : public Thread @@ -103,9 +111,9 @@ PrinterInfoManager& PrinterInfoManager::get() pSalData->m_pPIManager = new PrinterInfoManager(); pSalData->m_pPIManager->initialize(); - #if OSL_DEBUG_LEVEL > 1 +#if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "PrinterInfoManager::get create Manager of type %d\n", pSalData->m_pPIManager->getType() ); - #endif +#endif } return *pSalData->m_pPIManager; @@ -187,7 +195,7 @@ bool PrinterInfoManager::checkPrintersChanged( bool bWait ) } else { - FileStatus aStatus( FileStatusMask_ModifyTime ); + FileStatus aStatus( osl_FileStatus_Mask_ModifyTime ); if( aItem.getFileStatus( aStatus ) ) bChanged = true; // unlikely but not impossible else @@ -261,7 +269,7 @@ void PrinterInfoManager::initialize() if( aConfig.HasGroup( GLOBAL_DEFAULTS_GROUP ) ) { #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "found global defaults in %s\n", OUStringToOString( aFile.PathToFileName(), RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); + fprintf( stderr, "found global defaults in %s\n", rtl::OUStringToOString( aFile.PathToFileName(), RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); #endif aConfig.SetGroup( GLOBAL_DEFAULTS_GROUP ); @@ -339,7 +347,7 @@ void PrinterInfoManager::initialize() } } #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "global settings: fontsubst = %s, %d substitutes\n", m_aGlobalDefaults.m_bPerformFontSubstitution ? "true" : "false", (int)m_aGlobalDefaults.m_aFontSubstitutes.size() ); + fprintf( stderr, "global settings: fontsubst = %s, %" SAL_PRI_SIZET "u substitutes\n", m_aGlobalDefaults.m_bPerformFontSubstitution ? "true" : "false", m_aGlobalDefaults.m_aFontSubstitutes.size() ); #endif } } @@ -363,7 +371,7 @@ void PrinterInfoManager::initialize() FileBase::getFileURLFromSystemPath( aFile.PathToFileName(), aUniPath ); - FileStatus aStatus( FileStatusMask_ModifyTime ); + FileStatus aStatus( osl_FileStatus_Mask_ModifyTime ); DirectoryItem aItem; // setup WatchFile list @@ -551,7 +559,7 @@ void PrinterInfoManager::initialize() FileBase::getFileURLFromSystemPath( aFile.PathToFileName(), aPrinter.m_aFile ); aPrinter.m_bModified = false; aPrinter.m_aGroup = aConfig.GetGroupName( nGroup ); - std::hash_map< OUString, Printer, OUStringHash >::const_iterator find_it = + boost::unordered_map< OUString, Printer, OUStringHash >::const_iterator find_it = m_aPrinters.find( aPrinterName ); if( find_it != m_aPrinters.end() ) { @@ -630,7 +638,7 @@ void PrinterInfoManager::initialize() void PrinterInfoManager::listPrinters( ::std::list< OUString >& rList ) const { - ::std::hash_map< OUString, Printer, OUStringHash >::const_iterator it; + ::boost::unordered_map< OUString, Printer, OUStringHash >::const_iterator it; rList.clear(); for( it = m_aPrinters.begin(); it != m_aPrinters.end(); ++it ) rList.push_back( it->first ); @@ -641,7 +649,7 @@ void PrinterInfoManager::listPrinters( ::std::list< OUString >& rList ) const const PrinterInfo& PrinterInfoManager::getPrinterInfo( const OUString& rPrinter ) const { static PrinterInfo aEmptyInfo; - ::std::hash_map< OUString, Printer, OUStringHash >::const_iterator it = m_aPrinters.find( rPrinter ); + ::boost::unordered_map< OUString, Printer, OUStringHash >::const_iterator it = m_aPrinters.find( rPrinter ); DBG_ASSERT( it != m_aPrinters.end(), "Do not ask for info about nonexistent printers" ); @@ -652,7 +660,7 @@ const PrinterInfo& PrinterInfoManager::getPrinterInfo( const OUString& rPrinter void PrinterInfoManager::changePrinterInfo( const OUString& rPrinter, const PrinterInfo& rNewInfo ) { - ::std::hash_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinter ); + ::boost::unordered_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinter ); DBG_ASSERT( it != m_aPrinters.end(), "Do not change nonexistant printers" ); @@ -683,9 +691,9 @@ static bool checkWriteability( const OUString& rUniPath ) bool PrinterInfoManager::writePrinterConfig() { // find at least one writeable config - ::std::hash_map< OUString, Config*, OUStringHash > files; - ::std::hash_map< OUString, int, OUStringHash > rofiles; - ::std::hash_map< OUString, Config*, OUStringHash >::iterator file_it; + ::boost::unordered_map< OUString, Config*, OUStringHash > files; + ::boost::unordered_map< OUString, int, OUStringHash > rofiles; + ::boost::unordered_map< OUString, Config*, OUStringHash >::iterator file_it; for( ::std::list< WatchFile >::const_iterator wit = m_aWatchFiles.begin(); wit != m_aWatchFiles.end(); ++wit ) { @@ -703,7 +711,7 @@ bool PrinterInfoManager::writePrinterConfig() pGlobal->SetGroup( GLOBAL_DEFAULTS_GROUP ); pGlobal->WriteKey( "DisableCUPS", m_bDisableCUPS ? "true" : "false" ); - ::std::hash_map< OUString, Printer, OUStringHash >::iterator it; + ::boost::unordered_map< OUString, Printer, OUStringHash >::iterator it; for( it = m_aPrinters.begin(); it != m_aPrinters.end(); ++it ) { if( ! it->second.m_bModified ) @@ -806,12 +814,12 @@ bool PrinterInfoManager::writePrinterConfig() // write font substitution table pConfig->WriteKey( "PerformFontSubstitution", it->second.m_aInfo.m_bPerformFontSubstitution ? "true" : "false" ); - for( ::std::hash_map< OUString, OUString, OUStringHash >::const_iterator subst = it->second.m_aInfo.m_aFontSubstitutes.begin(); + for( ::boost::unordered_map< OUString, OUString, OUStringHash >::const_iterator subst = it->second.m_aInfo.m_aFontSubstitutes.begin(); subst != it->second.m_aInfo.m_aFontSubstitutes.end(); ++subst ) { ByteString aKey( "SubstFont_" ); - aKey.Append( OUStringToOString( subst->first, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); - pConfig->WriteKey( aKey, OUStringToOString( subst->second, RTL_TEXTENCODING_ISO_8859_1 ) ); + aKey.Append( rtl::OUStringToOString( subst->first, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); + pConfig->WriteKey( aKey, rtl::OUStringToOString( subst->second, RTL_TEXTENCODING_ISO_8859_1 ) ); } } } @@ -866,7 +874,7 @@ bool PrinterInfoManager::addPrinter( const OUString& rPrinterName, const OUStrin bSuccess = true; #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "new printer %s, level = %d, pdfdevice = %d, colordevice = %d, depth = %d\n", - OUStringToOString( rPrinterName, osl_getThreadTextEncoding() ).getStr(), + rtl::OUStringToOString( rPrinterName, osl_getThreadTextEncoding() ).getStr(), m_aPrinters[rPrinterName].m_aInfo.m_nPSLevel, m_aPrinters[rPrinterName].m_aInfo.m_nPDFDevice, m_aPrinters[rPrinterName].m_aInfo.m_nColorDevice, @@ -886,7 +894,7 @@ bool PrinterInfoManager::removePrinter( const OUString& rPrinterName, bool bChec { bool bSuccess = true; - ::std::hash_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinterName ); + ::boost::unordered_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinterName ); if( it != m_aPrinters.end() ) { if( it->second.m_aFile.getLength() ) @@ -940,7 +948,7 @@ bool PrinterInfoManager::setDefaultPrinter( const OUString& rPrinterName ) { bool bSuccess = false; - ::std::hash_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinterName ); + ::boost::unordered_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinterName ); if( it != m_aPrinters.end() ) { bSuccess = true; @@ -971,7 +979,7 @@ void PrinterInfoManager::fillFontSubstitutions( PrinterInfo& rInfo ) const return; ::std::list< FastPrintFontInfo > aFonts; - ::std::hash_map< OUString, ::std::list< FastPrintFontInfo >, OUStringHash > aPrinterFonts; + ::boost::unordered_map< OUString, ::std::list< FastPrintFontInfo >, OUStringHash > aPrinterFonts; rFontManager.getFontListWithFastInfo( aFonts, rInfo.m_pParser ); // get builtin fonts @@ -981,8 +989,8 @@ void PrinterInfoManager::fillFontSubstitutions( PrinterInfo& rInfo ) const aPrinterFonts[ it->m_aFamilyName.toAsciiLowerCase() ].push_back( *it ); // map lower case, so build a local copy of the font substitutions - ::std::hash_map< OUString, OUString, OUStringHash > aSubstitutions; - ::std::hash_map< OUString, OUString, OUStringHash >::const_iterator subst; + ::boost::unordered_map< OUString, OUString, OUStringHash > aSubstitutions; + ::boost::unordered_map< OUString, OUString, OUStringHash >::const_iterator subst; for( subst = rInfo.m_aFontSubstitutes.begin(); subst != rInfo.m_aFontSubstitutes.end(); ++subst ) { OUString aFamily( subst->first.toAsciiLowerCase() ); @@ -1039,12 +1047,12 @@ void PrinterInfoManager::fillFontSubstitutions( PrinterInfo& rInfo ) const fprintf( stderr, "substitute %s %s %d %d\n" " -> %s %s %d %d\n", - OUStringToOString( it->m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr(), + rtl::OUStringToOString( it->m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr(), it->m_eItalic == italic::Upright ? "r" : it->m_eItalic == italic::Oblique ? "o" : it->m_eItalic == italic::Italic ? "i" : "u", it->m_eWeight, it->m_eWidth, - OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr(), + rtl::OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr(), aInfo.m_eItalic == italic::Upright ? "r" : aInfo.m_eItalic == italic::Oblique ? "o" : aInfo.m_eItalic == italic::Italic ? "i" : "u", aInfo.m_eWeight, aInfo.m_eWidth @@ -1110,7 +1118,7 @@ FILE* PrinterInfoManager::startSpool( const OUString& rPrintername, bool bQuickC const PrinterInfo& rPrinterInfo = getPrinterInfo (rPrintername); const rtl::OUString& rCommand = (bQuickCommand && rPrinterInfo.m_aQuickCommand.getLength() ) ? rPrinterInfo.m_aQuickCommand : rPrinterInfo.m_aCommand; - rtl::OString aShellCommand = OUStringToOString (rCommand, RTL_TEXTENCODING_ISO_8859_1); + rtl::OString aShellCommand = rtl::OUStringToOString (rCommand, RTL_TEXTENCODING_ISO_8859_1); aShellCommand += rtl::OString( " 2>/dev/null" ); return popen (aShellCommand.getStr(), "w"); @@ -1123,7 +1131,7 @@ int PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUStri void PrinterInfoManager::setupJobContextData( JobData& rData ) { - std::hash_map< OUString, Printer, OUStringHash >::iterator it = + boost::unordered_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rData.m_aPrinterName ); if( it != m_aPrinters.end() ) { @@ -1150,7 +1158,7 @@ void PrinterInfoManager::setDefaultPaper( PPDContext& rContext ) const { #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "not setting default paper, already set %s\n", - OUStringToOString( rContext.getValue( pPageSizeKey )->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); + ::rtl::OUStringToOString( rContext.getValue( pPageSizeKey )->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); #endif return; } @@ -1167,12 +1175,12 @@ void PrinterInfoManager::setDefaultPaper( PPDContext& rContext ) const if( pPaperVal ) { #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "setting default paper %s\n", OUStringToOString( pPaperVal->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); + fprintf( stderr, "setting default paper %s\n", ::rtl::OUStringToOString( pPaperVal->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); #endif rContext.setValue( pPageSizeKey, pPaperVal ); #if OSL_DEBUG_LEVEL > 1 pPaperVal = rContext.getValue( pPageSizeKey ); - fprintf( stderr, "-> got paper %s\n", OUStringToOString( pPaperVal->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); + fprintf( stderr, "-> got paper %s\n", ::rtl::OUStringToOString( pPaperVal->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); #endif } } @@ -1230,15 +1238,15 @@ struct SystemCommandParameters tokenHandler pHandler; }; -#if ! (defined(LINUX) || defined(NETBSD) || defined(FREEBSD)) +#if ! (defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD)) static void lpgetSysQueueTokenHandler( const std::list< rtl::OString >& i_rLines, std::list< PrinterInfoManager::SystemPrintQueue >& o_rQueues, const SystemCommandParameters* ) { rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - std::hash_set< OUString, OUStringHash > aUniqueSet; - std::hash_set< OUString, OUStringHash > aOnlySet; + boost::unordered_set< OUString, OUStringHash > aUniqueSet; + boost::unordered_set< OUString, OUStringHash > aOnlySet; aUniqueSet.insert( OUString( RTL_CONSTASCII_USTRINGPARAM( "_all" ) ) ); aUniqueSet.insert( OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ) ); @@ -1334,7 +1342,7 @@ static void standardSysQueueTokenHandler( const SystemCommandParameters* i_pParms) { rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - std::hash_set< OUString, OUStringHash > aUniqueSet; + boost::unordered_set< OUString, OUStringHash > aUniqueSet; rtl::OString aForeToken( i_pParms->pForeToken ); rtl::OString aAftToken( i_pParms->pAftToken ); /* Normal Unix print queue discovery, also used for Darwin 5 LPR printing @@ -1375,7 +1383,7 @@ static void standardSysQueueTokenHandler( static const struct SystemCommandParameters aParms[] = { - #if defined(LINUX) || defined(NETBSD) || defined(FREEBSD) + #if defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD) { "/usr/sbin/lpc status", "lpr -P \"(PRINTER)\"", "", ":", 0, standardSysQueueTokenHandler }, { "lpc status", "lpr -P \"(PRINTER)\"", "", ":", 0, standardSysQueueTokenHandler }, { "LANG=C;LC_ALL=C;export LANG LC_ALL;lpstat -s", "lp -d \"(PRINTER)\"", "system for ", ": ", 1, standardSysQueueTokenHandler } @@ -1394,7 +1402,7 @@ void SystemQueueInfo::run() std::list< rtl::OString > aLines; /* Discover which command we can use to get a list of all printer queues */ - for( unsigned int i = 0; i < sizeof(aParms)/sizeof(aParms[0]); i++ ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS(aParms); i++ ) { aLines.clear(); rtl::OStringBuffer aCmdLine( 128 ); @@ -1427,3 +1435,4 @@ void SystemQueueInfo::run() } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printergfx/bitmap_gfx.cxx b/vcl/unx/generic/printergfx/bitmap_gfx.cxx index 9275db1e469f..0c139678f8ab 100644 --- a/vcl/unx/generic/printergfx/bitmap_gfx.cxx +++ b/vcl/unx/generic/printergfx/bitmap_gfx.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -730,3 +731,5 @@ PrinterGfx::DrawPS2TrueColorImage (const PrinterBmp& rBitmap, const Rectangle& r } } /* namespace psp */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printergfx/common_gfx.cxx b/vcl/unx/generic/printergfx/common_gfx.cxx index 6ebf79cfac73..7cae4586bf6e 100644 --- a/vcl/unx/generic/printergfx/common_gfx.cxx +++ b/vcl/unx/generic/printergfx/common_gfx.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,9 +72,9 @@ PrinterGfx::Init (PrinterJob &rPrinterJob) rPrinterJob.GetScale (mfScaleX, mfScaleY); const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( rPrinterJob.GetPrinterName() ) ); if( mpFontSubstitutes ) - delete const_cast< ::std::hash_map<fontID,fontID>* >(mpFontSubstitutes); + delete const_cast< ::boost::unordered_map<fontID,fontID>* >(mpFontSubstitutes); if( rInfo.m_bPerformFontSubstitution ) - mpFontSubstitutes = new ::std::hash_map< fontID, fontID >( rInfo.m_aFontSubstitutions ); + mpFontSubstitutes = new ::boost::unordered_map< fontID, fontID >( rInfo.m_aFontSubstitutions ); else mpFontSubstitutes = NULL; mbUploadPS42Fonts = rInfo.m_pParser ? ( rInfo.m_pParser->isType42Capable() ? sal_True : sal_False ) : sal_False; @@ -95,9 +96,9 @@ PrinterGfx::Init (const JobData& rData) mfScaleY = (double)72.0 / (double)mnDpi; const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( rData.m_aPrinterName ) ); if( mpFontSubstitutes ) - delete const_cast< ::std::hash_map<fontID,fontID>* >(mpFontSubstitutes); + delete const_cast< ::boost::unordered_map<fontID,fontID>* >(mpFontSubstitutes); if( rInfo.m_bPerformFontSubstitution ) - mpFontSubstitutes = new ::std::hash_map< fontID, fontID >( rInfo.m_aFontSubstitutions ); + mpFontSubstitutes = new ::boost::unordered_map< fontID, fontID >( rInfo.m_aFontSubstitutions ); else mpFontSubstitutes = NULL; mbUploadPS42Fonts = rInfo.m_pParser ? ( rInfo.m_pParser->isType42Capable() ? sal_True : sal_False ) : sal_False; @@ -143,7 +144,7 @@ PrinterGfx::PrinterGfx() : PrinterGfx::~PrinterGfx() { /* - * #95810# the original reasoning why mpFontSubstitutes is a pointer was + * the original reasoning why mpFontSubstitutes is a pointer was * that applications should release all PrinterGfx when printers change * because they are really invalid; the corresponding printers may have * changed their settings or even not exist anymore. @@ -151,7 +152,7 @@ PrinterGfx::~PrinterGfx() * Alas, this is not always done real time. So we keep a local copy of * the font substitutes now in case of bad timing. */ - delete const_cast< ::std::hash_map<fontID,fontID>* >(mpFontSubstitutes); + delete const_cast< ::boost::unordered_map<fontID,fontID>* >(mpFontSubstitutes); } void @@ -565,7 +566,7 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const sa } else { - DBG_ERROR( "PrinterGfx::DrawPolyLineBezier: Strange output" ); + OSL_FAIL( "PrinterGfx::DrawPolyLineBezier: Strange output" ); } i+=3; } @@ -611,7 +612,7 @@ PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const sal } else { - DBG_ERROR( "PrinterGfx::DrawPolygonBezier: Strange output" ); + OSL_FAIL( "PrinterGfx::DrawPolygonBezier: Strange output" ); } i+=3; } @@ -645,7 +646,7 @@ PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints, for (unsigned int i=0; i<nPoly;i++) { sal_uInt32 nPoints = pPoints[i]; - // #112689# sanity check + // sanity check if( nPoints == 0 || pPtAry[i] == NULL ) continue; @@ -675,7 +676,7 @@ PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints, } else { - DBG_ERROR( "PrinterGfx::DrawPolyPolygonBezier: Strange output" ); + OSL_FAIL( "PrinterGfx::DrawPolyPolygonBezier: Strange output" ); } j+=3; } @@ -998,7 +999,7 @@ PrinterGfx::PSBinPath (const Point& rCurrent, Point& rOld, case 4: cCmd |= 0x01; break; case 6: cCmd |= 0x02; break; case 8: cCmd |= 0x03; break; - default: DBG_ERROR ("invalid x precision in binary path"); + default: OSL_FAIL("invalid x precision in binary path"); } switch (nXPrec) { @@ -1006,7 +1007,7 @@ PrinterGfx::PSBinPath (const Point& rCurrent, Point& rOld, case 4: cCmd |= 0x04; break; case 6: cCmd |= 0x08; break; case 8: cCmd |= 0x0c; break; - default: DBG_ERROR ("invalid y precision in binary path"); + default: OSL_FAIL("invalid y precision in binary path"); } cCmd += 'A'; pPath[0] = cCmd; @@ -1282,3 +1283,5 @@ PrinterGfx::DrawEPS( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize } return bSuccess; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printergfx/glyphset.cxx b/vcl/unx/generic/printergfx/glyphset.cxx index 9b0f5fb99c43..967c9f2a175f 100644 --- a/vcl/unx/generic/printergfx/glyphset.cxx +++ b/vcl/unx/generic/printergfx/glyphset.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,11 @@ using namespace vcl; using namespace psp; -using namespace rtl; + +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OStringBuffer; +using ::rtl::OUStringToOString; GlyphSet::GlyphSet () : mnFontID (-1), @@ -712,7 +717,7 @@ GlyphSet::PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx) // loop thru all the font subsets sal_Int32 nGlyphSetID = 0; char_list_t::iterator aGlyphSet; - for (aGlyphSet = maCharList.begin(); aGlyphSet != maCharList.end(); aGlyphSet++) + for (aGlyphSet = maCharList.begin(); aGlyphSet != maCharList.end(); ++aGlyphSet) { ++nGlyphSetID; @@ -872,7 +877,7 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAllowType42 // loop thru all the chars in the subset char_map_t::const_iterator aChar; sal_Int32 n = 0; - for (aChar = (*aCharSet).begin(); aChar != (*aCharSet).end(); aChar++) + for (aChar = (*aCharSet).begin(); aChar != (*aCharSet).end(); ++aChar) { pUChars [n] = (*aChar).first; pEncoding [n] = (*aChar).second; @@ -904,7 +909,7 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAllowType42 // loop thru all the glyphs in the subset glyph_map_t::const_iterator aGlyph; sal_Int32 n = 0; - for (aGlyph = (*aGlyphSet).begin(); aGlyph != (*aGlyphSet).end(); aGlyph++) + for (aGlyph = (*aGlyphSet).begin(); aGlyph != (*aGlyphSet).end(); ++aGlyph) { pTTGlyphMapping [n] = (*aGlyph).first; pEncoding [n] = (*aGlyph).second; @@ -940,3 +945,5 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAllowType42 return sal_True; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printergfx/glyphset.hxx b/vcl/unx/generic/printergfx/glyphset.hxx index 320e8e071955..c8b009c91155 100644 --- a/vcl/unx/generic/printergfx/glyphset.hxx +++ b/vcl/unx/generic/printergfx/glyphset.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,7 @@ #include "tools/gen.hxx" #include <list> -#include <hash_map> +#include <boost/unordered_map.hpp> namespace psp { @@ -55,9 +56,9 @@ private: rtl_TextEncoding mnBaseEncoding; bool mbUseFontEncoding; - typedef std::hash_map< sal_Unicode, sal_uInt8 > char_map_t; + typedef boost::unordered_map< sal_Unicode, sal_uInt8 > char_map_t; typedef std::list< char_map_t > char_list_t; - typedef std::hash_map< sal_uInt32, sal_uInt8 > glyph_map_t; + typedef boost::unordered_map< sal_uInt32, sal_uInt8 > glyph_map_t; typedef std::list< glyph_map_t > glyph_list_t; char_list_t maCharList; @@ -133,3 +134,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printergfx/printerjob.cxx b/vcl/unx/generic/printergfx/printerjob.cxx index 351d1af9b41d..827b5c7cf269 100644 --- a/vcl/unx/generic/printergfx/printerjob.cxx +++ b/vcl/unx/generic/printergfx/printerjob.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,12 +51,17 @@ #include "osl/thread.h" #include "sal/alloca.h" +#include <sal/macros.h> #include <algorithm> #include <vector> using namespace psp; -using namespace rtl; + +using ::rtl::OUString; +using ::rtl::OUStringToOString; +using ::rtl::OString; +using ::rtl::OStringBuffer; // forward declaration @@ -108,10 +114,10 @@ PrinterJob::CreateSpoolFile (const rtl::OUString& rName, const rtl::OUString& rE nError = osl::File::getFileURLFromSystemPath( aFile, aFileURL ); if (nError != osl::File::E_None) return NULL; - aFileURL = maSpoolDirName + rtl::OUString::createFromAscii ("/") + aFileURL; + aFileURL = maSpoolDirName + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("/")) + aFileURL; pFile = new osl::File (aFileURL); - nError = pFile->open (OpenFlag_Read | OpenFlag_Write | OpenFlag_Create); + nError = pFile->open (osl_File_OpenFlag_Read | osl_File_OpenFlag_Write | osl_File_OpenFlag_Create); if (nError != osl::File::E_None) { delete pFile; @@ -273,7 +279,7 @@ removeSpoolDir (const rtl::OUString& rSpoolDir) { // Conversion did not work, as this is quite a dangerous action, // we should abort here .... - OSL_ENSURE( 0, "psprint: couldn't remove spool directory" ); + OSL_FAIL( "psprint: couldn't remove spool directory" ); return; } rtl::OString aSysPathByte = @@ -285,7 +291,7 @@ removeSpoolDir (const rtl::OUString& rSpoolDir) nChar += psp::appendStr (aSysPathByte.getStr(), pSystem + nChar); if (system (pSystem) == -1) - OSL_ENSURE( 0, "psprint: couldn't remove spool directory" ); + OSL_FAIL( "psprint: couldn't remove spool directory" ); } /* creates a spool directory with a "pidgin random" value based on @@ -325,12 +331,12 @@ createSpoolDir () PrinterJob::~PrinterJob () { std::list< osl::File* >::iterator pPage; - for (pPage = maPageList.begin(); pPage != maPageList.end(); pPage++) + for (pPage = maPageList.begin(); pPage != maPageList.end(); ++pPage) { //(*pPage)->remove(); delete *pPage; } - for (pPage = maHeaderList.begin(); pPage != maHeaderList.end(); pPage++) + for (pPage = maHeaderList.begin(); pPage != maHeaderList.end(); ++pPage) { //(*pPage)->remove(); delete *pPage; @@ -396,9 +402,9 @@ PrinterJob::StartJob ( maSpoolDirName = createSpoolDir (); maJobTitle = rJobName; - rtl::OUString aExt = rtl::OUString::createFromAscii (".ps"); - mpJobHeader = CreateSpoolFile (rtl::OUString::createFromAscii("psp_head"), aExt); - mpJobTrailer = CreateSpoolFile (rtl::OUString::createFromAscii("psp_tail"), aExt); + rtl::OUString aExt(RTL_CONSTASCII_USTRINGPARAM (".ps")); + mpJobHeader = CreateSpoolFile (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("psp_head")), aExt); + mpJobTrailer = CreateSpoolFile (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("psp_tail")), aExt); if( ! (mpJobHeader && mpJobTrailer) ) // existing files are removed in destructor return sal_False; @@ -428,7 +434,7 @@ PrinterJob::StartJob ( sal_Char pCreationDate [256]; WritePS (mpJobHeader, "%%CreationDate: ("); getLocalTime(pCreationDate); - for( unsigned int i = 0; i < sizeof(pCreationDate)/sizeof(pCreationDate[0]); i++ ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS(pCreationDate); i++ ) { if( pCreationDate[i] == '\n' ) { @@ -578,11 +584,11 @@ PrinterJob::EndJob () std::list< osl::File* >::iterator pPageHead; for (pPageBody = maPageList.begin(), pPageHead = maHeaderList.begin(); pPageBody != maPageList.end() && pPageHead != maHeaderList.end(); - pPageBody++, pPageHead++) + ++pPageBody, ++pPageHead) { if( *pPageHead ) { - osl::File::RC nError = (*pPageHead)->open(OpenFlag_Read); + osl::File::RC nError = (*pPageHead)->open(osl_File_OpenFlag_Read); if (nError == osl::File::E_None) { AppendPS (pDestFILE, *pPageHead, pBuffer); @@ -593,7 +599,7 @@ PrinterJob::EndJob () bSuccess = sal_False; if( *pPageBody ) { - osl::File::RC nError = (*pPageBody)->open(OpenFlag_Read); + osl::File::RC nError = (*pPageBody)->open(osl_File_OpenFlag_Read); if (nError == osl::File::E_None) { AppendPS (pDestFILE, *pPageBody, pBuffer); @@ -671,12 +677,12 @@ PrinterJob::StartPage (const JobData& rJobSetup) InitPaperSize (rJobSetup); rtl::OUString aPageNo = rtl::OUString::valueOf ((sal_Int32)maPageList.size()+1); // sequential page number must start with 1 - rtl::OUString aExt = aPageNo + rtl::OUString::createFromAscii (".ps"); + rtl::OUString aExt = aPageNo + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM (".ps")); osl::File* pPageHeader = CreateSpoolFile ( - rtl::OUString::createFromAscii("psp_pghead"), aExt); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("psp_pghead")), aExt); osl::File* pPageBody = CreateSpoolFile ( - rtl::OUString::createFromAscii("psp_pgbody"), aExt); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("psp_pgbody")), aExt); maHeaderList.push_back (pPageHeader); maPageList.push_back (pPageBody); @@ -809,7 +815,6 @@ static bool writeFeature( osl::File* pFile, const PPDKey* pKey, const PPDValue* bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool bDocumentSetup ) { bool bSuccess = true; - int i; // emit features ordered to OrderDependency // ignore features that are set to default @@ -820,6 +825,7 @@ bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool b ( m_aLastJobData.m_pParser == rJob.m_pParser || m_aLastJobData.m_pParser == NULL ) ) { + int i; int nKeys = rJob.m_aContext.countValuesModified(); ::std::vector< const PPDKey* > aKeys( nKeys ); for( i = 0; i < nKeys; i++ ) @@ -1202,3 +1208,5 @@ bool PrinterJob::writeSetup( osl::File* pFile, const JobData& rJob ) return bSuccess && bFeatureSuccess; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printergfx/psputil.cxx b/vcl/unx/generic/printergfx/psputil.cxx index 370114be47cb..9a5de44960e6 100644 --- a/vcl/unx/generic/printergfx/psputil.cxx +++ b/vcl/unx/generic/printergfx/psputil.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,7 +95,7 @@ getAlignedHexValueOf (sal_Int32 nValue, sal_Char* pBuffer) case '5' : pBuffer[0] = 'D'; break; case '6' : pBuffer[0] = 'E'; break; case '7' : pBuffer[0] = 'F'; break; - default: DBG_ERROR("Already a signed value"); + default: OSL_FAIL("Already a signed value"); } } @@ -266,3 +267,5 @@ GetConverterFactory () } /* namespace psp */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printergfx/psputil.hxx b/vcl/unx/generic/printergfx/psputil.hxx index d4af41bb95ed..878fd9c7791a 100644 --- a/vcl/unx/generic/printergfx/psputil.hxx +++ b/vcl/unx/generic/printergfx/psputil.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,3 +77,4 @@ ConverterFactory* GetConverterFactory (); #endif /* _PSPRINT_PRINTERUTIL_HXX_ */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/printergfx/text_gfx.cxx b/vcl/unx/generic/printergfx/text_gfx.cxx index 7934821d4d70..263e0b4c7995 100644 --- a/vcl/unx/generic/printergfx/text_gfx.cxx +++ b/vcl/unx/generic/printergfx/text_gfx.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -178,7 +179,7 @@ void PrinterGfx::drawGlyphs( // draw the string // search for a glyph set matching the set font std::list< GlyphSet >::iterator aIter; - for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); aIter++) + for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); ++aIter) if ( ((*aIter).GetFontID() == mnFontID) && ((*aIter).IsVertical() == mbTextVertical)) { @@ -621,7 +622,7 @@ PrinterGfx::drawText( // search for a glyph set matching the set font std::list< GlyphSet >::iterator aIter; - for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); aIter++) + for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); ++aIter) if ( ((*aIter).GetFontID() == mnFontID) && ((*aIter).IsVertical() == mbTextVertical)) { @@ -702,7 +703,7 @@ PrinterGfx::getFontSubstitute () const { if( mpFontSubstitutes ) { - ::std::hash_map< fontID, fontID >::const_iterator it = + ::boost::unordered_map< fontID, fontID >::const_iterator it = mpFontSubstitutes->find( mnFontID ); if( it != mpFontSubstitutes->end() ) return it->second; @@ -746,7 +747,7 @@ const ::std::list< KernPair >& PrinterGfx::getKernPairs( bool bVertical ) const fontID nFont = mnFontID; if( mpFontSubstitutes ) { - ::std::hash_map< fontID, fontID >::const_iterator it = + ::boost::unordered_map< fontID, fontID >::const_iterator it = mpFontSubstitutes->find( mnFontID ); if( it != mpFontSubstitutes->end() ) nFont = it->second; @@ -812,7 +813,7 @@ PrinterGfx::writeResources( osl::File* pFile, std::list< rtl::OString >& rSuppli WritePS (pFile, aPostScriptName.getStr()); WritePS (pFile, "\n"); - osl::File::RC nError = aFontFile.open (OpenFlag_Read); + osl::File::RC nError = aFontFile.open(osl_File_OpenFlag_Read); if (nError == osl::File::E_None) { convertPfbToPfa (aFontFile, *pFile); @@ -860,3 +861,5 @@ void PrinterGfx::setStrictSO52Compatibility( bool bCompat) { mbStrictSO52Compatibility = bCompat; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/window/FWS.cxx b/vcl/unx/generic/window/FWS.cxx index 4683864fd116..a90f76af90c2 100644 --- a/vcl/unx/generic/window/FWS.cxx +++ b/vcl/unx/generic/window/FWS.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -190,7 +191,7 @@ WMSupportsFWS (Display *display, int screen) * * newHandler() - * - * Handle X errors (temporarily) to record the occurance of BadWindow + * Handle X errors (temporarily) to record the occurrence of BadWindow * errors without crashing. Used to detect the FWS_COMM_WINDOW root window * property containing an old or obsolete window id. * @@ -278,3 +279,4 @@ AddFwsProtocols (Display *display, Window window) (unsigned char *) fwsProtocols, nProtos); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/window/FWS.hxx b/vcl/unx/generic/window/FWS.hxx index a687870ede4a..36b4b16a9214 100644 --- a/vcl/unx/generic/window/FWS.hxx +++ b/vcl/unx/generic/window/FWS.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,3 +63,4 @@ AddFwsProtocols (Display *display, Window window); #endif // _FOREIGN_WINDOW_SYSTEM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index c0348beb6a34..1fdfc02c3916 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,7 +49,7 @@ #include <X11/keysym.h> #include "FWS.hxx" #include <X11/extensions/shape.h> -#ifndef SOLARIS +#if !defined(SOLARIS) && !defined(AIX) #include <X11/extensions/dpms.h> #endif #include <tools/postx.h> @@ -71,6 +72,7 @@ #include "salinst.hxx" #include "sallayout.hxx" +#include <sal/macros.h> #include <com/sun/star/uno/Exception.hpp> #include <algorithm> @@ -181,7 +183,7 @@ void X11SalFrame::setXEmbedInfo() 32, PropModeReplace, reinterpret_cast<unsigned char*>(aInfo), - sizeof(aInfo)/sizeof(aInfo[0]) ); + SAL_N_ELEMENTS(aInfo) ); } } @@ -498,7 +500,7 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, int nScreen, SystemParentData* nAttrMask, &Attributes ); // FIXME: see above: fake shell window for now to own window - if( /*! IsSysChildWindow() &&*/ pParentData == NULL ) + if( pParentData == NULL ) { mhShellWindow = mhWindow; } @@ -542,11 +544,11 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, int nScreen, SystemParentData* a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_TAKE_FOCUS ); XSetWMProtocols( GetXDisplay(), GetShellWindow(), a, n ); - XClassHint* pClass = XAllocClassHint(); - pClass->res_name = const_cast<char*>(X11SalData::getFrameResName()); - pClass->res_class = const_cast<char*>(X11SalData::getFrameClassName()); - XSetClassHint( GetXDisplay(), GetShellWindow(), pClass ); - XFree( pClass ); + // force wm class hint + mnExtStyle = ~0; + if (mpParent) + m_sWMClass = mpParent->m_sWMClass; + SetExtendedFrameStyle( 0 ); XSizeHints* pHints = XAllocSizeHints(); pHints->flags = PWinGravity | PPosition; @@ -679,7 +681,6 @@ X11SalFrame::X11SalFrame( SalFrame *pParent, sal_uLong nSalFrameStyle, SystemPar nKeyCode_ = 0; nKeyState_ = 0; nCompose_ = -1; - mbKeyMenu = false; mbSendExtKeyModChange = false; mnExtKeyMod = 0; @@ -849,13 +850,7 @@ void X11SalFrame::SetExtendedFrameStyle( SalExtStyle nStyle ) if( nStyle != mnExtStyle && ! IsChildWindow() ) { mnExtStyle = nStyle; - - XClassHint* pClass = XAllocClassHint(); - rtl::OString aResHint = X11SalData::getFrameResName( mnExtStyle ); - pClass->res_name = const_cast<char*>(aResHint.getStr()); - pClass->res_class = const_cast<char*>(X11SalData::getFrameClassName()); - XSetClassHint( GetXDisplay(), GetShellWindow(), pClass ); - XFree( pClass ); + updateWMClass(); } } @@ -1158,8 +1153,6 @@ void X11SalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) setXEmbedInfo(); if( bVisible ) { - SessionManagerClient::open(); // will simply return after the first time - mbInShow = sal_True; if( ! (nStyle_ & SAL_FRAME_STYLE_INTRO) ) { @@ -1182,7 +1175,6 @@ void X11SalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) GetDisplay()->getWMAdaptor()->frameIsMapping( this ); /* - * #95097# * Actually this is rather exotic and currently happens only in conjunction * with the basic dialogue editor, * which shows a frame and instantly hides it again. After that the @@ -1267,7 +1259,6 @@ void X11SalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) if( IsFloatGrabWindow() ) { /* - * #95453# * Sawfish and twm can be switched to enter-exit focus behaviour. In this case * we must grab the pointer else the dumb WM will put the focus to the * override-redirect float window. The application window will be deactivated @@ -1318,7 +1309,7 @@ void X11SalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) nShowState_ = SHOWSTATE_NORMAL; /* - * #98107# plugged windows don't necessarily get the + * plugged windows don't necessarily get the * focus on show because the parent may already be mapped * and have the focus. So try to set the focus * to the child on Show(sal_True) @@ -2192,6 +2183,33 @@ void X11SalFrame::SetScreenNumber( unsigned int nNewScreen ) } } +void X11SalFrame::SetApplicationID( const rtl::OUString &rWMClass ) +{ + if( rWMClass != m_sWMClass && ! IsChildWindow() ) + { + m_sWMClass = rWMClass; + updateWMClass(); + std::list< X11SalFrame* >::const_iterator it; + for( it = maChildren.begin(); it != maChildren.end(); ++it ) + (*it)->SetApplicationID(rWMClass); + } +} + +void X11SalFrame::updateWMClass() +{ + XClassHint* pClass = XAllocClassHint(); + rtl::OString aResName = X11SalData::getFrameResName( mnExtStyle ); + pClass->res_name = const_cast<char*>(aResName.getStr()); + + rtl::OString aResClass = rtl::OUStringToOString(m_sWMClass, RTL_TEXTENCODING_ASCII_US); + const char *pResClass = aResClass.getLength() ? aResClass.getStr() : X11SalData::getFrameClassName(); + + pClass->res_class = const_cast<char*>(pResClass); + XSetClassHint( GetXDisplay(), GetShellWindow(), pClass ); + XFree( pClass ); +} + + // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void X11SalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) @@ -2362,7 +2380,7 @@ void X11SalFrame::StartPresentation( sal_Bool bStart ) // needs static here to save DPMS settings int dummy; static bool DPMSExtensionAvailable = -#ifndef SOLARIS +#if !defined(SOLARIS) && !defined(AIX) (DPMSQueryExtension(GetXDisplay(), &dummy, &dummy) != 0); static sal_Bool DPMSEnabled = false; #else @@ -2397,7 +2415,7 @@ void X11SalFrame::StartPresentation( sal_Bool bStart ) // get the DPMS state right before the start if (DPMSExtensionAvailable) { -#ifndef SOLARIS +#if !defined(SOLARIS) && !defined(AIX) CARD16 state; // card16 is defined in Xdm.h DPMSInfo( GetXDisplay(), &state, @@ -2416,7 +2434,7 @@ void X11SalFrame::StartPresentation( sal_Bool bStart ) prefer_blanking, allow_exposures ); } -#ifndef SOLARIS +#if !defined(SOLARIS) && !defined(AIX) if( DPMSEnabled ) { if ( DPMSExtensionAvailable ) @@ -2430,7 +2448,7 @@ void X11SalFrame::StartPresentation( sal_Bool bStart ) } #endif } - else // if( !bStart ) // end of show + else { if( nScreenSaversTimeout_ ) { @@ -2441,7 +2459,7 @@ void X11SalFrame::StartPresentation( sal_Bool bStart ) allow_exposures ); nScreenSaversTimeout_ = 0; } -#ifndef SOLARIS +#if !defined(SOLARIS) && !defined(AIX) if ( DPMSEnabled ) { if ( DPMSExtensionAvailable ) @@ -2472,7 +2490,7 @@ void X11SalFrame::SetPointer( PointerStyle ePointerStyle ) void X11SalFrame::SetPointerPos(long nX, long nY) { - /* #87921# when the application tries to center the mouse in the dialog the + /* when the application tries to center the mouse in the dialog the * window isn't mapped already. So use coordinates relative to the root window. */ unsigned int nWindowLeft = maGeometry.nX + nX; @@ -2851,6 +2869,18 @@ SalFrame::SalPointerState X11SalFrame::GetPointerState() return aState; } +SalFrame::SalIndicatorState X11SalFrame::GetIndicatorState() +{ + SalIndicatorState aState; + aState.mnState = GetX11SalData()->GetDisplay()->GetIndicatorState(); + return aState; +} + +void X11SalFrame::SimulateKeyPress( sal_uInt16 nKeyCode ) +{ + GetX11SalData()->GetDisplay()->SimulateKeyPress(nKeyCode); +} + long X11SalFrame::HandleMouseEvent( XEvent *pEvent ) { SalMouseEvent aMouseEvt; @@ -2898,8 +2928,6 @@ long X11SalFrame::HandleMouseEvent( XEvent *pEvent ) if( LeaveNotify == pEvent->type || EnterNotify == pEvent->type ) { /* - * #89075# #89335# - * * some WMs (and/or) applications have a passive grab on * mouse buttons (XGrabButton). This leads to enter/leave notifies * with mouse buttons pressed in the state mask before the actual @@ -2908,7 +2936,6 @@ long X11SalFrame::HandleMouseEvent( XEvent *pEvent ) * decides that a pressed button in a MouseMove belongs to * a drag operation which leads to doing things differently. * - * #95901# * ignore Enter/LeaveNotify resulting from grabs so that * help windows do not disappear just after appearing * @@ -3365,29 +3392,10 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) int nRet = CallCallback( SALEVENT_KEYMODCHANGE, &aModEvt ); - // emulate KEY_MENU - if ( ( (nKeySym == XK_Alt_L) || (nKeySym == XK_Alt_R) ) && - ( (nModCode & ~(KEY_MOD3|KEY_MOD2)) == 0 ) ) - { - if( pEvent->type == XLIB_KeyPress ) - mbKeyMenu = true; - else if( mbKeyMenu ) - { - // simulate KEY_MENU - aKeyEvt.mnCode = KEY_MENU | nModCode; - aKeyEvt.mnRepeat = 0; - aKeyEvt.mnTime = pEvent->time; - aKeyEvt.mnCharCode = 0; - nRet = CallCallback( SALEVENT_KEYINPUT, &aKeyEvt ); - nRet = CallCallback( SALEVENT_KEYUP, &aKeyEvt ); - } - } - else - mbKeyMenu = false; return nRet; } - mbSendExtKeyModChange = mbKeyMenu = false; + mbSendExtKeyModChange = false; // try to figure out the vcl code for the keysym // #i52338# use the unmodified KeySym if there is none for the real KeySym @@ -3551,17 +3559,17 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent ) { - // #107739# ReflectionX in Windows mode changes focus while mouse is grabbed + // ReflectionX in Windows mode changes focus while mouse is grabbed if( nVisibleFloats > 0 && GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii( "ReflectionX Windows" ) ) return 1; - /* #55691# ignore focusout resulting from keyboard grabs + /* ignore focusout resulting from keyboard grabs * we do not grab it and are not interested when * someone else does CDE e.g. does a XGrabKey on arrow keys - * #73179# handle focus events with mode NotifyWhileGrabbed + * handle focus events with mode NotifyWhileGrabbed * because with CDE alt-tab focus changing we do not get * normal focus events - * #71791# cast focus event to the input context, otherwise the + * cast focus event to the input context, otherwise the * status window does not follow the application frame */ @@ -3590,7 +3598,7 @@ long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent ) if( FocusIn == pEvent->type ) { - vcl_sal::PrinterUpdate::update(); + GetSalData()->m_pInstance->updatePrinterUpdate(); mbInputFocus = True; ImplSVData* pSVData = ImplGetSVData(); @@ -3609,7 +3617,7 @@ long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent ) else { mbInputFocus = False; - mbSendExtKeyModChange = mbKeyMenu = false; + mbSendExtKeyModChange = false; mnExtKeyMod = 0; return CallCallback( SALEVENT_LOSEFOCUS, 0 ); } @@ -3725,9 +3733,37 @@ void X11SalFrame::RestackChildren() } } +static Bool size_event_predicate( Display*, XEvent* event, XPointer arg ) +{ + if( event->type != ConfigureNotify ) + return False; + X11SalFrame* frame = reinterpret_cast< X11SalFrame* >( arg ); + XConfigureEvent* pEvent = &event->xconfigure; + if( pEvent->window != frame->GetShellWindow() + && pEvent->window != frame->GetWindow() + && pEvent->window != frame->GetForeignParent() + && pEvent->window != frame->GetStackingWindow()) + { // ignored at top of HandleSizeEvent() + return False; + } + if( pEvent->window == frame->GetStackingWindow()) + return False; // filtered later in HandleSizeEvent() + // at this point we know that there is another similar event in the queue + frame->setPendingSizeEvent(); + return False; // but do not process the new event out of order +} + +void X11SalFrame::setPendingSizeEvent() +{ + mPendingSizeEvent = true; +} + // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= long X11SalFrame::HandleSizeEvent( XConfigureEvent *pEvent ) { + // NOTE: if you add more tests in this function, make sure to update size_event_predicate() + // so that it finds exactly the same events + if ( pEvent->window != GetShellWindow() && pEvent->window != GetWindow() && pEvent->window != GetForeignParent() @@ -3775,6 +3811,16 @@ long X11SalFrame::HandleSizeEvent( XConfigureEvent *pEvent ) if( SHOWSTATE_UNKNOWN == nShowState_ && bMapped_ ) nShowState_ = SHOWSTATE_NORMAL; + // Avoid a race condition where resizing this window to one size and shortly after that + // to another size generates first size event with the old size and only after that + // with the new size, temporarily making us think the old size is valid (bnc#674806). + // So if there is another size event for this window pending, ignore this one. + mPendingSizeEvent = false; + XEvent dummy; + XCheckIfEvent( GetXDisplay(), &dummy, size_event_predicate, reinterpret_cast< XPointer >( this )); + if( mPendingSizeEvent ) + return 1; + nWidth_ = pEvent->width; nHeight_ = pEvent->height; @@ -3824,7 +3870,7 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) GetDisplay()->GetXLib()->PushXErrorLevel( true ); /* - * #89186# don't rely on the new parent from the event. + * don't rely on the new parent from the event. * the event may be "out of date", that is the window manager * window may not exist anymore. This can happen if someone * shows a frame and hides it again quickly (not that that would @@ -3840,12 +3886,12 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) &hDummy, &Children, &nChildren ); - if( GetDisplay()->GetXLib()->HasXErrorOccured() ) + if( GetDisplay()->GetXLib()->HasXErrorOccurred() ) { hWM_Parent = GetShellWindow(); break; } - /* #107048# this sometimes happens if a Show(sal_True) is + /* this sometimes happens if a Show(sal_True) is * immediately followed by Show(sal_False) (which is braindead anyway) */ if( hDummy == hWM_Parent ) @@ -3930,7 +3976,7 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) * so need real geometries here * (this will fail with virtual roots ?) */ - GetDisplay()->GetXLib()->ResetXErrorOccured(); + GetDisplay()->GetXLib()->ResetXErrorOccurred(); int xp, yp, x, y; unsigned int wp, w, hp, h, bw, d; XGetGeometry( GetXDisplay(), @@ -3942,7 +3988,7 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) &hRoot, &xp, &yp, &wp, &hp, &bw, &d ); bool bResized = false; - if( ! GetDisplay()->GetXLib()->HasXErrorOccured() ) + if( ! GetDisplay()->GetXLib()->HasXErrorOccurred() ) { maGeometry.nRightDecoration = wp - w - maGeometry.nLeftDecoration; maGeometry.nBottomDecoration = hp - h - maGeometry.nTopDecoration; @@ -4083,10 +4129,10 @@ long X11SalFrame::HandleClientMessage( XClientMessageEvent *pEvent ) { if( this == s_pSaveYourselfFrame ) { - ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() ); + rtl::OString aExec(rtl::OUStringToOString(SessionManagerClient::getExecName(), osl_getThreadTextEncoding())); const char* argv[2]; argv[0] = "/bin/sh"; - argv[1] = const_cast<char*>(aExec.GetBuffer()); + argv[1] = const_cast<char*>(aExec.getStr()); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] ); #endif @@ -4131,10 +4177,10 @@ void X11SalFrame::SaveYourselfDone( SalFrame* pSaveFrame ) // session save was done, inform dtwm if( s_pSaveYourselfFrame && pSaveFrame ) { - ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() ); + rtl::OString aExec(rtl::OUStringToOString(SessionManagerClient::getExecName(), osl_getThreadTextEncoding())); const char* argv[2]; argv[0] = "/bin/sh"; - argv[1] = const_cast<char*>(aExec.GetBuffer()); + argv[1] = const_cast<char*>(aExec.getStr()); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] ); #endif @@ -4222,7 +4268,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent ) break; case ButtonPress: - // #74406# if we loose the focus in presentation mode + // if we loose the focus in presentation mode // there are good chances that we never get it back // since the WM ignores us if( IsOverrideRedirect() ) @@ -4254,7 +4300,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent ) if( nShowState_ == SHOWSTATE_HIDDEN ) { /* - * #95097# workaround for (at least) KWin 2.2.2 + * workaround for (at least) KWin 2.2.2 * which will map windows that were once transient * even if they are withdrawn when the respective * document is mapped. @@ -4293,12 +4339,12 @@ long X11SalFrame::Dispatch( XEvent *pEvent ) } bool bSetFocus = m_bSetFocusOnMap; - /* #99570# another workaround for sawfish: if a transient window for the same parent is shown + /* another workaround for sawfish: if a transient window for the same parent is shown * sawfish does not set the focus to it. Applies only for click to focus mode. */ if( ! (nStyle_ & SAL_FRAME_STYLE_FLOAT ) && mbInShow && GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii( "Sawfish" ) ) { - // #101775# don't set the focus into the IME status window + // don't set the focus into the IME status window // since this will lead to a parent loose-focus, close status, // reget focus, open status, .... flicker loop if ( (I18NStatus::get().getStatusFrame() != this) ) @@ -4518,3 +4564,4 @@ void X11SalFrame::EndSetClipRegion() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx index 49225e2c99ce..0164d27ba185 100644 --- a/vcl/unx/generic/window/salobj.cxx +++ b/vcl/unx/generic/window/salobj.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -151,7 +152,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p pVisual, CWEventMask|CWColormap, &aAttribs ); XSync( pDisp, False ); - sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccured(); + sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccurred(); pSalDisp->GetXLib()->PopXErrorLevel(); if( bWasXError ) { @@ -178,7 +179,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p pObjData->pAppContext = NULL; XSync(pDisp, False); - sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccured(); + sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccurred(); pSalDisp->GetXLib()->PopXErrorLevel(); if( bWasXError ) { @@ -565,3 +566,4 @@ void X11SalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) { } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkaction.cxx b/vcl/unx/gtk/a11y/atkaction.cxx index 4329dd345d14..39c51cb3b274 100644 --- a/vcl/unx/gtk/a11y/atkaction.cxx +++ b/vcl/unx/gtk/a11y/atkaction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -276,3 +277,5 @@ actionIfaceInit (AtkActionIface *iface) iface->get_localized_name = action_wrapper_get_localized_name; iface->set_description = action_wrapper_set_description; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx index 71c05bd16626..da667fe75326 100644 --- a/vcl/unx/gtk/a11y/atkbridge.cxx +++ b/vcl/unx/gtk/a11y/atkbridge.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,3 +77,4 @@ void DeInitAtkBridge() restore_gail_window_vtable(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkcomponent.cxx b/vcl/unx/gtk/a11y/atkcomponent.cxx index 24cf335ebeb0..37ef152db3c9 100644 --- a/vcl/unx/gtk/a11y/atkcomponent.cxx +++ b/vcl/unx/gtk/a11y/atkcomponent.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -380,3 +381,5 @@ componentIfaceInit (AtkComponentIface *iface) iface->set_position = component_wrapper_set_position; iface->set_size = component_wrapper_set_size; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkeditabletext.cxx b/vcl/unx/gtk/a11y/atkeditabletext.cxx index c0399145b07c..a330bc66e8ce 100644 --- a/vcl/unx/gtk/a11y/atkeditabletext.cxx +++ b/vcl/unx/gtk/a11y/atkeditabletext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,9 +35,6 @@ #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> #include <com/sun/star/accessibility/TextSegment.hpp> -// #include <functional> -// #include <hash_map> - #include <stdio.h> #include <string.h> @@ -200,3 +198,5 @@ editableTextIfaceInit (AtkEditableTextIface *iface) iface->paste_text = editable_text_wrapper_paste_text; iface->set_run_attributes = editable_text_wrapper_set_run_attributes; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkfactory.cxx b/vcl/unx/gtk/a11y/atkfactory.cxx index 9588123f4032..fef6c80767e5 100644 --- a/vcl/unx/gtk/a11y/atkfactory.cxx +++ b/vcl/unx/gtk/a11y/atkfactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -181,3 +182,4 @@ wrapper_factory_get_type (void) } // extern C +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkfactory.hxx b/vcl/unx/gtk/a11y/atkfactory.hxx index 82be08cfad1b..acb7b026f3a8 100644 --- a/vcl/unx/gtk/a11y/atkfactory.hxx +++ b/vcl/unx/gtk/a11y/atkfactory.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,5 @@ GType wrapper_factory_get_type (void); } // extern "C" #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkhypertext.cxx b/vcl/unx/gtk/a11y/atkhypertext.cxx index 90d735890655..b2c7aca857f4 100644 --- a/vcl/unx/gtk/a11y/atkhypertext.cxx +++ b/vcl/unx/gtk/a11y/atkhypertext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -289,3 +290,5 @@ hypertextIfaceInit (AtkHypertextIface *iface) iface->get_n_links = hypertext_get_n_links; iface->get_link_index = hypertext_get_link_index; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkimage.cxx b/vcl/unx/gtk/a11y/atkimage.cxx index b48c59555a29..04263fd72906 100644 --- a/vcl/unx/gtk/a11y/atkimage.cxx +++ b/vcl/unx/gtk/a11y/atkimage.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -136,3 +137,5 @@ imageIfaceInit (AtkImageIface *iface) iface->get_image_position = image_get_image_position; iface->get_image_size = image_get_image_size; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx index e02478ac8ad8..05d4cc279130 100644 --- a/vcl/unx/gtk/a11y/atklistener.cxx +++ b/vcl/unx/gtk/a11y/atklistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +29,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#ifdef AIX +#define _LINUX_SOURCE_COMPAT +#include <sys/timer.h> +#undef _LINUX_SOURCE_COMPAT +#endif + #include <com/sun/star/accessibility/TextSegment.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -357,7 +364,7 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven break; } - // --> OD 2009-05-26 #i92103# + // #i92103# case accessibility::AccessibleEventId::LISTBOX_ENTRY_EXPANDED: { AtkObject *pChild = getObjFromAny( aEvent.NewValue ); @@ -381,7 +388,6 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven } break; } - // <-- // AtkAction signals ... case accessibility::AccessibleEventId::ACTION_CHANGED: @@ -535,3 +541,5 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven break; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atklistener.hxx b/vcl/unx/gtk/a11y/atklistener.hxx index d2889caa3e24..dbac3599cd4b 100644 --- a/vcl/unx/gtk/a11y/atklistener.hxx +++ b/vcl/unx/gtk/a11y/atklistener.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -77,3 +78,4 @@ private: #endif /* _ATK_LISTENER_HXX_ */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkregistry.cxx b/vcl/unx/gtk/a11y/atkregistry.cxx index 81ec22dc4ce1..396683e5fd8c 100644 --- a/vcl/unx/gtk/a11y/atkregistry.cxx +++ b/vcl/unx/gtk/a11y/atkregistry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -69,3 +70,4 @@ ooo_wrapper_registry_remove(XAccessible *pAccessible) g_hash_table_remove( uno_to_gobject, (gpointer) pAccessible ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkregistry.hxx b/vcl/unx/gtk/a11y/atkregistry.hxx index f4de3b2e4c1e..b3a59b6db8d0 100644 --- a/vcl/unx/gtk/a11y/atkregistry.hxx +++ b/vcl/unx/gtk/a11y/atkregistry.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,3 +39,5 @@ void ooo_wrapper_registry_add(const ::com::sun::star::uno::Reference< ::com::sun void ooo_wrapper_registry_remove(::com::sun::star::accessibility::XAccessible *pAccessible); #endif // __ATK_REGISTRY_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkselection.cxx b/vcl/unx/gtk/a11y/atkselection.cxx index 172faac4c704..127730f0a458 100644 --- a/vcl/unx/gtk/a11y/atkselection.cxx +++ b/vcl/unx/gtk/a11y/atkselection.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -193,3 +194,5 @@ selectionIfaceInit( AtkSelectionIface *iface) iface->remove_selection = selection_remove_selection; iface->select_all_selection = selection_select_all_selection; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atktable.cxx b/vcl/unx/gtk/a11y/atktable.cxx index 78571ff11c34..dec06cd7005b 100644 --- a/vcl/unx/gtk/a11y/atktable.cxx +++ b/vcl/unx/gtk/a11y/atktable.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -446,8 +447,6 @@ table_wrapper_get_summary( AtkTable *table ) if( pTable ) { - // FIXME: Summary ?? -// AtkObject* summary; return atk_object_wrapper_conditional_ref( pTable->getAccessibleSummary() ); } } @@ -719,3 +718,5 @@ tableIfaceInit (AtkTableIface *iface) iface->get_column_description = table_wrapper_get_column_description; iface->set_column_description = table_wrapper_set_column_description; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx index e6d3276891de..1b21fa66837c 100644 --- a/vcl/unx/gtk/a11y/atktext.cxx +++ b/vcl/unx/gtk/a11y/atktext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -454,7 +455,7 @@ text_wrapper_set_caret_offset (AtkText *text, return FALSE; } -// --> OD 2010-03-04 #i92232# +// #i92232# AtkAttributeSet* handle_text_markup_as_run_attribute( accessibility::XAccessibleTextMarkup* pTextMarkup, const gint nTextMarkupType, @@ -530,7 +531,6 @@ handle_text_markup_as_run_attribute( accessibility::XAccessibleTextMarkup* pText return pSet; } -// <-- static AtkAttributeSet * text_wrapper_get_run_attributes( AtkText *text, @@ -551,26 +551,22 @@ text_wrapper_get_run_attributes( AtkText *text, pTextAttributes->getRunAttributes( offset, uno::Sequence< rtl::OUString > () ); pSet = attribute_set_new_from_property_values( aAttributeList, true, text ); - // --> OD 2009-06-22 #i100938# + // #i100938# // - always provide start_offset and end_offset -// if( pSet ) - // <-- { accessibility::TextSegment aTextSegment = pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN); *start_offset = aTextSegment.SegmentStart; - // --> OD 2009-06-22 #i100938# + // #i100938# // Do _not_ increment the end_offset provide by <accessibility::TextSegment> instance -// *end_offset = aTextSegment.SegmentEnd + 1; // FIXME: TESTME *end_offset = aTextSegment.SegmentEnd; - // <-- bOffsetsAreValid = true; } } // Special handling for misspelled text - // --> OD 2010-03-01 #i92232# + // #i92232# // - add special handling for tracked changes and refactor the // corresponding code for handling misspelled text. accessibility::XAccessibleTextMarkup* pTextMarkup = getTextMarkup( text ); @@ -603,7 +599,6 @@ text_wrapper_get_run_attributes( AtkText *text, com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE, offset, pSet, start_offset, end_offset ); } - // <-- } catch(const uno::Exception& e){ @@ -874,3 +869,5 @@ textIfaceInit (AtkTextIface *iface) iface->get_character_extents = text_wrapper_get_character_extents; iface->get_offset_at_point = text_wrapper_get_offset_at_point; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index 04498810597f..359d2f0cc62c 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -74,12 +75,10 @@ static AtkTextAttribute atk_text_attribute_tab_stops = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_writing_mode = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_vertical_align = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_misspelled = ATK_TEXT_ATTR_INVALID; -// --> OD 2010-03-01 #i92232# +// #i92232# static AtkTextAttribute atk_text_attribute_tracked_change = ATK_TEXT_ATTR_INVALID; -// <-- -// --> OD 2010-03-05 #i92233# +// #i92233# static AtkTextAttribute atk_text_attribute_mm_to_pixel_ratio = ATK_TEXT_ATTR_INVALID; -// <-- /*****************************************************************************/ @@ -109,9 +108,8 @@ enum ExportedAttribute TEXT_ATTRIBUTE_STRIKETHROUGH, TEXT_ATTRIBUTE_UNDERLINE, TEXT_ATTRIBUTE_WEIGHT, - // --> OD 2010-03-05 #i92233# + // #i92233# TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO, - // <-- TEXT_ATTRIBUTE_JUSTIFICATION, TEXT_ATTRIBUTE_BOTTOM_MARGIN, TEXT_ATTRIBUTE_FIRST_LINE_INDENT, @@ -146,9 +144,8 @@ static const char * ExportedTextAttributes[TEXT_ATTRIBUTE_LAST] = "CharStrikeout", // TEXT_ATTRIBUTE_STRIKETHROUGH "CharUnderline", // TEXT_ATTRIBUTE_UNDERLINE "CharWeight", // TEXT_ATTRIBUTE_WEIGHT - // --> OD 2010-03-05 #i92233# + // #i92233# "MMToPixelRatio", // TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO - // <-- "ParaAdjust", // TEXT_ATTRIBUTE_JUSTIFICATION "ParaBottomMargin", // TEXT_ATTRIBUTE_BOTTOM_MARGIN "ParaFirstLineIndent", // TEXT_ATTRIBUTE_FIRST_LINE_INDENT @@ -176,7 +173,6 @@ get_value( const uno::Sequence< beans::PropertyValue >& rAttributeList, #define get_bool_value( list, index ) get_value( list, index, Bool2String ) #define get_short_value( list, index ) get_value( list, index, Short2String ) -//#define get_long_value( list, index ) get_value( list, index, Long2String ) pb: not used (warning on linux) #define get_height_value( list, index ) get_value( list, index, Float2String ) #define get_justification_value( list, index ) get_value( list, index, Adjust2Justification ) #define get_cmm_value( list, index ) get_value( list, index, CMM2UnitString ) @@ -189,36 +185,6 @@ get_value( const uno::Sequence< beans::PropertyValue >& rAttributeList, #define get_weight_value( list, index ) get_value( list, index, Weight2String ) #define get_language_string( list, index ) get_value( list, index, Locale2String ) -/* -static gchar* -dump_value( const uno::Sequence< beans::PropertyValue >& rAttributeList, sal_Int32 nIndex ) -{ - if( nIndex != -1 ) - { - rtl::OString aName = rtl::OUStringToOString(rAttributeList[nIndex].Name, RTL_TEXTENCODING_UTF8); - - if( rAttributeList[nIndex].Value.has<sal_Int16> () ) - OSL_TRACE( "%s = %d (short value)", aName.getStr(), - rAttributeList[nIndex].Value.get<sal_Int16> () ); - - else if( rAttributeList[nIndex].Value.has<sal_Int8> () ) - OSL_TRACE( "%s = %d (byte value)", aName.getStr(), - rAttributeList[nIndex].Value.get<sal_Int8> () ); - - else if( rAttributeList[nIndex].Value.has<sal_Bool> () ) - OSL_TRACE( "%s = %s (bool value)", aName.getStr(), - rAttributeList[nIndex].Value.get<sal_Bool> () ? "true" : "false" ); - - else if( rAttributeList[nIndex].Value.has<rtl::OUString> () ) - OSL_TRACE( "%s = %s", aName.getStr(), - rtl::OUStringToOString(rAttributeList[nIndex].Value.get<rtl::OUString> (), - RTL_TEXTENCODING_UTF8).getStr() ); - } - - return NULL; -} -*/ - static inline double toPoint(sal_Int16 n) { @@ -229,14 +195,6 @@ double toPoint(sal_Int16 n) /*****************************************************************************/ -/* -static gchar* -NullString(const uno::Any&) -{ - return NULL; -} -*/ - static bool InvalidValue( uno::Any&, const gchar * ) { @@ -265,48 +223,6 @@ String2Float( uno::Any& rAny, const gchar * value ) /*****************************************************************************/ -/* -static gchar* -Short2String(const uno::Any& rAny) -{ - return g_strdup_printf( "%d", rAny.get<sal_Int16>() ); -} - -static bool -String2Short( uno::Any& rAny, const gchar * value ) -{ - sal_Int32 lval; - - if( 1 != sscanf( value, "%d", &lval ) ) - return false; - - rAny = uno::makeAny( (sal_Int16) lval ); - return true; -} -*/ - -/*****************************************************************************/ -/* pb: not used (warning on linux) -static gchar* -Long2String(const uno::Any& rAny) -{ - return g_strdup_printf( "%ld", rAny.get<sal_Int32>() ); -} - -static bool -String2Long( uno::Any& rAny, const gchar * value ) -{ - sal_Int32 lval; - - if( 1 != sscanf( value, "%ld", &lval ) ) - return false; - - rAny = uno::makeAny( lval ); - return true; -} -*/ -/*****************************************************************************/ - static accessibility::XAccessibleComponent* getComponent( AtkText *pText ) throw (uno::RuntimeException) { @@ -1092,7 +1008,7 @@ TabStopList2String( const uno::Any& rAny, bool default_tabs ) if( ret ) { gchar * old_tab_str = ret; - ret = g_strconcat(old_tab_str, " ", tab_str, NULL /* terminated */); + ret = g_strconcat(old_tab_str, " ", tab_str, (const char*)NULL); g_free( old_tab_str ); } else @@ -1305,13 +1221,12 @@ attribute_set_new_from_property_values( attribute_set = attribute_set_prepend(attribute_set, atk_text_attribute_tab_stops, get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_TAB_STOPS], TabStops2String)); - // --> OD 2010-03-05 #i92233# + // #i92233# if( ATK_TEXT_ATTR_INVALID == atk_text_attribute_mm_to_pixel_ratio ) atk_text_attribute_mm_to_pixel_ratio = atk_text_attribute_register("mm-to-pixel-ratio"); attribute_set = attribute_set_prepend( attribute_set, atk_text_attribute_mm_to_pixel_ratio, get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO], Float2String)); - // <-- return attribute_set; } @@ -1328,7 +1243,7 @@ AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_se return attribute_set; } -// --> OD 2010-03-01 #i92232# +// #i92232# AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set ) { if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change ) @@ -1370,7 +1285,6 @@ AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttribute return attribute_set; } -// <-- /*****************************************************************************/ @@ -1454,3 +1368,4 @@ attribute_set_map_to_property_values( return true; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atktextattributes.hxx b/vcl/unx/gtk/a11y/atktextattributes.hxx index 9c7628bf927e..1366fb861955 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.hxx +++ b/vcl/unx/gtk/a11y/atktextattributes.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,10 +46,11 @@ attribute_set_map_to_property_values( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rValueList ); AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_set ); -// --> OD 2010-03-01 #i92232# +// #i92232# AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set ); AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set ); AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set ); -// <-- #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index d3c1afdd2efe..78e0cb05d4de 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,16 +29,20 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#ifdef AIX +#define _LINUX_SOURCE_COMPAT +#include <sys/timer.h> +#undef _LINUX_SOURCE_COMPAT +#endif + #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> #include <com/sun/star/accessibility/XAccessibleSelection.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> -// --> OD 2009-04-14 #i93269# #include <com/sun/star/accessibility/XAccessibleText.hpp> -// <-- #include <cppuhelper/implbase1.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <rtl/ref.hxx> #include <vcl/svapp.hxx> @@ -60,7 +65,14 @@ using namespace ::com::sun::star; -static uno::WeakReference< accessibility::XAccessible > xNextFocusObject; +namespace +{ + struct theNextFocusObject : + public rtl::Static< uno::WeakReference< accessibility::XAccessible >, theNextFocusObject> + { + }; +} + static guint focus_notify_handler = 0; /*****************************************************************************/ @@ -70,11 +82,11 @@ extern "C" { static gint atk_wrapper_focus_idle_handler (gpointer data) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; focus_notify_handler = 0; - uno::Reference< accessibility::XAccessible > xAccessible = xNextFocusObject; + uno::Reference< accessibility::XAccessible > xAccessible = theNextFocusObject::get(); if( xAccessible.get() == reinterpret_cast < accessibility::XAccessible * > (data) ) { AtkObject *atk_obj = xAccessible.is() ? atk_object_wrapper_ref( xAccessible ) : NULL; @@ -85,7 +97,7 @@ atk_wrapper_focus_idle_handler (gpointer data) fprintf(stderr, "notifying focus event for %p\n", atk_obj); #endif atk_focus_tracker_notify(atk_obj); - // --> OD 2009-04-14 #i93269# + // #i93269# // emit text_caret_moved event for <XAccessibleText> object, // if cursor is inside the <XAccessibleText> object. // also emit state-changed:focused event under the same condition. @@ -112,7 +124,6 @@ atk_wrapper_focus_idle_handler (gpointer data) } } } - // <-- g_object_unref(atk_obj); } } @@ -130,7 +141,7 @@ atk_wrapper_focus_tracker_notify_when_idle( const uno::Reference< accessibility: if( focus_notify_handler ) g_source_remove(focus_notify_handler); - xNextFocusObject = xAccessible; + theNextFocusObject::get() = xAccessible; focus_notify_handler = g_idle_add (atk_wrapper_focus_idle_handler, xAccessible.get()); } @@ -189,16 +200,12 @@ public: void DocumentFocusListener::disposing( const lang::EventObject& aEvent ) throw (uno::RuntimeException) { -// fprintf(stderr, "In DocumentFocusListener::disposing (%p)\n", this); -// fprintf(stderr, "m_aRefList has %d entries\n", m_aRefList.size()); // Unref the object here, but do not remove as listener since the object // might no longer be in a state that safely allows this. if( aEvent.Source.is() ) m_aRefList.erase(aEvent.Source); -// fprintf(stderr, "m_aRefList has %d entries\n", m_aRefList.size()); - } /*****************************************************************************/ @@ -235,12 +242,6 @@ void DocumentFocusListener::notifyEvent( const accessibility::AccessibleEventObj break; case accessibility::AccessibleEventId::INVALIDATE_ALL_CHILDREN: -/* { - uno::Reference< accessibility::XAccessible > xAccessible( getAccessible(aEvent) ); - detachRecursive(xAccessible); - attachRecursive(xAccessible); - } -*/ g_warning( "Invalidate all children called\n" ); break; default: @@ -497,27 +498,6 @@ static void handle_toolbox_buttonchange(VclWindowEvent const *pEvent) } } -/*****************************************************************************/ - -/* currently not needed anymore... -static void create_wrapper_for_children(Window *pWindow) -{ - if( pWindow && pWindow->IsReallyVisible() ) - { - uno::Reference< accessibility::XAccessible > xAccessible(pWindow->GetAccessible()); - if( xAccessible.is() ) - { - uno::Reference< accessibility::XAccessibleContext > xContext(xAccessible->getAccessibleContext()); - if( xContext.is() ) - { - sal_Int32 nChildren = xContext->getAccessibleChildCount(); - for( sal_Int32 i = 0; i < nChildren; ++i ) - create_wrapper_for_child(xContext, i); - } - } - } -} -*/ /*****************************************************************************/ @@ -623,46 +603,30 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent) long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent) { + try { switch (pEvent->GetId()) { case VCLEVENT_WINDOW_SHOW: -// fprintf(stderr, "got VCLEVENT_WINDOW_SHOW for %p\n", -// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); break; case VCLEVENT_WINDOW_HIDE: -// fprintf(stderr, "got VCLEVENT_WINDOW_HIDE for %p\n", -// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); break; case VCLEVENT_WINDOW_CLOSE: -// fprintf(stderr, "got VCLEVENT_WINDOW_CLOSE for %p\n", -// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); break; case VCLEVENT_WINDOW_GETFOCUS: handle_get_focus(static_cast< ::VclWindowEvent const * >(pEvent)); break; case VCLEVENT_WINDOW_LOSEFOCUS: -// fprintf(stderr, "got VCLEVENT_WINDOW_LOSEFOCUS for %p\n", -// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); break; case VCLEVENT_WINDOW_MINIMIZE: -// fprintf(stderr, "got VCLEVENT_WINDOW_MINIMIZE for %p\n", -// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); break; case VCLEVENT_WINDOW_NORMALIZE: -// fprintf(stderr, "got VCLEVENT_WINDOW_NORMALIZE for %p\n", -// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); break; case VCLEVENT_WINDOW_KEYINPUT: case VCLEVENT_WINDOW_KEYUP: case VCLEVENT_WINDOW_COMMAND: case VCLEVENT_WINDOW_MOUSEMOVE: break; - /* - fprintf(stderr, "got VCLEVENT_WINDOW_COMMAND (%d) for %p\n", - static_cast< ::CommandEvent const * > ( - static_cast< ::VclWindowEvent const * >(pEvent)->GetData())->GetCommand(), - static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); - */ + case VCLEVENT_MENU_HIGHLIGHT: if (const VclMenuEvent* pMenuEvent = dynamic_cast<const VclMenuEvent*>(pEvent)) { @@ -696,7 +660,7 @@ long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent) break; case VCLEVENT_COMBOBOX_SETTEXT: - // MT 2010/02: This looks quite strange to me. Stumbled over this when fixing #i104290#. + // This looks quite strange to me. Stumbled over this when fixing #i104290#. // This kicked in when leaving the combobox in the toolbar, after that the events worked. // I guess this was a try to work around missing combobox events, which didn't do the full job, and shouldn't be necessary anymore. // Fix for #i104290# was done in toolkit/source/awt/vclxaccessiblecomponent, FOCUSED state for compound controls in general. @@ -704,9 +668,12 @@ long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent) break; default: -// OSL_TRACE("got event %d \n", pEvent->GetId()); break; } + } catch(lang::IndexOutOfBoundsException) + { + g_warning("Focused object has invalid index in parent"); + } return 0; } @@ -780,13 +747,13 @@ ooo_atk_util_get_type (void) static const GTypeInfo typeInfo = { - type_query.class_size, + static_cast<guint16>(type_query.class_size), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ooo_atk_util_class_init, (GClassFinalizeFunc) NULL, NULL, - type_query.instance_size, + static_cast<guint16>(type_query.instance_size), 0, (GInstanceInitFunc) NULL, NULL @@ -799,3 +766,4 @@ ooo_atk_util_get_type (void) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkutil.hxx b/vcl/unx/gtk/a11y/atkutil.hxx index 8c8ddf59c65f..c996b955d8c1 100644 --- a/vcl/unx/gtk/a11y/atkutil.hxx +++ b/vcl/unx/gtk/a11y/atkutil.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,3 +36,5 @@ GType ooo_atk_util_get_type (void); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkvalue.cxx b/vcl/unx/gtk/a11y/atkvalue.cxx index 9b8e9743eb18..19e92cb9d3b1 100644 --- a/vcl/unx/gtk/a11y/atkvalue.cxx +++ b/vcl/unx/gtk/a11y/atkvalue.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -145,3 +146,5 @@ valueIfaceInit (AtkValueIface *iface) iface->get_minimum_value = value_wrapper_get_minimum_value; iface->set_current_value = value_wrapper_set_current_value; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx index b1e4bde84756..2cedf59eaea2 100644 --- a/vcl/unx/gtk/a11y/atkwindow.cxx +++ b/vcl/unx/gtk/a11y/atkwindow.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -295,13 +296,13 @@ ooo_window_wrapper_get_type (void) static const GTypeInfo typeInfo = { - type_query.class_size, + static_cast<guint16>(type_query.class_size), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ooo_window_wrapper_class_init, (GClassFinalizeFunc) NULL, NULL, - type_query.instance_size, + static_cast<guint16>(type_query.instance_size), 0, (GInstanceInitFunc) NULL, NULL @@ -329,3 +330,4 @@ void restore_gail_window_vtable (void) atk_class->initialize = window_real_initialize; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkwindow.hxx b/vcl/unx/gtk/a11y/atkwindow.hxx index 6a9862256999..d0bfe41e1601 100644 --- a/vcl/unx/gtk/a11y/atkwindow.hxx +++ b/vcl/unx/gtk/a11y/atkwindow.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,3 +37,5 @@ GType ooo_window_wrapper_get_type (void); void restore_gail_window_vtable (void); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 10f75309708d..7ccf07b57488 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -127,12 +128,7 @@ static AtkRelationType mapRelationType( sal_Int16 nRelation ) default: break; } -#if 0 - ATK_RELATION_NODE_CHILD_OF, - ATK_RELATION_EMBEDS, - ATK_RELATION_EMBEDDED_BY, - ATK_RELATION_POPUP_FOR, -#endif + return type; } @@ -317,7 +313,7 @@ static AtkRole mapToAtkRole( sal_Int16 nRole ) initialized = true; } - static const sal_Int32 nMapSize = sizeof(roleMap)/sizeof(sal_Int16); + static const sal_Int32 nMapSize = SAL_N_ELEMENTS(roleMap); if( 0 <= nRole && nMapSize > nRole ) role = roleMap[nRole]; @@ -401,7 +397,7 @@ wrapper_get_n_children( AtkObject *atk_obj ) n = obj->mpContext->getAccessibleChildCount(); } catch(const uno::Exception& e) { - OSL_ENSURE(0, "Exception in getAccessibleChildCount()" ); + OSL_FAIL("Exception in getAccessibleChildCount()" ); } } @@ -433,7 +429,7 @@ wrapper_ref_child( AtkObject *atk_obj, child = atk_object_wrapper_ref( xAccessible ); } catch(const uno::Exception& e) { - OSL_ENSURE(0, "Exception in getAccessibleChild"); + OSL_FAIL("Exception in getAccessibleChild"); } } @@ -512,62 +508,6 @@ wrapper_ref_relation_set( AtkObject *atk_obj ) return pSet; } -/*****************************************************************************/ - -#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 ) { @@ -784,8 +724,6 @@ ensureTypeFor( uno::XInterface *pAccessible ) aTypeName += aTypeTable[i].name; bTypes[i] = TRUE; } -// g_message( "Accessible %p has type '%s' (%d)", -// pAccessible, aTypeTable[i].name, bTypes[i] ); } GType nType = g_type_from_name( aTypeName ); @@ -951,3 +889,5 @@ void atk_object_wrapper_dispose(AtkObjectWrapper* wrapper) RELEASE( wrapper->mpTextAttributes ) RELEASE( wrapper->mpValue ) } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx index 4252c0404833..94a8b1981688 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.hxx +++ b/vcl/unx/gtk/a11y/atkwrapper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -123,3 +124,5 @@ OUStringToGChar(const rtl::OUString& rString ) #define OUStringToConstGChar( string ) rtl::OUStringToOString( string, RTL_TEXTENCODING_UTF8 ).getStr() #endif /* __ATK_WRAPPER_HXX__ */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index ffa61bc52c10..0a71ad01dab0 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,7 +42,7 @@ #include <limits.h> #include <errno.h> #include <poll.h> -#ifdef FREEBSD +#if defined(FREEBSD) || defined(NETBSD) #include <sys/types.h> #include <sys/time.h> #include <unistd.h> @@ -53,6 +54,7 @@ #include <osl/thread.h> #include <osl/process.h> +#include <osl/conditn.h> #include <tools/debug.hxx> #include "unx/i18n_im.hxx" #include "unx/i18n_xkb.hxx" @@ -62,12 +64,22 @@ #include <vcl/svapp.hxx> -using namespace rtl; using namespace vcl_sal; +using ::rtl::OUString; + /*************************************************************************** * class GtkDisplay * ***************************************************************************/ +extern "C" { +GdkFilterReturn call_filterGdkEvent( GdkXEvent* sys_event, + GdkEvent* event, + gpointer data ) +{ + GtkSalDisplay *pDisplay = (GtkSalDisplay *)data; + return pDisplay->filterGdkEvent( sys_event, event ); +} +} GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay ) : SalDisplay( gdk_x11_display_get_xdisplay( pDisplay ) ), @@ -78,10 +90,14 @@ GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay ) for(int i = 0; i < POINTER_COUNT; i++) m_aCursors[ i ] = NULL; Init (); + + gdk_window_add_filter( NULL, call_filterGdkEvent, this ); } GtkSalDisplay::~GtkSalDisplay() { + gdk_window_remove_filter( NULL, call_filterGdkEvent, this ); + if( !m_bStartupCompleted ) gdk_notify_startup_complete(); doDestruct(); @@ -104,17 +120,11 @@ void GtkSalDisplay::deregisterFrame( SalFrame* pFrame ) } extern "C" { -GdkFilterReturn call_filterGdkEvent( GdkXEvent* sys_event, - GdkEvent* event, - gpointer data ) -{ - return GtkSalDisplay::filterGdkEvent( sys_event, event, data ); -} void signalKeysChanged( GdkKeymap*, gpointer data ) { GtkSalDisplay* pDisp = (GtkSalDisplay*)data; - pDisp->GetKeyboardName(TRUE); + pDisp->GetKeyboardName(true); } void signalScreenSizeChanged( GdkScreen* pScreen, gpointer data ) @@ -132,13 +142,10 @@ void signalMonitorsChanged( GdkScreen* pScreen, gpointer data ) } GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event, - GdkEvent*, - gpointer data ) + GdkEvent* ) { GdkFilterReturn aFilterReturn = GDK_FILTER_CONTINUE; - XEvent *pEvent = (XEvent *)sys_event; - GtkSalDisplay *pDisplay = (GtkSalDisplay *)data; // dispatch all XEvents to event callback if( GetSalData()->m_pInstance-> @@ -147,7 +154,7 @@ GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event, GTK_YIELD_GRAB(); - if (pDisplay->GetDisplay() == pEvent->xany.display ) + if (GetDisplay() == pEvent->xany.display ) { // #i53471# gtk has no callback mechanism that lets us be notified // when settings (as in XSETTING and opposed to styles) are changed. @@ -155,16 +162,16 @@ GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event, // these should be rare enough so that we can assume that the settings // actually change when a corresponding PropertyNotify occurs if( pEvent->type == PropertyNotify && - pEvent->xproperty.atom == pDisplay->getWMAdaptor()->getAtom( WMAdaptor::XSETTINGS ) && - ! pDisplay->m_aFrames.empty() + pEvent->xproperty.atom == getWMAdaptor()->getAtom( WMAdaptor::XSETTINGS ) && + ! m_aFrames.empty() ) { - pDisplay->SendInternalEvent( pDisplay->m_aFrames.front(), NULL, SALEVENT_SETTINGSCHANGED ); + SendInternalEvent( m_aFrames.front(), NULL, SALEVENT_SETTINGSCHANGED ); } // let's see if one of our frames wants to swallow these events // get the frame - for( std::list< SalFrame* >::const_iterator it = pDisplay->m_aFrames.begin(); - it != pDisplay->m_aFrames.end(); ++it ) + for( std::list< SalFrame* >::const_iterator it = m_aFrames.begin(); + it != m_aFrames.end(); ++it ) { GtkSalFrame* pFrame = static_cast<GtkSalFrame*>(*it); if( (GdkNativeWindow)pFrame->GetSystemData()->aWindow == pEvent->xany.window || @@ -201,7 +208,7 @@ void GtkSalDisplay::screenSizeChanged( GdkScreen* pScreen ) } else { - DBG_ERROR( "unknown screen changed size" ); + OSL_FAIL( "unknown screen changed size" ); } } } @@ -222,7 +229,7 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) { GdkRectangle dest; gdk_screen_get_monitor_geometry(pScreen, i, &dest); - m_aXineramaScreenIndexMap[i] = addXineramaScreenUnique( dest.x, dest.y, dest.width, dest.height ); + addXineramaScreenUnique( i, dest.x, dest.y, dest.width, dest.height ); } m_bXinerama = m_aXineramaScreens.size() > 1; if( ! m_aFrames.empty() ) @@ -230,7 +237,7 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) } else { - DBG_ERROR( "monitors for non-default screen changed, extend-me" ); + OSL_FAIL( "monitors for non-default screen changed, extend-me" ); } } } @@ -252,6 +259,17 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const (screen_get_primary_monitor)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_primary_monitor" ); if (sym_gdk_screen_get_primary_monitor) n = sym_gdk_screen_get_primary_monitor( pScreen ); +#if GTK_CHECK_VERSION(2,14,0) + //gdk_screen_get_primary_monitor unavailable, take the first laptop monitor + //as the default + gint nMonitors = gdk_screen_get_n_monitors(pScreen); + for (gint i = 0; i < nMonitors; ++i) + { + if (g_ascii_strncasecmp (gdk_screen_get_monitor_plug_name(pScreen, i), "LVDS", 4) == 0) + return m_aXineramaScreenIndexMap[i]; + } +#endif + return 0; #endif if( n >= 0 && size_t(n) < m_aXineramaScreenIndexMap.size() ) n = m_aXineramaScreenIndexMap[n]; @@ -268,9 +286,16 @@ void GtkSalDisplay::initScreen( int nScreen ) const // choose visual for screen SalDisplay::initScreen( nScreen ); + +#if GTK_CHECK_VERSION(3,0,0) + // no colormaps handling in gtk 3 +#else // now set a gdk default colormap matching the chosen visual to the screen - GdkVisual* pVis = gdkx_visual_get( rSD.m_aVisual.visualid ); GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, nScreen ); +// should really use this: +// GdkVisual* pVis = gdk_x11_screen_lookup_visual_get( screen, rSD.m_aVisual.visualid ); +// and not this: + GdkVisual* pVis = gdkx_visual_get( rSD.m_aVisual.visualid ); if( pVis ) { GdkColormap* pDefCol = gdk_screen_get_default_colormap( pScreen ); @@ -288,6 +313,7 @@ void GtkSalDisplay::initScreen( int nScreen ) const else fprintf( stderr, "not GdkVisual for visual id %d\n", (int)rSD.m_aVisual.visualid ); #endif +#endif } long GtkSalDisplay::Dispatch( XEvent* pEvent ) @@ -307,17 +333,32 @@ long GtkSalDisplay::Dispatch( XEvent* pEvent ) return GDK_FILTER_CONTINUE; } -GdkCursor* GtkSalDisplay::getFromXPM( const char *pBitmap, - const char *pMask, +GdkCursor* GtkSalDisplay::getFromXPM( const unsigned char *pBitmap, + const unsigned char *pMask, int nWidth, int nHeight, int nXHot, int nYHot ) { +#if GTK_CHECK_VERSION(3,0,0) + g_warning ("FIXME: to use gdk_cursor_new_from_pixbuf instead of spiders"); + // We need to do something like: + /* + GdkPixbuf *pPix = gdk_pixbuf_new_from_xpm_data (pBitmap); + GdkPixbuf *pMask = gdk_pixbuf_new_from_xpm_data (pMask); + + GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display, + GdkPixbuf *pixbuf, + gint x, + gint y); + */ + return gdk_cursor_new_for_display (gdk_display_get_default(), + GDK_SPIDER); +#else GdkScreen *pScreen = gdk_display_get_default_screen( m_pGdkDisplay ); GdkDrawable *pDrawable = GDK_DRAWABLE( gdk_screen_get_root_window (pScreen) ); GdkBitmap *pBitmapPix = gdk_bitmap_create_from_data - ( pDrawable, pBitmap, nWidth, nHeight ); + ( pDrawable, reinterpret_cast<const char*>(pBitmap), nWidth, nHeight ); GdkBitmap *pMaskPix = gdk_bitmap_create_from_data - ( pDrawable, pMask, nWidth, nHeight ); + ( pDrawable, reinterpret_cast<const char*>(pMask), nWidth, nHeight ); GdkColormap *pColormap = gdk_drawable_get_colormap( pDrawable ); GdkColor aWhite = { 0, 0xffff, 0xffff, 0xffff }; @@ -329,6 +370,7 @@ GdkCursor* GtkSalDisplay::getFromXPM( const char *pBitmap, return gdk_cursor_new_from_pixmap ( pBitmapPix, pMaskPix, &aBlack, &aWhite, nXHot, nYHot); +#endif } #define MAKE_CURSOR( vcl_name, name ) \ @@ -344,7 +386,7 @@ GdkCursor* GtkSalDisplay::getFromXPM( const char *pBitmap, GdkCursor *GtkSalDisplay::getCursor( PointerStyle ePointerStyle ) { - if( ePointerStyle > POINTER_COUNT ) + if( ePointerStyle >= POINTER_COUNT ) return NULL; if ( !m_aCursors[ ePointerStyle ] ) @@ -382,7 +424,7 @@ GdkCursor *GtkSalDisplay::getCursor( PointerStyle ePointerStyle ) MAP_BUILTIN( POINTER_HSIZEBAR, GDK_SB_H_DOUBLE_ARROW ); MAP_BUILTIN( POINTER_VSIZEBAR, GDK_SB_V_DOUBLE_ARROW ); - MAP_BUILTIN( POINTER_REFHAND, GDK_HAND1 ); + MAP_BUILTIN( POINTER_REFHAND, GDK_HAND2 ); MAP_BUILTIN( POINTER_HAND, GDK_HAND2 ); MAP_BUILTIN( POINTER_PEN, GDK_PENCIL ); @@ -451,17 +493,15 @@ GdkCursor *GtkSalDisplay::getCursor( PointerStyle ePointerStyle ) MAKE_CURSOR( POINTER_AIRBRUSH, airbrush_ ); MAKE_CURSOR( POINTER_TEXT_VERTICAL, vertcurs_ ); - // --> FME 2004-07-30 #i32329# Enhanced table selection + // #i32329# MAKE_CURSOR( POINTER_TAB_SELECT_S, tblsels_ ); MAKE_CURSOR( POINTER_TAB_SELECT_E, tblsele_ ); MAKE_CURSOR( POINTER_TAB_SELECT_SE, tblselse_ ); MAKE_CURSOR( POINTER_TAB_SELECT_W, tblselw_ ); MAKE_CURSOR( POINTER_TAB_SELECT_SW, tblselsw_ ); - // <-- - // --> FME 2004-08-16 #i20119# Paintbrush tool + // #i20119# MAKE_CURSOR( POINTER_PAINTBRUSH, paintbrush_ ); - // <-- default: fprintf( stderr, "pointer %d not implemented", ePointerStyle ); @@ -554,6 +594,7 @@ GtkXLib::~GtkXLib() #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "GtkXLib::~GtkXLib()\n" ); #endif + Yield( true, true ); StopTimer(); // sanity check: at this point nobody should be yielding, but wake them // up anyway before the condition they're waiting on gets destroyed. @@ -573,7 +614,9 @@ void GtkXLib::Init() #endif XrmInitialize(); +#if !GTK_CHECK_VERSION(3,0,0) gtk_set_locale(); +#endif /* * open connection to X11 Display @@ -599,7 +642,7 @@ void GtkXLib::Init() osl_getCommandArg(i, &aParam.pData ); OString aBParam( OUStringToOString( aParam, aEnc ) ); - if( aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" ) ) + if( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-display" ) ) || aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--display" ) ) ) { pCmdLineAry[i+1] = g_strdup( "--display" ); osl_getCommandArg(i+1, &aParam.pData ); @@ -671,13 +714,11 @@ void GtkXLib::Init() m_pGtkSalDisplay = new GtkSalDisplay( pGdkDisp ); - gdk_window_add_filter( NULL, call_filterGdkEvent, m_pGtkSalDisplay ); - PushXErrorLevel( true ); SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp ); XSync( pDisp, False ); - pKbdExtension->UseExtension( ! HasXErrorOccured() ); + pKbdExtension->UseExtension( ! HasXErrorOccurred() ); PopXErrorLevel(); m_pGtkSalDisplay->SetKbdExtension( pKbdExtension ); @@ -1019,3 +1060,5 @@ void GtkData::Init() pXLib_ = new GtkXLib(); pXLib_->Init(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx index 888e2ed883b9..289ebc50a462 100644 --- a/vcl/unx/gtk/app/gtkinst.cxx +++ b/vcl/unx/gtk/app/gtkinst.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -77,7 +78,7 @@ void GtkHookedYieldMutex::ThreadsLeave() #if OSL_DEBUG_LEVEL > 1 if( mnThreadId && - mnThreadId != vos::OThread::getCurrentIdentifier()) + mnThreadId != osl::Thread::getCurrentIdentifier()) fprintf( stderr, "\n\n--- A different thread owns the mutex ...---\n\n\n"); #endif @@ -132,6 +133,11 @@ extern "C" VCLPLUG_GTK_PUBLIC SalInstance* create_SalInstance( oslModule pModule ) { +#if OSL_DEBUG_LEVEL > 0 + fprintf( stderr, "create vcl plugin instance with gtk version %d %d %d\n", + (int) gtk_major_version, (int) gtk_minor_version, + (int) gtk_micro_version ); +#endif /* #i92121# workaround deadlocks in the X11 implementation */ static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); @@ -142,7 +148,11 @@ extern "C" if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) XInitThreads(); +#if GTK_CHECK_VERSION(3,0,0) + const gchar* pVersion = gtk_check_version( 3, 0, 0 ); +#else const gchar* pVersion = gtk_check_version( 2, 2, 0 ); +#endif if( pVersion ) { #if OSL_DEBUG_LEVEL > 1 @@ -160,7 +170,11 @@ extern "C" if ( hookLocks( pModule ) ) pYieldMutex = new GtkHookedYieldMutex(); else +#if GTK_CHECK_VERSION(3,0,0) + g_error ("impossible case for gtk3"); +#else pYieldMutex = new GtkYieldMutex(); +#endif gdk_threads_init(); @@ -225,7 +239,7 @@ void GtkInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const r { //Non-utf8 locales are a bad idea if trying to work with non-ascii filenames //Decode %XX components - rtl::OUString sDecodedUri = Uri::decode(rFileUrl.copy(7), rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8); + rtl::OUString sDecodedUri = rtl::Uri::decode(rFileUrl.copy(7), rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8); //Convert back to system locale encoding rtl::OString sSystemUrl = rtl::OUStringToOString(sDecodedUri, aSystemEnc); //Encode to an escaped ASCII-encoded URI @@ -250,38 +264,53 @@ void GtkInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const r #endif } + +/* + * Obsolete, non-working, and crufty code from the + * beginning of time. When we update our base platform + * we should kill this with extreme prejudice. + */ +#if !GTK_CHECK_VERSION(3,0,0) +# define HORRIBLE_OBSOLETE_YIELDMUTEX_IMPL +#endif + GtkYieldMutex::GtkYieldMutex() { } void GtkYieldMutex::acquire() { - vos::OThread::TThreadIdentifier aCurrentThread = vos::OThread::getCurrentIdentifier(); +#ifdef HORRIBLE_OBSOLETE_YIELDMUTEX_IMPL + oslThreadIdentifier aCurrentThread = osl::Thread::getCurrentIdentifier(); // protect member manipulation - OMutex::acquire(); + SolarMutexObject::acquire(); if( mnCount > 0 && mnThreadId == aCurrentThread ) { mnCount++; - OMutex::release(); + SolarMutexObject::release(); return; } - OMutex::release(); + SolarMutexObject::release(); // obtain gdk mutex gdk_threads_enter(); // obtained gdk mutex, now lock count is one by definition - OMutex::acquire(); + SolarMutexObject::acquire(); mnCount = 1; mnThreadId = aCurrentThread; - OMutex::release(); + SolarMutexObject::release(); +#else + g_error ("never called"); +#endif } void GtkYieldMutex::release() { - vos::OThread::TThreadIdentifier aCurrentThread = vos::OThread::getCurrentIdentifier(); +#ifdef HORRIBLE_OBSOLETE_YIELDMUTEX_IMPL + oslThreadIdentifier aCurrentThread = osl::Thread::getCurrentIdentifier(); // protect member manipulation - OMutex::acquire(); + SolarMutexObject::acquire(); // strange things happen, do nothing if we don't own the mutex if( mnThreadId == aCurrentThread ) { @@ -292,29 +321,33 @@ void GtkYieldMutex::release() mnThreadId = 0; } } - OMutex::release(); + SolarMutexObject::release(); +#else + g_error ("never called"); +#endif } sal_Bool GtkYieldMutex::tryToAcquire() { - vos::OThread::TThreadIdentifier aCurrentThread = vos::OThread::getCurrentIdentifier(); +#ifdef HORRIBLE_OBSOLETE_YIELDMUTEX_IMPL + oslThreadIdentifier aCurrentThread = osl::Thread::getCurrentIdentifier(); // protect member manipulation - OMutex::acquire(); + SolarMutexObject::acquire(); if( mnCount > 0 ) { if( mnThreadId == aCurrentThread ) { mnCount++; - OMutex::release(); + SolarMutexObject::release(); return sal_True; } else { - OMutex::release(); + SolarMutexObject::release(); return sal_False; } } - OMutex::release(); + SolarMutexObject::release(); // HACK: gdk_threads_mutex is private, we shouldn't use it. // how to we do a try_lock without having a gdk_threads_try_enter ? @@ -322,45 +355,60 @@ sal_Bool GtkYieldMutex::tryToAcquire() return sal_False; // obtained gdk mutex, now lock count is one by definition - OMutex::acquire(); + SolarMutexObject::acquire(); mnCount = 1; mnThreadId = aCurrentThread; - OMutex::release(); + SolarMutexObject::release(); +#else + g_error ("never called"); +#endif return sal_True; } int GtkYieldMutex::Grab() { +#ifdef HORRIBLE_OBSOLETE_YIELDMUTEX_IMPL // this MUST only be called by gdk/gtk callbacks: // they are entered with gdk mutex locked; the mutex // was unlocked by GtkYieldMutex befor yielding which // is now locked again by gtk implicitly // obtained gdk mutex, now lock count is one by definition - OMutex::acquire(); + SolarMutexObject::acquire(); int nRet = mnCount; if( mnCount == 0 ) // recursive else - mnThreadId = vos::OThread::getCurrentIdentifier(); + mnThreadId = osl::Thread::getCurrentIdentifier(); #if OSL_DEBUG_LEVEL > 1 - else if( mnThreadId != vos::OThread::getCurrentIdentifier() ) + else if( mnThreadId != osl::Thread::getCurrentIdentifier() ) { fprintf( stderr, "Yield mutex grabbed in different thread !\n" ); abort(); } #endif mnCount = 1; - OMutex::release(); + SolarMutexObject::release(); return nRet; +#else + g_error ("never called"); + return sal_True; +#endif } void GtkYieldMutex::Ungrab( int nGrabs ) { +#ifdef HORRIBLE_OBSOLETE_YIELDMUTEX_IMPL // this MUST only be called when leaving the callback // that locked the mutex with Grab() - OMutex::acquire(); + SolarMutexObject::acquire(); mnCount = nGrabs; if( mnCount == 0 ) mnThreadId = 0; - OMutex::release(); + SolarMutexObject::release(); +#else + (void)nGrabs; + g_error ("never called"); +#endif } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx index daaf4b27bc5c..2076d39cc229 100644 --- a/vcl/unx/gtk/app/gtksys.cxx +++ b/vcl/unx/gtk/app/gtksys.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#ifdef AIX +#define _LINUX_SOURCE_COMPAT +#include <sys/timer.h> +#undef _LINUX_SOURCE_COMPAT +#endif + #include <unx/svunx.h> #include <svdata.hxx> + #include <vcl/window.hxx> #include <unx/gtk/gtkinst.hxx> #include <cstdio> @@ -46,6 +54,14 @@ GtkSalSystem::~GtkSalSystem() { } +// convert ~ to indicate mnemonic to '_' +static ByteString MapToGtkAccelerator (const String &rStr) +{ + String aRet( rStr ); + aRet.SearchAndReplaceAscii("~", String::CreateFromAscii("_")); + return ByteString( aRet, RTL_TEXTENCODING_UTF8 ); +} + int GtkSalSystem::ShowNativeDialog( const String& rTitle, const String& rMessage, const std::list< String >& rButtons, @@ -74,15 +90,16 @@ int GtkSalSystem::ShowNativeDialog( const String& rTitle, int nButton = 0; for( std::list< String >::const_iterator it = rButtons.begin(); it != rButtons.end(); ++it ) { - ByteString aLabel( *it, RTL_TEXTENCODING_UTF8 ); - if( nButton == nDefButton ) { - gtk_dialog_add_button( GTK_DIALOG( mainwin ), aLabel.GetBuffer(), nButtons ); + gtk_dialog_add_button( GTK_DIALOG( mainwin ), MapToGtkAccelerator(*it).GetBuffer(), nButtons ); gtk_dialog_set_default_response( GTK_DIALOG( mainwin ), nButtons ); } else + { + ByteString aLabel( *it, RTL_TEXTENCODING_UTF8 ); gtk_dialog_add_button( GTK_DIALOG( mainwin ), aLabel.GetBuffer(), nButtons ); + } nButtons++; } @@ -94,3 +111,5 @@ int GtkSalSystem::ShowNativeDialog( const String& rTitle, return nResponse; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 3657e3a0d770..5901f861eaf1 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,8 +44,9 @@ #include <cmath> #include <vector> #include <algorithm> -#include <hash_map> +#include <boost/unordered_map.hpp> +#include "vcl/vclenum.hxx" typedef struct _cairo_font_options cairo_font_options_t; // initialize statics @@ -58,8 +60,7 @@ GtkSalGraphics::~GtkSalGraphics() { } - -using namespace rtl; +using ::rtl::OUString; /************************************* * Cached native widget objects @@ -68,26 +69,25 @@ class NWPixmapCacheList; class NWPixmapCache; struct NWFWidgetData { - GtkWidget * gCacheWindow; - GtkWidget * gDumbContainer; - - GtkWidget * gBtnWidget; - GtkWidget * gRadioWidget; - GtkWidget * gRadioWidgetSibling; - GtkWidget * gCheckWidget; - GtkWidget * gScrollHorizWidget; - GtkWidget * gScrollVertWidget; - GtkWidget * gArrowWidget; - GtkWidget * gDropdownWidget; - GtkWidget * gEditBoxWidget; - GtkWidget * gSpinButtonWidget; - GtkWidget * gNotebookWidget; - GtkWidget * gOptionMenuWidget; - GtkWidget * gComboWidget; - GtkWidget * gScrolledWindowWidget; + GtkWidget * gCacheWindow; + GtkWidget * gDumbContainer; + + GtkWidget * gBtnWidget; + GtkWidget * gRadioWidget; + GtkWidget * gRadioWidgetSibling; + GtkWidget * gCheckWidget; + GtkWidget * gScrollHorizWidget; + GtkWidget * gScrollVertWidget; + GtkWidget * gArrowWidget; + GtkWidget * gDropdownWidget; + GtkWidget * gEditBoxWidget; + GtkWidget * gSpinButtonWidget; + GtkWidget * gNotebookWidget; + GtkWidget * gOptionMenuWidget; + GtkWidget * gComboWidget; + GtkWidget * gScrolledWindowWidget; GtkWidget * gToolbarWidget; GtkWidget * gToolbarButtonWidget; - GtkWidget * gToolbarToggleWidget; GtkWidget * gHandleBoxWidget; GtkWidget * gMenubarWidget; GtkWidget * gMenuItemMenubarWidget; @@ -95,12 +95,14 @@ struct NWFWidgetData GtkWidget * gMenuItemMenuWidget; GtkWidget * gMenuItemCheckMenuWidget; GtkWidget * gMenuItemRadioMenuWidget; + GtkWidget * gMenuItemSeparatorMenuWidget; GtkWidget * gImageMenuItem; GtkWidget * gTooltipPopup; GtkWidget * gProgressBar; GtkWidget * gTreeView; GtkWidget * gHScale; GtkWidget * gVScale; + GtkWidget * gVSeparator; NWPixmapCacheList* gNWPixmapCacheList; NWPixmapCache* gCacheTabItems; @@ -125,7 +127,6 @@ struct NWFWidgetData gScrolledWindowWidget( NULL ), gToolbarWidget( NULL ), gToolbarButtonWidget( NULL ), - gToolbarToggleWidget( NULL ), gHandleBoxWidget( NULL ), gMenubarWidget( NULL ), gMenuItemMenubarWidget( NULL ), @@ -133,12 +134,14 @@ struct NWFWidgetData gMenuItemMenuWidget( NULL ), gMenuItemCheckMenuWidget( NULL ), gMenuItemRadioMenuWidget( NULL ), + gMenuItemSeparatorMenuWidget( NULL ), gImageMenuItem( NULL ), gTooltipPopup( NULL ), gProgressBar( NULL ), gTreeView( NULL ), gHScale( NULL ), gVScale( NULL ), + gVSeparator ( NULL ), gNWPixmapCacheList( NULL ), gCacheTabItems( NULL ), gCacheTabPages( NULL ) @@ -148,29 +151,29 @@ struct NWFWidgetData // Keep a hash table of Widgets->default flags so that we can // easily and quickly reset each to a default state before using // them -static std::hash_map<long, guint> gWidgetDefaultFlags; +static boost::unordered_map<long, guint> gWidgetDefaultFlags; static std::vector<NWFWidgetData> gWidgetData; static const GtkBorder aDefDefBorder = { 1, 1, 1, 1 }; // Some GTK defaults -#define MIN_ARROW_SIZE 11 -#define BTN_CHILD_SPACING 1 +#define MIN_ARROW_SIZE 11 +#define BTN_CHILD_SPACING 1 #define MIN_SPIN_ARROW_WIDTH 6 static void NWEnsureGTKRadio ( int nScreen ); -static void NWEnsureGTKButton ( int nScreen ); +static void NWEnsureGTKButton ( int nScreen ); static void NWEnsureGTKCheck ( int nScreen ); -static void NWEnsureGTKScrollbars ( int nScreen ); +static void NWEnsureGTKScrollbars ( int nScreen ); static void NWEnsureGTKArrow ( int nScreen ); -static void NWEnsureGTKEditBox ( int nScreen ); -static void NWEnsureGTKSpinButton ( int nScreen ); -static void NWEnsureGTKNotebook ( int nScreen ); -static void NWEnsureGTKOptionMenu ( int nScreen ); +static void NWEnsureGTKEditBox ( int nScreen ); +static void NWEnsureGTKSpinButton ( int nScreen ); +static void NWEnsureGTKNotebook ( int nScreen ); +static void NWEnsureGTKOptionMenu ( int nScreen ); static void NWEnsureGTKCombo ( int nScreen ); -static void NWEnsureGTKScrolledWindow ( int nScreen ); -static void NWEnsureGTKToolbar ( int nScreen ); +static void NWEnsureGTKScrolledWindow ( int nScreen ); +static void NWEnsureGTKToolbar ( int nScreen ); static void NWEnsureGTKMenubar ( int nScreen ); static void NWEnsureGTKMenu ( int nScreen ); static void NWEnsureGTKTooltip ( int nScreen ); @@ -229,7 +232,7 @@ static Rectangle NWGetToolbarRect( int nScreen, const OUString& rCaption ); //--- -static Rectangle NWGetScrollButtonRect( int nScreen, ControlPart nPart, Rectangle aAreaRect ); +static Rectangle NWGetScrollButtonRect( int nScreen, ControlPart nPart, Rectangle aAreaRect ); //--- /********************************************************* @@ -267,7 +270,7 @@ public: void SetSize( int n) { delete [] pData; m_idx = 0; m_size = n; pData = new NWPixmapCacheData[m_size]; } - int GetSize() { return m_size; } + int GetSize() const { return m_size; } sal_Bool Find( ControlType aType, ControlState aState, const Rectangle& r_pixmapRect, GdkPixmap** pPixmap ); void Fill( ControlType aType, ControlState aState, const Rectangle& r_pixmapRect, GdkPixmap* pPixmap ); @@ -372,7 +375,7 @@ void NWPixmapCacheList::ThemeChanged( ) while( p != mCaches.end() ) { (*p)->ThemeChanged(); - p++; + ++p; } } @@ -382,10 +385,10 @@ void NWPixmapCacheList::ThemeChanged( ) *********************************************************/ inline void NW_gtk_border_set_from_border( GtkBorder& aDst, const GtkBorder * pSrc ) { - aDst.left = pSrc->left; + aDst.left = pSrc->left; aDst.top = pSrc->top; - aDst.right = pSrc->right; - aDst.bottom = pSrc->bottom; + aDst.right = pSrc->right; + aDst.bottom = pSrc->bottom; } @@ -402,9 +405,6 @@ void GtkData::initNWF( void ) // draw separate buttons for toolbox dropdown items pSVData->maNWFData.mbToolboxDropDownSeparate = true; - // small extra border around menu items - pSVData->maNWFData.mnMenuFormatExtraBorder = 1; - // draw toolbars in separate lines pSVData->maNWFData.mbDockingAreaSeparateTB = true; @@ -419,8 +419,15 @@ void GtkData::initNWF( void ) for( int i = 0; i < nScreens; i++ ) gWidgetData[i].gNWPixmapCacheList = new NWPixmapCacheList; + // small extra border around menu items + NWEnsureGTKMenu( 0 ); + gint horizontal_padding = 1; + gtk_widget_style_get( gWidgetData[0].gMenuItemMenuWidget, + "horizontal_padding", &horizontal_padding, + (char *)NULL); + pSVData->maNWFData.mnMenuFormatExtraBorder = horizontal_padding; - if( SalGetDesktopEnvironment().equalsAscii( "KDE" ) ) + if( SalGetDesktopEnvironment().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("KDE")) ) { // #i97196# ensure a widget exists and the style engine was loaded NWEnsureGTKButton( 0 ); @@ -524,47 +531,51 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar if ( ((nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL)) || ((nType==CTRL_RADIOBUTTON) && (nPart==PART_ENTIRE_CONTROL)) || - ((nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL)) || + ((nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL)) || ((nType==CTRL_SCROLLBAR) && ( (nPart==PART_DRAW_BACKGROUND_HORZ) || (nPart==PART_DRAW_BACKGROUND_VERT) || (nPart==PART_ENTIRE_CONTROL) - || (nPart==HAS_THREE_BUTTONS) ) ) || + || (nPart==HAS_THREE_BUTTONS) ) ) || ((nType==CTRL_EDITBOX) && ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || + || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || ((nType==CTRL_MULTILINE_EDITBOX) && ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || + || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || ((nType==CTRL_SPINBOX) && ( (nPart==PART_ENTIRE_CONTROL) || (nPart==PART_ALL_BUTTONS) - || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || + || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || ((nType==CTRL_SPINBUTTONS) && ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==PART_ALL_BUTTONS) ) ) || + || (nPart==PART_ALL_BUTTONS) ) ) || ((nType==CTRL_COMBOBOX) && ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || + || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || (((nType==CTRL_TAB_ITEM) || (nType==CTRL_TAB_PANE) || (nType==CTRL_TAB_BODY) || (nType==CTRL_FIXEDBORDER)) && ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==PART_TABS_DRAW_RTL) ) ) || + || (nPart==PART_TABS_DRAW_RTL) ) ) || ((nType==CTRL_LISTBOX) && ( (nPart==PART_ENTIRE_CONTROL) || (nPart==PART_WINDOW) || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || ((nType == CTRL_TOOLBAR) && - ( (nPart==PART_ENTIRE_CONTROL) + ( (nPart==PART_ENTIRE_CONTROL) || (nPart==PART_DRAW_BACKGROUND_HORZ) || (nPart==PART_DRAW_BACKGROUND_VERT) || (nPart==PART_THUMB_HORZ) || (nPart==PART_THUMB_VERT) || (nPart==PART_BUTTON) + || (nPart==PART_SEPARATOR) ) ) || ((nType == CTRL_MENUBAR) && - ( (nPart==PART_ENTIRE_CONTROL) ) ) || + ( (nPart==PART_ENTIRE_CONTROL) + || (nPart==PART_MENU_ITEM) + ) + ) || ((nType == CTRL_TOOLTIP) && ( (nPart==PART_ENTIRE_CONTROL) ) ) || ((nType == CTRL_MENU_POPUP) && @@ -572,6 +583,8 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar || (nPart==PART_MENU_ITEM) || (nPart==PART_MENU_ITEM_CHECK_MARK) || (nPart==PART_MENU_ITEM_RADIO_MARK) + || (nPart==PART_MENU_SEPARATOR) + || (nPart==PART_MENU_SUBMENU_ARROW) ) ) || ((nType == CTRL_PROGRESS) && @@ -587,7 +600,6 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar ) ) return( sal_True ); - return( sal_False ); } @@ -601,11 +613,11 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar * * returns whether bIsInside was really set. */ -sal_Bool GtkSalGraphics::hitTestNativeControl( ControlType nType, - ControlPart nPart, +sal_Bool GtkSalGraphics::hitTestNativeControl( ControlType nType, + ControlPart nPart, const Rectangle& rControlRegion, const Point& aPos, - sal_Bool& rIsInside ) + sal_Bool& rIsInside ) { if ( ( nType == CTRL_SCROLLBAR ) && ( ( nPart == PART_BUTTON_UP ) || @@ -707,11 +719,11 @@ sal_Bool GtkSalGraphics::hitTestNativeControl( ControlType nType, * * Draws the requested control described by nPart/nState. * - * rControlRegion: The bounding region of the complete control in VCL frame coordinates. - * aValue: An optional value (tristate/numerical/string) - * rCaption: A caption or title string (like button text etc) + * rControlRegion: The bounding region of the complete control in VCL frame coordinates. + * aValue: An optional value (tristate/numerical/string) + * rCaption: A caption or title string (like button text etc) */ -sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, +sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, @@ -839,6 +851,8 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, || (nPart == PART_MENU_ITEM) || (nPart == PART_MENU_ITEM_CHECK_MARK) || (nPart == PART_MENU_ITEM_RADIO_MARK) + || (nPart == PART_MENU_SEPARATOR) + || (nPart == PART_MENU_SUBMENU_ARROW) ) ) { @@ -859,7 +873,7 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, else if( (nType == CTRL_LISTNET) && (nPart == PART_ENTIRE_CONTROL) ) { // don't actually draw anything; gtk treeviews do not draw lines - returnVal = true; + returnVal = TRUE; } else if( (nType == CTRL_SLIDER) ) { @@ -881,11 +895,11 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, * OPTIONAL. Draws the requested text for the control described by nPart/nState. * Used if text not drawn by DrawNativeControl(). * - * rControlRegion: The bounding region of the complete control in VCL frame coordinates. - * aValue: An optional value (tristate/numerical/string) - * rCaption: A caption or title string (like button text etc) + * rControlRegion: The bounding region of the complete control in VCL frame coordinates. + * aValue: An optional value (tristate/numerical/string) + * rCaption: A caption or title string (like button text etc) */ -sal_Bool GtkSalGraphics::drawNativeControlText( ControlType, +sal_Bool GtkSalGraphics::drawNativeControlText( ControlType, ControlPart, const Rectangle&, ControlState, @@ -905,9 +919,9 @@ sal_Bool GtkSalGraphics::drawNativeControlText( ControlType, * within the control that can be safely drawn into without drawing over * the borders of the control. * - * rControlRegion: The bounding region of the control in VCL frame coordinates. - * aValue: An optional value (tristate/numerical/string) - * rCaption: A caption or title string (like button text etc) + * rControlRegion: The bounding region of the control in VCL frame coordinates. + * aValue: An optional value (tristate/numerical/string) + * rCaption: A caption or title string (like button text etc) */ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, @@ -956,8 +970,8 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, returnVal = sal_True; } if ( (nType==CTRL_TOOLBAR) && - ((nPart==PART_DRAW_BACKGROUND_HORZ) || - (nPart==PART_DRAW_BACKGROUND_VERT) || + ((nPart==PART_DRAW_BACKGROUND_HORZ) || + (nPart==PART_DRAW_BACKGROUND_VERT) || (nPart==PART_THUMB_HORZ) || (nPart==PART_THUMB_VERT) || (nPart==PART_BUTTON) @@ -973,6 +987,11 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, rNativeBoundingRegion = NWGetScrollButtonRect( m_nScreen, nPart, rControlRegion ); rNativeContentRegion = rNativeBoundingRegion; + //See fdo#33523, possibly makes sense to do this test for all return values + if (!rNativeContentRegion.GetWidth()) + rNativeContentRegion.Right() = rNativeContentRegion.Left() + 1; + if (!rNativeContentRegion.GetHeight()) + rNativeContentRegion.Bottom() = rNativeContentRegion.Top() + 1; returnVal = sal_True; } if( (nType == CTRL_MENUBAR) && (nPart == PART_ENTIRE_CONTROL) ) @@ -1007,6 +1026,42 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, rNativeContentRegion = aIndicatorRect; returnVal = sal_True; } + else if( nPart == PART_MENU_SUBMENU_ARROW ) + { + GtkWidget* widget = gWidgetData[m_nScreen].gMenuItemMenuWidget; + GtkWidget* child; + PangoContext *context; + PangoFontMetrics *metrics; + gint arrow_size; + gint arrow_extent; + guint horizontal_padding; + gfloat arrow_scaling; + + gtk_widget_style_get( widget, + "horizontal-padding", &horizontal_padding, + "arrow-scaling", &arrow_scaling, + NULL ); + + child = GTK_BIN( widget )->child; + + context = gtk_widget_get_pango_context( child ); + metrics = pango_context_get_metrics( context, + child->style->font_desc, + pango_context_get_language( context ) ); + + arrow_size = ( PANGO_PIXELS( pango_font_metrics_get_ascent( metrics ) + + pango_font_metrics_get_descent( metrics ) )); + + pango_font_metrics_unref( metrics ); + + arrow_extent = static_cast<gint>(arrow_size * arrow_scaling); + + rNativeContentRegion = Rectangle( Point( 0, 0 ), + Size( arrow_extent, arrow_extent )); + rNativeBoundingRegion = Rectangle( Point( 0, 0 ), + Size( arrow_extent + horizontal_padding, arrow_extent )); + returnVal = sal_True; + } } if( (nType == CTRL_RADIOBUTTON || nType == CTRL_CHECKBOX) ) { @@ -1068,11 +1123,12 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, return( returnVal ); } - /************************************************************************ * Individual control drawing functions ************************************************************************/ -sal_Bool GtkSalGraphics::NWPaintGTKButton( + +sal_Bool GtkSalGraphics::NWPaintGTKButtonReal( + GtkWidget* button, GdkDrawable* gdkDrawable, ControlType, ControlPart, const Rectangle& rControlRectangle, @@ -1081,29 +1137,44 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton( const OUString& ) { GtkStateType stateType; - GtkShadowType shadowType; + GtkShadowType shadowType; gboolean interiorFocus; gint focusWidth; gint focusPad; sal_Bool bDrawFocus = sal_True; gint x, y, w, h; - GtkBorder aDefBorder; - GtkBorder* pBorder; + GtkBorder aDefBorder; + GtkBorder* pBorder; GdkRectangle clipRect; NWEnsureGTKButton( m_nScreen ); + NWEnsureGTKToolbar( m_nScreen ); NWConvertVCLStateToGTKState( nState, &stateType, &shadowType ); + NWSetWidgetState( gWidgetData[m_nScreen].gBtnWidget, nState, stateType ); x = rControlRectangle.Left(); y = rControlRectangle.Top(); w = rControlRectangle.GetWidth(); h = rControlRectangle.GetHeight(); + gint internal_padding = 0; + if(GTK_IS_TOOL_ITEM(button)) + { + gtk_widget_style_get (GTK_WIDGET (gWidgetData[m_nScreen].gToolbarWidget), + "internal-padding", &internal_padding, + NULL); + x += internal_padding/2; + w -= internal_padding; + stateType = GTK_STATE_PRELIGHT; + } + // Grab some button style attributes - gtk_widget_style_get( gWidgetData[m_nScreen].gBtnWidget, "focus-line-width", &focusWidth, - "focus-padding", &focusPad, - "interior_focus", &interiorFocus, - "default_border", &pBorder, + gtk_widget_style_get( gWidgetData[m_nScreen].gBtnWidget, "focus-line-width", &focusWidth, + "focus-padding", &focusPad, + "interior_focus", &interiorFocus, + (char *)NULL ); + gtk_widget_style_get( gWidgetData[m_nScreen].gBtnWidget, + "default_border", &pBorder, (char *)NULL ); // Make sure the border values exist, otherwise use some defaults @@ -1118,8 +1189,6 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton( if ( (w < 16) || (h < 16) ) bDrawFocus = sal_False; - NWSetWidgetState( gWidgetData[m_nScreen].gBtnWidget, nState, stateType ); - gint xi = x, yi = y, wi = w, hi = h; if ( (nState & CTRL_STATE_DEFAULT) && bDrawFocus ) { @@ -1136,7 +1205,6 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton( wi -= 2 * (focusWidth + focusPad); hi -= 2 * (focusWidth + focusPad); } - for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it) { clipRect.x = it->Left(); @@ -1145,50 +1213,50 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton( clipRect.height = it->GetHeight(); // Buttons must paint opaque since some themes have alpha-channel enabled buttons - gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, - &clipRect, m_pWindow, "base", x, y, w, h ); - - if ( (nState & CTRL_STATE_DEFAULT) && (GTK_BUTTON(gWidgetData[m_nScreen].gBtnWidget)->relief == GTK_RELIEF_NORMAL) ) - { - gtk_paint_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, - &clipRect, gWidgetData[m_nScreen].gBtnWidget, "buttondefault", x, y, w, h ); - } - - if ( (GTK_BUTTON(gWidgetData[m_nScreen].gBtnWidget)->relief != GTK_RELIEF_NONE) - || (nState & CTRL_STATE_PRESSED) - || (nState & CTRL_STATE_ROLLOVER) ) + if(button == gWidgetData[m_nScreen].gToolbarButtonWidget) { - gtk_paint_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, stateType, shadowType, - &clipRect, gWidgetData[m_nScreen].gBtnWidget, "button", xi, yi, wi, hi ); + gtk_paint_box( gWidgetData[m_nScreen].gToolbarWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, + &clipRect, gWidgetData[m_nScreen].gToolbarWidget, "toolbar", x, y, w, h ); } - } -#if 0 // VCL draws focus rects - // Draw focus rect - if ( (nState & CTRL_STATE_FOCUSED) && (nState & CTRL_STATE_ENABLED) && bDrawFocus ) - { - if (interiorFocus) + else { - x += gWidgetData[m_nScreen].gBtnWidget->style->xthickness + focusPad; - y += gWidgetData[m_nScreen].gBtnWidget->style->ythickness + focusPad; - w -= 2 * (gWidgetData[m_nScreen].gBtnWidget->style->xthickness + focusPad); - h -= 2 * (gWidgetData[m_nScreen].gBtnWidget->style->xthickness + focusPad); + gtk_paint_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, + &clipRect, m_pWindow, "base", x, y, w, h ); } - else + + if ( (nState & CTRL_STATE_DEFAULT) && GTK_IS_BUTTON(button) ) { - x -= focusWidth + focusPad; - y -= focusWidth + focusPad; - w += 2 * (focusWidth + focusPad); - h += 2 * (focusWidth + focusPad); + gtk_paint_box( button->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, + &clipRect, button, "buttondefault", x, y, w, h ); } - if ( !interiorFocus ) - gtk_paint_focus( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, stateType, &clipRect, - gWidgetData[m_nScreen].gBtnWidget, "button", x, y, w, h ); + /* don't draw "button", because it can be a tool_button, and + * it causes some weird things, so, the default button is + * just fine */ + gtk_paint_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, stateType, shadowType, + &clipRect, gWidgetData[m_nScreen].gBtnWidget, "button", xi, yi, wi, hi ); } -#endif return( sal_True ); } +sal_Bool GtkSalGraphics::NWPaintGTKButton( + GdkDrawable* gdkDrawable, + ControlType type, ControlPart part, + const Rectangle& rControlRectangle, + const clipList& rClipList, + ControlState nState, const ImplControlValue& value, + const OUString& string) +{ + return NWPaintGTKButtonReal( + gWidgetData[m_nScreen].gBtnWidget, + gdkDrawable, + type, part, + rControlRectangle, + rClipList, + nState, value, + string ); +} + static Rectangle NWGetButtonArea( int nScreen, ControlType, ControlPart, Rectangle aAreaRect, ControlState nState, const ImplControlValue&, const OUString& ) @@ -1196,18 +1264,18 @@ static Rectangle NWGetButtonArea( int nScreen, gboolean interiorFocus; gint focusWidth; gint focusPad; - GtkBorder aDefBorder; - GtkBorder * pBorder; + GtkBorder aDefBorder; + GtkBorder * pBorder; sal_Bool bDrawFocus = sal_True; - Rectangle aRect; + Rectangle aRect; gint x, y, w, h; NWEnsureGTKButton( nScreen ); gtk_widget_style_get( gWidgetData[nScreen].gBtnWidget, - "focus-line-width", &focusWidth, - "focus-padding", &focusPad, - "interior_focus", &interiorFocus, - "default_border", &pBorder, + "focus-line-width", &focusWidth, + "focus-padding", &focusPad, + "interior_focus", &interiorFocus, + "default_border", &pBorder, (char *)NULL ); // Make sure the border values exist, otherwise use some defaults @@ -1251,7 +1319,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable, const OUString& ) { GtkStateType stateType; - GtkShadowType shadowType; + GtkShadowType shadowType; sal_Bool isChecked = (aValue.getTristateVal()==BUTTONVALUE_ON); gint x, y; GdkRectangle clipRect; @@ -1309,7 +1377,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable, const OUString& ) { GtkStateType stateType; - GtkShadowType shadowType; + GtkShadowType shadowType; bool isChecked = (aValue.getTristateVal() == BUTTONVALUE_ON); bool isInconsistent = (aValue.getTristateVal() == BUTTONVALUE_MIXED); GdkRectangle clipRect; @@ -1368,24 +1436,24 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, OSL_ASSERT( aValue.getType() == CTRL_SCROLLBAR ); const ScrollbarValue* pScrollbarVal = static_cast<const ScrollbarValue *>(&aValue); GdkPixmap* pixmap = NULL; - Rectangle pixmapRect, scrollbarRect; + Rectangle pixmapRect, scrollbarRect; GtkStateType stateType; - GtkShadowType shadowType; - GtkScrollbar * scrollbarWidget; - GtkStyle * style; + GtkShadowType shadowType; + GtkScrollbar * scrollbarWidget; + GtkStyle * style; GtkAdjustment* scrollbarValues = NULL; - GtkOrientation scrollbarOrientation; - Rectangle thumbRect = pScrollbarVal->maThumbRect; - Rectangle button11BoundRect = pScrollbarVal->maButton1Rect; // backward - Rectangle button22BoundRect = pScrollbarVal->maButton2Rect; // forward - Rectangle button12BoundRect = pScrollbarVal->maButton1Rect; // secondary forward - Rectangle button21BoundRect = pScrollbarVal->maButton2Rect; // secondary backward + GtkOrientation scrollbarOrientation; + Rectangle thumbRect = pScrollbarVal->maThumbRect; + Rectangle button11BoundRect = pScrollbarVal->maButton1Rect; // backward + Rectangle button22BoundRect = pScrollbarVal->maButton2Rect; // forward + Rectangle button12BoundRect = pScrollbarVal->maButton1Rect; // secondary forward + Rectangle button21BoundRect = pScrollbarVal->maButton2Rect; // secondary backward GtkArrowType button1Type; // backward GtkArrowType button2Type; // forward - gchar * scrollbarTagH = (gchar *) "hscrollbar"; - gchar * scrollbarTagV = (gchar *) "vscrollbar"; - gchar * scrollbarTag = NULL; - Rectangle arrowRect; + gchar * scrollbarTagH = (gchar *) "hscrollbar"; + gchar * scrollbarTagV = (gchar *) "vscrollbar"; + gchar * scrollbarTag = NULL; + Rectangle arrowRect; gint slider_width = 0; gint stepper_size = 0; gint stepper_spacing = 0; @@ -1478,12 +1546,6 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, // Make sure the thumb is at least the default width (so we don't get tiny thumbs), // but if the VCL gives us a size smaller than the theme's default thumb size, // honor the VCL size -#if 0 - if ( (thumbRect.GetWidth() < min_slider_length) - && ((scrollbarRect.GetWidth()-button1BoundRect.GetWidth()-button2BoundRect.GetWidth()) > min_slider_length) ) - thumbRect.SetSize( Size( min_slider_length, thumbRect.GetHeight() ) ); -#endif - thumbRect.Right() += magic; // Center vertically in the track thumbRect.Move( 0, (scrollbarRect.GetHeight() - slider_width) / 2 ); @@ -1525,14 +1587,6 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, button22BoundRect.SetSize( Size( slider_width, stepper_size ) ); thumbRect.Right() = thumbRect.Left() + slider_width - 1; -#if 0 - // Make sure the thumb is at least the default width (so we don't get tiny thumbs), - // but if the VCL gives us a size smaller than the theme's default thumb size, - // honor the VCL size - if ( (thumbRect.GetHeight() < min_slider_length) - && ((scrollbarRect.GetHeight()-button1BoundRect.GetHeight()-button2BoundRect.GetHeight()) > min_slider_length) ) - thumbRect.SetSize( Size( thumbRect.GetWidth(), min_slider_length ) ); -#endif thumbRect.Bottom() += magic; // Center horizontally in the track @@ -1578,8 +1632,12 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, NWSetWidgetState( gWidgetData[m_nScreen].gBtnWidget, nState, stateType ); style = GTK_WIDGET( scrollbarWidget )->style; + gtk_style_apply_default_background( m_pWindow->style, gdkDrawable, TRUE, + GTK_STATE_NORMAL, gdkRect, + x, y, w, h ); + // ----------------- TROUGH - gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, + gtk_paint_flat_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, gdkRect, m_pWindow, "base", x, y, w, h ); @@ -1610,7 +1668,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, if ( has_backward ) { NWConvertVCLStateToGTKState( pScrollbarVal->mnButton1State, &stateType, &shadowType ); - if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL; + if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL; gtk_paint_box( style, gdkDrawable, stateType, shadowType, gdkRect, GTK_WIDGET(scrollbarWidget), "stepper", x+hShim+button11BoundRect.Left(), y+vShim+button11BoundRect.Top(), @@ -1625,7 +1683,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, if ( has_forward2 ) { NWConvertVCLStateToGTKState( pScrollbarVal->mnButton2State, &stateType, &shadowType ); - if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL; + if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL; gtk_paint_box( style, gdkDrawable, stateType, shadowType, gdkRect, GTK_WIDGET(scrollbarWidget), "stepper", x+hShim+button12BoundRect.Left(), y+vShim+button12BoundRect.Top(), @@ -1641,7 +1699,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, if ( has_backward2 ) { NWConvertVCLStateToGTKState( pScrollbarVal->mnButton1State, &stateType, &shadowType ); - if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL; + if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL; gtk_paint_box( style, gdkDrawable, stateType, shadowType, gdkRect, GTK_WIDGET(scrollbarWidget), "stepper", x+hShim+button21BoundRect.Left(), y+vShim+button21BoundRect.Top(), @@ -1656,7 +1714,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, if ( has_forward ) { NWConvertVCLStateToGTKState( pScrollbarVal->mnButton2State, &stateType, &shadowType ); - if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL; + if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL; gtk_paint_box( style, gdkDrawable, stateType, shadowType, gdkRect, GTK_WIDGET(scrollbarWidget), "stepper", x+hShim+button22BoundRect.Left(), y+vShim+button22BoundRect.Top(), @@ -1681,7 +1739,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, //--- -static Rectangle NWGetScrollButtonRect( int nScreen, ControlPart nPart, Rectangle aAreaRect ) +static Rectangle NWGetScrollButtonRect( int nScreen, ControlPart nPart, Rectangle aAreaRect ) { gint slider_width; gint stepper_size; @@ -1772,7 +1830,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable, const ImplControlValue& aValue, const OUString& rCaption ) { - Rectangle pixmapRect; + Rectangle pixmapRect; GdkRectangle clipRect; // Find the overall bounding rect of the buttons's drawing area, @@ -1805,7 +1863,7 @@ static Rectangle NWGetEditBoxPixmapRect(int nScreen, const ImplControlValue&, const OUString& ) { - Rectangle pixmapRect = aAreaRect; + Rectangle pixmapRect = aAreaRect; gboolean interiorFocus; gint focusWidth; @@ -1813,8 +1871,8 @@ static Rectangle NWGetEditBoxPixmapRect(int nScreen, // Grab some entry style attributes gtk_widget_style_get( gWidgetData[nScreen].gEditBoxWidget, - "focus-line-width", &focusWidth, - "interior-focus", &interiorFocus, (char *)NULL ); + "focus-line-width", &focusWidth, + "interior-focus", &interiorFocus, (char *)NULL ); if ( !interiorFocus ) { @@ -1831,18 +1889,18 @@ static Rectangle NWGetEditBoxPixmapRect(int nScreen, * All coordinates should be local to the Pixmap, NOT * screen/window coordinates. */ -static void NWPaintOneEditBox( int nScreen, +static void NWPaintOneEditBox( int nScreen, GdkDrawable * gdkDrawable, - GdkRectangle * gdkRect, - ControlType nType, + GdkRectangle * gdkRect, + ControlType nType, ControlPart, - Rectangle aEditBoxRect, + Rectangle aEditBoxRect, ControlState nState, const ImplControlValue&, const OUString& ) { GtkStateType stateType; - GtkShadowType shadowType; + GtkShadowType shadowType; GtkWidget *widget; NWEnsureGTKButton( nScreen ); @@ -1852,10 +1910,6 @@ static void NWPaintOneEditBox( int nScreen, NWEnsureGTKScrolledWindow( nScreen ); NWConvertVCLStateToGTKState( nState, &stateType, &shadowType ); - /* border's shadowType for gtk entries is always GTK_SHADOW_IN (see gtkentry.c) - shadowType = GTK_SHADOW_IN; - */ - switch ( nType ) { case CTRL_SPINBOX: @@ -1887,6 +1941,9 @@ static void NWPaintOneEditBox( int nScreen, } NWSetWidgetState( widget, nState, stateType ); + /* This doesn't seem to be necessary, and it causes some weird glitch in + * murrine (with the elementary theme for instance) but it fixes some issue + * with Orta, so... */ gtk_paint_flat_box( pBGWidget->style, gdkDrawable, stateType, GTK_SHADOW_NONE, gdkRect, pBGWidget, "entry_bg", aEditBoxRect.Left(), aEditBoxRect.Top(), @@ -1909,16 +1966,16 @@ sal_Bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart const ImplControlValue& aValue, const OUString& rCaption ) { - GdkPixmap * pixmap; - Rectangle pixmapRect; + GdkPixmap * pixmap; + Rectangle pixmapRect; GtkStateType stateType; - GtkShadowType shadowType; - const SpinbuttonValue * pSpinVal = (aValue.getType() == CTRL_SPINBUTTONS) ? static_cast<const SpinbuttonValue *>(&aValue) : NULL; - Rectangle upBtnRect; - ControlPart upBtnPart = PART_BUTTON_UP; + GtkShadowType shadowType; + const SpinbuttonValue * pSpinVal = (aValue.getType() == CTRL_SPINBUTTONS) ? static_cast<const SpinbuttonValue *>(&aValue) : NULL; + Rectangle upBtnRect; + ControlPart upBtnPart = PART_BUTTON_UP; ControlState upBtnState = CTRL_STATE_ENABLED; - Rectangle downBtnRect; - ControlPart downBtnPart = PART_BUTTON_DOWN; + Rectangle downBtnRect; + ControlPart downBtnPart = PART_BUTTON_DOWN; ControlState downBtnState = CTRL_STATE_ENABLED; NWEnsureGTKButton( m_nScreen ); @@ -1974,7 +2031,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart if ( shadowType != GTK_SHADOW_NONE ) { - Rectangle shadowRect( upBtnRect ); + Rectangle shadowRect( upBtnRect ); shadowRect.Union( downBtnRect ); gtk_paint_box( gWidgetData[m_nScreen].gSpinButtonWidget->style, pixmap, GTK_STATE_NORMAL, shadowType, NULL, @@ -2000,14 +2057,14 @@ sal_Bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart static Rectangle NWGetSpinButtonRect( int nScreen, ControlType, - ControlPart nPart, + ControlPart nPart, Rectangle aAreaRect, ControlState, const ImplControlValue&, const OUString& ) { gint buttonSize; - Rectangle buttonRect; + Rectangle buttonRect; NWEnsureGTKSpinButton( nScreen ); @@ -2042,17 +2099,17 @@ static Rectangle NWGetSpinButtonRect( int nScreen, static void NWPaintOneSpinButton( int nScreen, GdkPixmap* pixmap, - ControlType nType, - ControlPart nPart, - Rectangle aAreaRect, - ControlState nState, - const ImplControlValue& aValue, - const OUString& rCaption ) -{ - Rectangle buttonRect; + ControlType nType, + ControlPart nPart, + Rectangle aAreaRect, + ControlState nState, + const ImplControlValue& aValue, + const OUString& rCaption ) +{ + Rectangle buttonRect; GtkStateType stateType; - GtkShadowType shadowType; - Rectangle arrowRect; + GtkShadowType shadowType; + Rectangle arrowRect; gint arrowSize; NWEnsureGTKSpinButton( nScreen ); @@ -2092,11 +2149,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, const ImplControlValue& aValue, const OUString& rCaption ) { - Rectangle pixmapRect; - Rectangle buttonRect; + Rectangle pixmapRect; + Rectangle buttonRect; GtkStateType stateType; - GtkShadowType shadowType; - Rectangle arrowRect; + GtkShadowType shadowType; + Rectangle arrowRect; gint x,y; GdkRectangle clipRect; @@ -2119,7 +2176,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, if( nPart == PART_BUTTON_DOWN ) buttonRect.Left() += 1; - Rectangle aEditBoxRect( pixmapRect ); + Rectangle aEditBoxRect( pixmapRect ); aEditBoxRect.SetSize( Size( pixmapRect.GetWidth() - buttonRect.GetWidth(), aEditBoxRect.GetHeight() ) ); #define ARROW_EXTENT 0.7 @@ -2140,7 +2197,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, nState, aValue, rCaption ); // Buttons must paint opaque since some themes have alpha-channel enabled buttons - gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, + gtk_paint_flat_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, &clipRect, m_pWindow, "base", x+(buttonRect.Left() - pixmapRect.Left()), y+(buttonRect.Top() - pixmapRect.Top()), @@ -2165,12 +2222,12 @@ sal_Bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, static Rectangle NWGetComboBoxButtonRect( int nScreen, ControlType, ControlPart nPart, - Rectangle aAreaRect, + Rectangle aAreaRect, ControlState, const ImplControlValue&, const OUString& ) { - Rectangle aButtonRect; + Rectangle aButtonRect; gint nArrowWidth; gint nButtonWidth; gint nFocusWidth; @@ -2180,8 +2237,8 @@ static Rectangle NWGetComboBoxButtonRect( int nScreen, // Grab some button style attributes gtk_widget_style_get( gWidgetData[nScreen].gDropdownWidget, - "focus-line-width", &nFocusWidth, - "focus-padding", &nFocusPad, (char *)NULL ); + "focus-line-width", &nFocusWidth, + "focus-padding", &nFocusPad, (char *)NULL ); nArrowWidth = MIN_ARROW_SIZE + (GTK_MISC(gWidgetData[nScreen].gArrowWidget)->xpad * 2); nButtonWidth = nArrowWidth + @@ -2225,11 +2282,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, const OUString& ) { OSL_ASSERT( nType != CTRL_TAB_ITEM || aValue.getType() == CTRL_TAB_ITEM ); - GdkPixmap * pixmap; - Rectangle pixmapRect; - Rectangle tabRect; + GdkPixmap * pixmap; + Rectangle pixmapRect; + Rectangle tabRect; GtkStateType stateType; - GtkShadowType shadowType; + GtkShadowType shadowType; if( ! gWidgetData[ m_nScreen ].gCacheTabItems ) { gWidgetData[ m_nScreen ].gCacheTabItems = new NWPixmapCache( m_nScreen ); @@ -2281,7 +2338,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, // Allow the tab to draw a right border if needed tabRect.Right() -= 1; - // #129732# avoid degenerate cases which might lead to crashes + // avoid degenerate cases which might lead to crashes if( tabRect.GetWidth() <= 1 || tabRect.GetHeight() <= 1 ) return false; } @@ -2297,9 +2354,6 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, return NWRenderPixmapToScreen( pixmap, pixmapRect ); } - -// gtk_widget_set_state( gWidgetData[m_nScreen].gNotebookWidget, stateType ); - pixmap = gdk_pixmap_new( NULL, pixmapRect.GetWidth(), pixmapRect.GetHeight(), GetX11SalData()->GetDisplay()->GetVisual( m_nScreen ).GetDepth() ); GdkRectangle paintRect; @@ -2332,8 +2386,8 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, if ( nState & CTRL_STATE_SELECTED ) { - gtk_paint_flat_box( gWidgetData[m_nScreen].gNotebookWidget->style, pixmap, stateType, GTK_SHADOW_NONE, NULL, m_pWindow, - (char *)"base", 0, (pixmapRect.GetHeight() - 1), pixmapRect.GetWidth(), 1 ); + gtk_paint_flat_box( m_pWindow->style, pixmap, stateType, GTK_SHADOW_NONE, NULL, m_pWindow, + "base", 0, (pixmapRect.GetHeight() - 1), pixmapRect.GetWidth(), 1 ); } break; @@ -2366,11 +2420,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable, const ImplControlValue& aValue, const OUString& rCaption ) { - Rectangle pixmapRect; - Rectangle widgetRect; - Rectangle aIndicatorRect; + Rectangle pixmapRect; + Rectangle widgetRect; + Rectangle aIndicatorRect; GtkStateType stateType; - GtkShadowType shadowType; + GtkShadowType shadowType; gint bInteriorFocus; gint nFocusLineWidth; gint nFocusPadding; @@ -2406,8 +2460,8 @@ sal_Bool GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable, if ( nPart != PART_WINDOW ) { gtk_widget_style_get( gWidgetData[m_nScreen].gOptionMenuWidget, - "interior_focus", &bInteriorFocus, - "focus_line_width", &nFocusLineWidth, + "interior_focus", &bInteriorFocus, + "focus_line_width", &nFocusLineWidth, "focus_padding", &nFocusPadding, (char *)NULL); } @@ -2422,7 +2476,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable, if ( nPart != PART_WINDOW ) { // Listboxes must paint opaque since some themes have alpha-channel enabled bodies - gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, + gtk_paint_flat_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, &clipRect, m_pWindow, "base", x, y, pixmapRect.GetWidth(), pixmapRect.GetHeight() ); gtk_paint_box( gWidgetData[m_nScreen].gOptionMenuWidget->style, gdkDrawable, stateType, shadowType, &clipRect, @@ -2458,10 +2512,10 @@ sal_Bool GtkSalGraphics::NWPaintGTKToolbar( const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - const OUString& ) + const OUString& string) { GtkStateType stateType; - GtkShadowType shadowType; + GtkShadowType shadowType; gint x, y, w, h; gint g_x=0, g_y=0, g_w=10, g_h=10; bool bPaintButton = true; @@ -2516,22 +2570,12 @@ sal_Bool GtkSalGraphics::NWPaintGTKToolbar( // handle button else if( nPart == PART_BUTTON ) { - bPaintButton = - (GTK_BUTTON(pButtonWidget)->relief != GTK_RELIEF_NONE) - || (nState & CTRL_STATE_PRESSED) + bPaintButton = (nState & CTRL_STATE_PRESSED) || (nState & CTRL_STATE_ROLLOVER); if( aValue.getTristateVal() == BUTTONVALUE_ON ) { - pButtonWidget = gWidgetData[m_nScreen].gToolbarToggleWidget; - shadowType = GTK_SHADOW_IN; - stateType = GTK_STATE_ACTIVE; - // special case stateType value for depressed toggle buttons - // cf. gtk+/gtk/gtktogglebutton.c (gtk_toggle_button_update_state) - if( (nState & (CTRL_STATE_ROLLOVER|CTRL_STATE_PRESSED)) ) - { - stateType = GTK_STATE_PRELIGHT; - shadowType = GTK_SHADOW_OUT; - } + if(!(nState & CTRL_STATE_ROLLOVER)) + nState |= CTRL_STATE_PRESSED; bPaintButton = true; } else @@ -2539,61 +2583,79 @@ sal_Bool GtkSalGraphics::NWPaintGTKToolbar( NWSetWidgetState( pButtonWidget, nState, stateType ); gtk_widget_ensure_style( pButtonWidget ); + if(bPaintButton) + NWPaintGTKButtonReal(pButtonWidget, gdkDrawable, 0, 0, rControlRectangle, rClipList, nState, aValue, string); } - for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it ) + if( nPart != PART_BUTTON ) { - clipRect.x = it->Left(); - clipRect.y = it->Top(); - clipRect.width = it->GetWidth(); - clipRect.height = it->GetHeight(); - - // draw toolbar - if( nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT ) + for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it ) { - gtk_paint_flat_box( gWidgetData[m_nScreen].gToolbarWidget->style, - gdkDrawable, - (GtkStateType)GTK_STATE_NORMAL, - GTK_SHADOW_NONE, - &clipRect, - gWidgetData[m_nScreen].gToolbarWidget, - "base", - x, y, w, h ); - gtk_paint_box( gWidgetData[m_nScreen].gToolbarWidget->style, - gdkDrawable, - stateType, - shadowType, - &clipRect, - gWidgetData[m_nScreen].gToolbarWidget, - "toolbar", - x, y, w, h ); - } - // draw grip - else if( nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT ) - { - gtk_paint_handle( gWidgetData[m_nScreen].gHandleBoxWidget->style, - gdkDrawable, - GTK_STATE_NORMAL, - GTK_SHADOW_OUT, - &clipRect, - gWidgetData[m_nScreen].gHandleBoxWidget, - "handlebox", - g_x, g_y, g_w, g_h, - nPart == PART_THUMB_HORZ ? - GTK_ORIENTATION_HORIZONTAL : - GTK_ORIENTATION_VERTICAL - ); - } - // draw button - else if( nPart == PART_BUTTON ) - { - if( bPaintButton ) + clipRect.x = it->Left(); + clipRect.y = it->Top(); + clipRect.width = it->GetWidth(); + clipRect.height = it->GetHeight(); + + // draw toolbar + if( nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT ) { - gtk_paint_box( pButtonWidget->style, gdkDrawable, + gtk_paint_flat_box( gWidgetData[m_nScreen].gToolbarWidget->style, + gdkDrawable, + (GtkStateType)GTK_STATE_NORMAL, + GTK_SHADOW_NONE, + &clipRect, + gWidgetData[m_nScreen].gToolbarWidget, + "base", + x, y, w, h ); + gtk_paint_box( gWidgetData[m_nScreen].gToolbarWidget->style, + gdkDrawable, stateType, shadowType, &clipRect, - pButtonWidget, "button", x, y, w, h ); + gWidgetData[m_nScreen].gToolbarWidget, + "toolbar", + x, y, w, h ); + } + // draw grip + else if( nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT ) + { + gtk_paint_handle( gWidgetData[m_nScreen].gHandleBoxWidget->style, + gdkDrawable, + GTK_STATE_NORMAL, + GTK_SHADOW_OUT, + &clipRect, + gWidgetData[m_nScreen].gHandleBoxWidget, + "handlebox", + g_x, g_y, g_w, g_h, + nPart == PART_THUMB_HORZ ? + GTK_ORIENTATION_HORIZONTAL : + GTK_ORIENTATION_VERTICAL + ); + } + else if(nPart == PART_SEPARATOR ) + { + gint separator_height, separator_width, wide_separators; + + gtk_widget_style_get (gWidgetData[m_nScreen].gVSeparator, + "wide-separators", &wide_separators, + "separator-width", &separator_width, + "separator-height", &separator_height, + NULL); + if (wide_separators) + gtk_paint_box (gWidgetData[m_nScreen].gVSeparator->style, gdkDrawable, + GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, + &clipRect, gWidgetData[m_nScreen].gVSeparator, "vseparator", + x + (w - separator_width) / 2, + y + 7, + separator_width, + h - 14); + else + gtk_paint_vline (gWidgetData[m_nScreen].gVSeparator->style, gdkDrawable, + GTK_STATE_NORMAL, + &clipRect, gWidgetData[m_nScreen].gVSeparator, "vseparator", + y + 7, + y + h - 7, + x + w/2 - 1); } } } @@ -2612,7 +2674,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKMenubar( const OUString& ) { GtkStateType stateType; - GtkShadowType shadowType; + GtkShadowType shadowType; GtkShadowType selected_shadow_type = GTK_SHADOW_OUT; gint x, y, w, h; GdkRectangle clipRect; @@ -2651,7 +2713,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKMenubar( if ( nState & CTRL_STATE_ENABLED ) GTK_WIDGET_SET_FLAGS( gWidgetData[m_nScreen].gMenubarWidget, GTK_SENSITIVE ); - // #118704# for translucent menubar styles paint background first + // for translucent menubar styles paint background first gtk_paint_flat_box( gWidgetData[m_nScreen].gMenubarWidget->style, gdkDrawable, GTK_STATE_NORMAL, @@ -2669,6 +2731,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKMenubar( "menubar", x, y, w, h ); } + else if( nPart == PART_MENU_ITEM ) { if( nState & (CTRL_STATE_SELECTED|CTRL_STATE_ROLLOVER) ) @@ -2697,12 +2760,13 @@ sal_Bool GtkSalGraphics::NWPaintGTKPopupMenu( const OUString& ) { // #i50745# gtk does not draw disabled menu entries (and crux theme - // even crashes), draw them using vcl functionality. - if( nPart == PART_MENU_ITEM && ! (nState & CTRL_STATE_ENABLED) ) - return sal_False; + // even crashes) in very old (Fedora Core 4 vintage) gtk's + if (gtk_major_version <= 2 && gtk_minor_version <= 8 && + nPart == PART_MENU_ITEM && ! (nState & CTRL_STATE_ENABLED) ) + return sal_True; GtkStateType stateType; - GtkShadowType shadowType; + GtkShadowType shadowType; GtkShadowType selected_shadow_type = GTK_SHADOW_OUT; gint x, y, w, h; GdkRectangle clipRect; @@ -2738,7 +2802,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKPopupMenu( if( nPart == PART_ENTIRE_CONTROL ) { - // #118704# for translucent menubar styles paint background first + // for translucent menubar styles paint background first gtk_paint_flat_box( gWidgetData[m_nScreen].gMenuWidget->style, gdkDrawable, GTK_STATE_NORMAL, @@ -2813,6 +2877,42 @@ sal_Bool GtkSalGraphics::NWPaintGTKPopupMenu( x, y, w, h ); } } + else if( nPart == PART_MENU_SEPARATOR ) + { + gtk_paint_hline( gWidgetData[m_nScreen].gMenuItemSeparatorMenuWidget->style, + gdkDrawable, + GTK_STATE_NORMAL, + &clipRect, + gWidgetData[m_nScreen].gMenuItemSeparatorMenuWidget, + "menuitem", + x, x + w, y + h / 2); + } + else if( nPart == PART_MENU_SUBMENU_ARROW ) + { + GtkStateType nStateType = GTK_STATE_NORMAL; + GtkShadowType nShadowType; + + if ( nState & CTRL_STATE_SELECTED ) + nStateType = GTK_STATE_PRELIGHT; + + NWSetWidgetState( gWidgetData[m_nScreen].gMenuItemMenuWidget, + nState, nStateType ); + + if ( nState & CTRL_STATE_PRESSED ) + nShadowType = GTK_SHADOW_IN; + else + nShadowType = GTK_SHADOW_OUT; + + gtk_paint_arrow( gWidgetData[m_nScreen].gMenuItemMenuWidget->style, + gdkDrawable, + nStateType, + nShadowType, + &clipRect, + gWidgetData[m_nScreen].gMenuItemMenuWidget, + "menuitem", + GTK_ARROW_RIGHT, TRUE, + x, y, w, h); + } } return( sal_True ); @@ -2876,7 +2976,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKListNode( h = aRect.GetHeight(); GtkStateType stateType; - GtkShadowType shadowType; + GtkShadowType shadowType; NWConvertVCLStateToGTKState( nState, &stateType, &shadowType ); ButtonValue aButtonValue = rValue.getTristateVal(); @@ -3056,43 +3156,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKSlider( slider_width, slider_length, eOri ); } - #if 0 - // paint background - gtk_paint_flat_box( gWidgetData[m_nScreen].gProgressBar->style, - pixDrawable, - GTK_STATE_NORMAL, - GTK_SHADOW_NONE, - NULL, - gWidgetData[m_nScreen].gProgressBar, - "trough", - 0, 0, w, h ); - if( nProgressWidth > 0 ) - { - // paint progress - if( Application::GetSettings().GetLayoutRTL() ) - { - gtk_paint_box( gWidgetData[m_nScreen].gProgressBar->style, - pixDrawable, - GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, - NULL, - gWidgetData[m_nScreen].gProgressBar, - "bar", - w-nProgressWidth, 0, nProgressWidth, h - ); - } - else - { - gtk_paint_box( gWidgetData[m_nScreen].gProgressBar->style, - pixDrawable, - GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, - NULL, - gWidgetData[m_nScreen].gProgressBar, - "bar", - 0, 0, nProgressWidth, h - ); - } - } - #endif + sal_Bool bRet = NWRenderPixmapToScreen( pixmap, rControlRectangle ); g_object_unref( pixmap ); @@ -3113,15 +3177,15 @@ static Rectangle NWGetListBoxButtonRect( int nScreen, Rectangle aPartRect; GtkRequisition *pIndicatorSize = NULL; GtkBorder *pIndicatorSpacing = NULL; - gint width = 13; // GTK+ default - gint right = 5; // GTK+ default + gint width = 13; // GTK+ default + gint right = 5; // GTK+ default gint nButtonAreaWidth = 0; gint xthickness = 0; NWEnsureGTKOptionMenu( nScreen ); gtk_widget_style_get( gWidgetData[nScreen].gOptionMenuWidget, - "indicator_size", &pIndicatorSize, + "indicator_size", &pIndicatorSize, "indicator_spacing",&pIndicatorSpacing, (char *)NULL); if ( pIndicatorSize ) @@ -3167,7 +3231,7 @@ static Rectangle NWGetListBoxButtonRect( int nScreen, static Rectangle NWGetListBoxIndicatorRect( int nScreen, ControlType, ControlPart, - Rectangle aAreaRect, + Rectangle aAreaRect, ControlState, const ImplControlValue&, const OUString& ) @@ -3175,14 +3239,14 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen, Rectangle aIndicatorRect; GtkRequisition *pIndicatorSize = NULL; GtkBorder *pIndicatorSpacing = NULL; - gint width = 13; // GTK+ default + gint width = 13; // GTK+ default gint height = 13; // GTK+ default - gint right = 5; // GTK+ default + gint right = 5; // GTK+ default NWEnsureGTKOptionMenu( nScreen ); gtk_widget_style_get( gWidgetData[nScreen].gOptionMenuWidget, - "indicator_size", &pIndicatorSize, + "indicator_size", &pIndicatorSize, "indicator_spacing",&pIndicatorSpacing, (char *)NULL); if ( pIndicatorSize ) @@ -3212,8 +3276,8 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen, static Rectangle NWGetToolbarRect( int nScreen, ControlType, - ControlPart nPart, - Rectangle aAreaRect, + ControlPart nPart, + Rectangle aAreaRect, ControlState, const ImplControlValue&, const OUString& ) @@ -3290,6 +3354,12 @@ void printStyleColors( GtkStyle* pStyle ) void GtkSalGraphics::updateSettings( AllSettings& rSettings ) { + GdkScreen* pScreen = gtk_widget_get_screen( m_pWindow ); + gtk_widget_ensure_style( m_pWindow ); + GtkStyle* pStyle = gtk_widget_get_style( m_pWindow ); + GtkSettings* pSettings = gtk_widget_get_settings( m_pWindow ); + StyleSettings aStyleSet = rSettings.GetStyleSettings(); + // get the widgets in place NWEnsureGTKMenu( m_nScreen ); NWEnsureGTKMenubar( m_nScreen ); @@ -3297,11 +3367,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) NWEnsureGTKEditBox( m_nScreen ); NWEnsureGTKTooltip( m_nScreen ); - gtk_widget_ensure_style( m_pWindow ); - GtkStyle* pStyle = gtk_widget_get_style( m_pWindow ); - - StyleSettings aStyleSet = rSettings.GetStyleSettings(); - #if OSL_DEBUG_LEVEL > 2 printStyleColors( pStyle ); #endif @@ -3336,19 +3401,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetWorkspaceColor( aBackColor ); aStyleSet.SetFieldColor( aBackFieldColor ); aStyleSet.SetWindowColor( aBackFieldColor ); -// aStyleSet.SetHelpColor( aBackColor ); - // ancient wisdom tells us a mystic algorithm how to set checked color - if( aBackColor == COL_LIGHTGRAY ) - aStyleSet.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - Color aColor2 = aStyleSet.GetLightColor(); - Color aCheck( (sal_uInt8)(((sal_uInt16)aBackColor.GetRed()+(sal_uInt16)aColor2.GetRed())/2), - (sal_uInt8)(((sal_uInt16)aBackColor.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), - (sal_uInt8)(((sal_uInt16)aBackColor.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) - ); - aStyleSet.SetCheckedColor( aCheck ); - } + aStyleSet.SetCheckedColorSpecialCase( ); // highlighting colors Color aHighlightColor = getColor( pStyle->base[GTK_STATE_SELECTED] ); @@ -3382,6 +3435,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) // menu disabled entries handling aStyleSet.SetSkipDisabledInMenus( sal_True ); + aStyleSet.SetAcceleratorsInContextMenus( sal_False ); // menu colors GtkStyle* pMenuStyle = gtk_widget_get_style( gWidgetData[m_nScreen].gMenuWidget ); GtkStyle* pMenuItemStyle = gtk_rc_get_style( gWidgetData[m_nScreen].gMenuItemMenuWidget ); @@ -3431,10 +3485,10 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetMenuHighlightTextColor( aHighlightTextColor ); // UI font - OString aFamily = pango_font_description_get_family( pStyle->font_desc ); + OString aFamily = pango_font_description_get_family( pStyle->font_desc ); int nPangoHeight = pango_font_description_get_size( pStyle->font_desc ); - PangoStyle eStyle = pango_font_description_get_style( pStyle->font_desc ); - PangoWeight eWeight = pango_font_description_get_weight( pStyle->font_desc ); + PangoStyle eStyle = pango_font_description_get_style( pStyle->font_desc ); + PangoWeight eWeight = pango_font_description_get_weight( pStyle->font_desc ); PangoStretch eStretch = pango_font_description_get_stretch( pStyle->font_desc ); psp::FastPrintFontInfo aInfo; @@ -3443,33 +3497,33 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) // set italic switch( eStyle ) { - case PANGO_STYLE_NORMAL: aInfo.m_eItalic = psp::italic::Upright;break; - case PANGO_STYLE_ITALIC: aInfo.m_eItalic = psp::italic::Italic;break; - case PANGO_STYLE_OBLIQUE: aInfo.m_eItalic = psp::italic::Oblique;break; + case PANGO_STYLE_NORMAL: aInfo.m_eItalic = ITALIC_NONE;break; + case PANGO_STYLE_ITALIC: aInfo.m_eItalic = ITALIC_NORMAL;break; + case PANGO_STYLE_OBLIQUE: aInfo.m_eItalic = ITALIC_OBLIQUE;break; } // set weight if( eWeight <= PANGO_WEIGHT_ULTRALIGHT ) - aInfo.m_eWeight = psp::weight::UltraLight; + aInfo.m_eWeight = WEIGHT_ULTRALIGHT; else if( eWeight <= PANGO_WEIGHT_LIGHT ) - aInfo.m_eWeight = psp::weight::Light; + aInfo.m_eWeight = WEIGHT_LIGHT; else if( eWeight <= PANGO_WEIGHT_NORMAL ) - aInfo.m_eWeight = psp::weight::Normal; + aInfo.m_eWeight = WEIGHT_NORMAL; else if( eWeight <= PANGO_WEIGHT_BOLD ) - aInfo.m_eWeight = psp::weight::Bold; + aInfo.m_eWeight = WEIGHT_BOLD; else - aInfo.m_eWeight = psp::weight::UltraBold; + aInfo.m_eWeight = WEIGHT_ULTRABOLD; // set width switch( eStretch ) { - case PANGO_STRETCH_ULTRA_CONDENSED: aInfo.m_eWidth = psp::width::UltraCondensed;break; - case PANGO_STRETCH_EXTRA_CONDENSED: aInfo.m_eWidth = psp::width::ExtraCondensed;break; - case PANGO_STRETCH_CONDENSED: aInfo.m_eWidth = psp::width::Condensed;break; - case PANGO_STRETCH_SEMI_CONDENSED: aInfo.m_eWidth = psp::width::SemiCondensed;break; - case PANGO_STRETCH_NORMAL: aInfo.m_eWidth = psp::width::Normal;break; - case PANGO_STRETCH_SEMI_EXPANDED: aInfo.m_eWidth = psp::width::SemiExpanded;break; - case PANGO_STRETCH_EXPANDED: aInfo.m_eWidth = psp::width::Expanded;break; - case PANGO_STRETCH_EXTRA_EXPANDED: aInfo.m_eWidth = psp::width::ExtraExpanded;break; - case PANGO_STRETCH_ULTRA_EXPANDED: aInfo.m_eWidth = psp::width::UltraExpanded;break; + case PANGO_STRETCH_ULTRA_CONDENSED: aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED;break; + case PANGO_STRETCH_EXTRA_CONDENSED: aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED;break; + case PANGO_STRETCH_CONDENSED: aInfo.m_eWidth = WIDTH_CONDENSED;break; + case PANGO_STRETCH_SEMI_CONDENSED: aInfo.m_eWidth = WIDTH_SEMI_CONDENSED;break; + case PANGO_STRETCH_NORMAL: aInfo.m_eWidth = WIDTH_NORMAL;break; + case PANGO_STRETCH_SEMI_EXPANDED: aInfo.m_eWidth = WIDTH_SEMI_EXPANDED;break; + case PANGO_STRETCH_EXPANDED: aInfo.m_eWidth = WIDTH_EXPANDED;break; + case PANGO_STRETCH_EXTRA_EXPANDED: aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED;break; + case PANGO_STRETCH_ULTRA_EXPANDED: aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED;break; } #if OSL_DEBUG_LEVEL > 1 @@ -3496,19 +3550,17 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) nPointHeight = nPangoHeight/PANGO_SCALE; Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) ); - if( aInfo.m_eWeight != psp::weight::Unknown ) - aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) ); - if( aInfo.m_eWidth != psp::width::Unknown ) - aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) ); - if( aInfo.m_eItalic != psp::italic::Unknown ) - aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) ); - if( aInfo.m_ePitch != psp::pitch::Unknown ) - aFont.SetPitch( PspGraphics::ToFontPitch( aInfo.m_ePitch ) ); + if( aInfo.m_eWeight != WEIGHT_DONTKNOW ) + aFont.SetWeight( aInfo.m_eWeight ); + if( aInfo.m_eWidth != WIDTH_DONTKNOW ) + aFont.SetWidthType( aInfo.m_eWidth ); + if( aInfo.m_eItalic != ITALIC_DONTKNOW ) + aFont.SetItalic( aInfo.m_eItalic ); + if( aInfo.m_ePitch != PITCH_DONTKNOW ) + aFont.SetPitch( aInfo.m_ePitch ); aStyleSet.SetAppFont( aFont ); aStyleSet.SetHelpFont( aFont ); - aStyleSet.SetTitleFont( aFont ); - aStyleSet.SetFloatTitleFont( aFont ); aStyleSet.SetMenuFont( aFont ); aStyleSet.SetToolFont( aFont ); aStyleSet.SetLabelFont( aFont ); @@ -3519,8 +3571,11 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetIconFont( aFont ); aStyleSet.SetGroupFont( aFont ); + aFont.SetWeight( WEIGHT_BOLD ); + aStyleSet.SetTitleFont( aFont ); + aStyleSet.SetFloatTitleFont( aFont ); + // get cursor blink time - GtkSettings *pSettings = gtk_widget_get_settings( gWidgetData[m_nScreen].gEditBoxWidget ); gboolean blink = false; g_object_get( pSettings, "gtk-cursor-blink", &blink, (char *)NULL ); @@ -3536,10 +3591,25 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) else aStyleSet.SetCursorBlinkTime( STYLE_CURSOR_NOBLINKTIME ); + MouseSettings aMouseSettings = rSettings.GetMouseSettings(); + int iDoubleClickTime, iDoubleClickDistance, iDragThreshold, iMenuPopupDelay; + g_object_get( pSettings, + "gtk-double-click-time", &iDoubleClickTime, + "gtk-double-click-distance", &iDoubleClickDistance, + "gtk-dnd-drag-threshold", &iDragThreshold, + "gtk-menu-popup-delay", &iMenuPopupDelay, + (char *)NULL ); + aMouseSettings.SetDoubleClickTime( iDoubleClickTime ); + aMouseSettings.SetDoubleClickWidth( iDoubleClickDistance ); + aMouseSettings.SetDoubleClickHeight( iDoubleClickDistance ); + aMouseSettings.SetStartDragWidth( iDragThreshold ); + aMouseSettings.SetStartDragHeight( iDragThreshold ); + aMouseSettings.SetMenuDelay( iMenuPopupDelay ); + rSettings.SetMouseSettings( aMouseSettings ); + gboolean showmenuicons = true; - pSettings = gtk_widget_get_settings( gWidgetData[m_nScreen].gImageMenuItem ); g_object_get( pSettings, "gtk-menu-images", &showmenuicons, (char *)NULL ); - aStyleSet.SetUseImagesInMenus( showmenuicons ); + aStyleSet.SetPreferredUseImagesInMenus( showmenuicons ); // set scrollbar settings gint slider_width = 14; @@ -3558,47 +3628,29 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) // preferred icon style gchar* pIconThemeName = NULL; - g_object_get( gtk_settings_get_default(), "gtk-icon-theme-name", &pIconThemeName, (char *)NULL ); + g_object_get( pSettings, "gtk-icon-theme-name", &pIconThemeName, (char *)NULL ); aStyleSet.SetPreferredSymbolsStyleName( OUString::createFromAscii( pIconThemeName ) ); g_free( pIconThemeName ); - // FIXME: need some way of fetching toolbar icon size. -// aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_SMALL ); + aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_LARGE ); const cairo_font_options_t* pNewOptions = NULL; - if( GdkScreen* pScreen = gdk_display_get_screen( gdk_display_get_default(), m_nScreen ) ) - { -//#if !GTK_CHECK_VERSION(2,8,1) #if !GTK_CHECK_VERSION(2,9,0) static cairo_font_options_t* (*gdk_screen_get_font_options)(GdkScreen*) = (cairo_font_options_t*(*)(GdkScreen*))osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_font_options" ); if( gdk_screen_get_font_options != NULL ) #endif pNewOptions = gdk_screen_get_font_options( pScreen ); - } aStyleSet.SetCairoFontOptions( pNewOptions ); // finally update the collected settings rSettings.SetStyleSettings( aStyleSet ); + gchar* pThemeName = NULL; + g_object_get( pSettings, "gtk-theme-name", &pThemeName, (char *)NULL ); #if OSL_DEBUG_LEVEL > 1 - { - GtkSettings* pGtkSettings = gtk_settings_get_default(); - GValue aValue; - memset( &aValue, 0, sizeof(GValue) ); - g_value_init( &aValue, G_TYPE_STRING ); - g_object_get_property( G_OBJECT(pGtkSettings), "gtk-theme-name", &aValue ); - const gchar* pThemeName = g_value_get_string( &aValue ); - std::fprintf( stderr, "Theme name is \"%s\"\n", pThemeName ); - g_value_unset( &aValue ); - } + std::fprintf( stderr, "Theme name is \"%s\"\n", pThemeName ); #endif - GtkSettings* pGtkSettings = gtk_settings_get_default(); - GValue aValue; - memset( &aValue, 0, sizeof(GValue) ); - g_value_init( &aValue, G_TYPE_STRING ); - g_object_get_property( G_OBJECT(pGtkSettings), "gtk-theme-name", &aValue ); - const gchar* pThemeName = g_value_get_string( &aValue ); // default behaviour bNeedPixmapPaint = bGlobalNeedPixmapPaint; @@ -3623,7 +3675,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) } } // clean up - g_value_unset( &aValue ); + g_free (pThemeName); } @@ -3634,8 +3686,8 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) GdkPixmap* GtkSalGraphics::NWGetPixmapFromScreen( Rectangle srcRect ) { // Create a new pixmap to hold the composite of the window background and the control - GdkPixmap * pPixmap = gdk_pixmap_new( GDK_DRAWABLE(GetGdkWindow()), srcRect.GetWidth(), srcRect.GetHeight(), -1 ); - GdkGC * pPixmapGC = gdk_gc_new( pPixmap ); + GdkPixmap * pPixmap = gdk_pixmap_new( GDK_DRAWABLE(GetGdkWindow()), srcRect.GetWidth(), srcRect.GetHeight(), -1 ); + GdkGC * pPixmapGC = gdk_gc_new( pPixmap ); if( !pPixmap || !pPixmapGC ) { @@ -3934,8 +3986,9 @@ static void NWEnsureGTKToolbar( int nScreen ) { gWidgetData[nScreen].gToolbarWidget = gtk_toolbar_new(); NWAddWidgetToCacheWindow( gWidgetData[nScreen].gToolbarWidget, nScreen ); - gWidgetData[nScreen].gToolbarButtonWidget = gtk_button_new(); - gWidgetData[nScreen].gToolbarToggleWidget = gtk_toggle_button_new(); + gWidgetData[nScreen].gToolbarButtonWidget = GTK_WIDGET(gtk_button_new()); + gWidgetData[nScreen].gVSeparator = GTK_WIDGET(gtk_separator_tool_item_new()); + NWAddWidgetToCacheWindow( gWidgetData[nScreen].gVSeparator, nScreen ); GtkReliefStyle aRelief = GTK_RELIEF_NORMAL; gtk_widget_ensure_style( gWidgetData[nScreen].gToolbarWidget ); @@ -3948,10 +4001,6 @@ static void NWEnsureGTKToolbar( int nScreen ) GTK_WIDGET_UNSET_FLAGS( gWidgetData[nScreen].gToolbarButtonWidget, GTK_CAN_DEFAULT ); NWAddWidgetToCacheWindow( gWidgetData[nScreen].gToolbarButtonWidget, nScreen ); - gtk_button_set_relief( GTK_BUTTON(gWidgetData[nScreen].gToolbarToggleWidget), aRelief ); - GTK_WIDGET_UNSET_FLAGS( gWidgetData[nScreen].gToolbarToggleWidget, GTK_CAN_FOCUS ); - GTK_WIDGET_UNSET_FLAGS( gWidgetData[nScreen].gToolbarToggleWidget, GTK_CAN_DEFAULT ); - NWAddWidgetToCacheWindow( gWidgetData[nScreen].gToolbarToggleWidget, nScreen ); } if( ! gWidgetData[nScreen].gHandleBoxWidget ) { @@ -3985,15 +4034,17 @@ static void NWEnsureGTKMenu( int nScreen ) { if( !gWidgetData[nScreen].gMenuWidget ) { - gWidgetData[nScreen].gMenuWidget = gtk_menu_new(); - gWidgetData[nScreen].gMenuItemMenuWidget = gtk_menu_item_new_with_label( "b" ); - gWidgetData[nScreen].gMenuItemCheckMenuWidget = gtk_check_menu_item_new_with_label( "b" ); - gWidgetData[nScreen].gMenuItemRadioMenuWidget = gtk_radio_menu_item_new_with_label( NULL, "b" ); - gWidgetData[nScreen].gImageMenuItem = gtk_image_menu_item_new(); + gWidgetData[nScreen].gMenuWidget = gtk_menu_new(); + gWidgetData[nScreen].gMenuItemMenuWidget = gtk_menu_item_new_with_label( "b" ); + gWidgetData[nScreen].gMenuItemCheckMenuWidget = gtk_check_menu_item_new_with_label( "b" ); + gWidgetData[nScreen].gMenuItemRadioMenuWidget = gtk_radio_menu_item_new_with_label( NULL, "b" ); + gWidgetData[nScreen].gMenuItemSeparatorMenuWidget = gtk_menu_item_new(); + gWidgetData[nScreen].gImageMenuItem = gtk_image_menu_item_new(); gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemMenuWidget ); gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemCheckMenuWidget ); gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemRadioMenuWidget ); + gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemSeparatorMenuWidget ); gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gImageMenuItem ); // do what NWAddWidgetToCacheWindow does except adding to def container @@ -4009,6 +4060,9 @@ static void NWEnsureGTKMenu( int nScreen ) gtk_widget_realize( gWidgetData[nScreen].gMenuItemRadioMenuWidget ); gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemRadioMenuWidget ); + gtk_widget_realize( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget ); + gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget ); + gtk_widget_realize( gWidgetData[nScreen].gImageMenuItem ); gtk_widget_ensure_style( gWidgetData[nScreen].gImageMenuItem ); @@ -4016,6 +4070,7 @@ static void NWEnsureGTKMenu( int nScreen ) gWidgetDefaultFlags[ (long)gWidgetData[nScreen].gMenuItemMenuWidget ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemMenuWidget ); gWidgetDefaultFlags[ (long)gWidgetData[nScreen].gMenuItemCheckMenuWidget ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemCheckMenuWidget ); gWidgetDefaultFlags[ (long)gWidgetData[nScreen].gMenuItemRadioMenuWidget ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemRadioMenuWidget ); + gWidgetDefaultFlags[ (long)gWidgetData[nScreen].gMenuItemSeparatorMenuWidget ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget ); gWidgetDefaultFlags[ (long)gWidgetData[nScreen].gImageMenuItem ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gImageMenuItem ); } } @@ -4065,3 +4120,5 @@ static void NWEnsureGTKSlider( int nScreen ) NWAddWidgetToCacheWindow( gWidgetData[nScreen].gVScale, nScreen ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 5f4a2bda25f8..8c151e782153 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,6 +51,7 @@ #include <vcl/bitmapex.hxx> #include <impbmp.hxx> #include <svids.hrc> +#include <sal/macros.h> #include <algorithm> @@ -63,6 +65,10 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> +#if GTK_CHECK_VERSION(3,0,0) +# include <gdk/gdkkeysyms-compat.h> +#endif + #ifdef ENABLE_DBUS #include <dbus/dbus-glib.h> @@ -78,6 +84,14 @@ #define GDK_META_MASK (1 << 28) #endif +#if GTK_CHECK_VERSION(3,0,0) +#define IS_WIDGET_REALIZED gtk_widget_get_realized +#define IS_WIDGET_MAPPED gtk_widget_get_mapped +#else +#define IS_WIDGET_REALIZED GTK_WIDGET_REALIZED +#define IS_WIDGET_MAPPED GTK_WIDGET_MAPPED +#endif + using namespace com::sun::star; int GtkSalFrame::m_nFloats = 0; @@ -210,6 +224,9 @@ static sal_uInt16 GetKeyCode( guint keyval ) case GDK_asciitilde: nCode = KEY_TILDE; break; case GDK_leftsinglequotemark: case GDK_quoteleft: nCode = KEY_QUOTELEFT; break; + case GDK_bracketleft: nCode = KEY_BRACKETLEFT; break; + case GDK_bracketright: nCode = KEY_BRACKETRIGHT; break; + case GDK_semicolon: nCode = KEY_SEMICOLON; break; // some special cases, also see saldisp.cxx // - - - - - - - - - - - - - Apollo - - - - - - - - - - - - - 0x1000 case 0x1000FF02: // apXK_Copy @@ -413,7 +430,7 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData ) GtkSalFrame::~GtkSalFrame() { - for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); ++i ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); ++i ) { if( !m_aGraphics[i].pGraphics ) continue; @@ -427,12 +444,18 @@ GtkSalFrame::~GtkSalFrame() getDisplay()->deregisterFrame( this ); if( m_pRegion ) + { +#if GTK_CHECK_VERSION(3,0,0) + cairo_region_destroy( m_pRegion ); +#else gdk_region_destroy( m_pRegion ); +#endif + } if( m_hBackgroundPixmap ) { XSetWindowBackgroundPixmap( getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW(m_pWindow->window), + GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), None ); XFreePixmap( getDisplay()->GetDisplay(), m_hBackgroundPixmap ); } @@ -533,7 +556,11 @@ void GtkSalFrame::InitCommon() g_signal_connect( G_OBJECT(m_pWindow), "style-set", G_CALLBACK(signalStyleSet), this ); g_signal_connect( G_OBJECT(m_pWindow), "button-press-event", G_CALLBACK(signalButton), this ); g_signal_connect( G_OBJECT(m_pWindow), "button-release-event", G_CALLBACK(signalButton), this ); +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect( G_OBJECT(m_pWindow), "draw", G_CALLBACK(signalDraw), this ); +#else g_signal_connect( G_OBJECT(m_pWindow), "expose-event", G_CALLBACK(signalExpose), this ); +#endif g_signal_connect( G_OBJECT(m_pWindow), "focus-in-event", G_CALLBACK(signalFocus), this ); g_signal_connect( G_OBJECT(m_pWindow), "focus-out-event", G_CALLBACK(signalFocus), this ); g_signal_connect( G_OBJECT(m_pWindow), "map-event", G_CALLBACK(signalMap), this ); @@ -553,7 +580,6 @@ void GtkSalFrame::InitCommon() // init members m_pCurrentCursor = NULL; m_nKeyModifiers = 0; - m_bSingleAltPress = false; m_bFullscreen = false; m_nState = GDK_WINDOW_STATE_WITHDRAWN; m_nVisibility = GDK_VISIBILITY_FULLY_OBSCURED; @@ -591,7 +617,7 @@ void GtkSalFrame::InitCommon() SalDisplay* pDisp = GetX11SalData()->GetDisplay(); m_aSystemData.nSize = sizeof( SystemChildData ); m_aSystemData.pDisplay = pDisp->GetDisplay(); - m_aSystemData.aWindow = GDK_WINDOW_XWINDOW(m_pWindow->window); + m_aSystemData.aWindow = GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)); m_aSystemData.pSalFrame = this; m_aSystemData.pWidget = m_pWindow; m_aSystemData.pVisual = pDisp->GetVisual( m_nScreen ).GetVisual(); @@ -643,7 +669,7 @@ void GtkSalFrame::InitCommon() * some paint issues */ XSetWindowBackgroundPixmap( getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW(m_pWindow->window), + GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), m_hBackgroundPixmap ); } @@ -677,7 +703,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe else if( ! bBeforeRealize ) { Display* pDisplay = GetX11SalData()->GetDisplay()->GetDisplay(); - XLIB_Window aWindow = GDK_WINDOW_XWINDOW( GTK_WIDGET(pWindow)->window ); + XLIB_Window aWindow = GDK_WINDOW_XWINDOW( widget_get_window(GTK_WIDGET(pWindow)) ); XWMHints* pHints = XGetWMHints( pDisplay, aWindow ); if( ! pHints ) { @@ -792,6 +818,8 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle ) // force wm class hint m_nExtStyle = ~0; + if (m_pParent) + m_sWMClass = m_pParent->m_sWMClass; SetExtendedFrameStyle( 0 ); if( m_pParent && m_pParent->m_pWindow && ! isChild() ) @@ -860,9 +888,8 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle ) { /* #i99360# ugly workaround an X11 library bug */ nUserTime= getDisplay()->GetLastUserEventTime( true ); - // nUserTime = gdk_x11_get_server_time(GTK_WIDGET (m_pWindow)->window); } - lcl_set_user_time(GTK_WIDGET(m_pWindow)->window, nUserTime); + lcl_set_user_time(widget_get_window(GTK_WIDGET(m_pWindow)), nUserTime); } if( bDecoHandling ) @@ -914,9 +941,14 @@ void GtkSalFrame::Init( SystemParentData* pSysData ) if( pSysData->nSize > sizeof(pSysData->nSize)+sizeof(pSysData->aWindow) && pSysData->bXEmbedSupport ) { +#if GTK_CHECK_VERSION(3,0,0) + m_pWindow = gtk_plug_new_for_display( getGdkDisplay(), pSysData->aWindow ); +#else m_pWindow = gtk_plug_new( pSysData->aWindow ); +#endif m_bWindowIsGtkPlug = true; - GTK_WIDGET_SET_FLAGS( m_pWindow, GTK_CAN_FOCUS | GTK_SENSITIVE | GTK_CAN_DEFAULT ); + widget_set_can_default( m_pWindow, true ); + widget_set_can_focus( m_pWindow, true ); gtk_widget_set_sensitive( m_pWindow, true ); } else @@ -941,7 +973,7 @@ void GtkSalFrame::Init( SystemParentData* pSysData ) if( ! m_bWindowIsGtkPlug ) { XReparentWindow( getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW(m_pWindow->window), + GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), (XLIB_Window)pSysData->aWindow, 0, 0 ); } @@ -975,25 +1007,10 @@ void GtkSalFrame::SetExtendedFrameStyle( SalExtStyle nStyle ) if( nStyle != m_nExtStyle && ! isChild() ) { m_nExtStyle = nStyle; - if( GTK_WIDGET_REALIZED( m_pWindow ) ) - { - XClassHint* pClass = XAllocClassHint(); - rtl::OString aResHint = X11SalData::getFrameResName( m_nExtStyle ); - pClass->res_name = const_cast<char*>(aResHint.getStr()); - pClass->res_class = const_cast<char*>(X11SalData::getFrameClassName()); - XSetClassHint( getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW(m_pWindow->window), - pClass ); - XFree( pClass ); - } - else - gtk_window_set_wmclass( GTK_WINDOW(m_pWindow), - X11SalData::getFrameResName( m_nExtStyle ), - X11SalData::getFrameClassName() ); + updateWMClass(); } } - SalGraphics* GtkSalFrame::GetGraphics() { if( m_pWindow ) @@ -1005,8 +1022,8 @@ SalGraphics* GtkSalFrame::GetGraphics() m_aGraphics[i].bInUse = true; if( ! m_aGraphics[i].pGraphics ) { - m_aGraphics[i].pGraphics = new GtkSalGraphics( m_pWindow ); - m_aGraphics[i].pGraphics->Init( this, GDK_WINDOW_XWINDOW(m_pWindow->window), m_nScreen ); + m_aGraphics[i].pGraphics = new GtkSalGraphics( this, m_pWindow ); + m_aGraphics[i].pGraphics->Init( this, GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), m_nScreen ); } return m_aGraphics[i].pGraphics; } @@ -1121,13 +1138,6 @@ void GtkSalFrame::SetIcon( sal_uInt16 nIcon ) sal_uInt16 nOffsets[2] = { SV_ICON_SMALL_START, SV_ICON_LARGE_START }; sal_uInt16 nIndex; - // Use high contrast icons where appropriate - if( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) - { - nOffsets[0] = SV_ICON_LARGE_HC_START; - nOffsets[1] = SV_ICON_SMALL_HC_START; - } - for( nIndex = 0; nIndex < sizeof(nOffsets)/ sizeof(sal_uInt16); nIndex++ ) { // #i44723# workaround gcc temporary problem @@ -1158,7 +1168,7 @@ void GtkSalFrame::SetIcon( sal_uInt16 nIcon ) aMask = AlphaMask( aIcon.GetMask() ); break; default: - DBG_ERROR( "unhandled transparent type" ); + OSL_FAIL( "unhandled transparent type" ); break; } } @@ -1278,12 +1288,12 @@ void GtkSalFrame::SetDefaultSize() static void initClientId() { static bool bOnce = false; - if( ! bOnce ) + if (!bOnce) { bOnce = true; - const ByteString& rID = SessionManagerClient::getSessionID(); - if( rID.Len() > 0 ) - gdk_set_sm_client_id(rID.GetBuffer()); + const rtl::OString& rID = SessionManagerClient::getSessionID(); + if (!rID.isEmpty()) + gdk_set_sm_client_id(rID.getStr()); } } @@ -1296,7 +1306,6 @@ void GtkSalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), bVisible ); if( bVisible ) { - SessionManagerClient::open(); // will simply return after the first time initClientId(); getDisplay()->startupNotificationCompleted(); @@ -1307,7 +1316,7 @@ void GtkSalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) setMinMaxSize(); // #i45160# switch to desktop where a dialog with parent will appear - if( m_pParent && m_pParent->m_nWorkArea != m_nWorkArea && GTK_WIDGET_MAPPED(m_pParent->m_pWindow) ) + if( m_pParent && m_pParent->m_nWorkArea != m_nWorkArea && IS_WIDGET_MAPPED(m_pParent->m_pWindow) ) getDisplay()->getWMAdaptor()->switchToWorkArea( m_pParent->m_nWorkArea ); if( isFloatGrabWindow() && @@ -1358,7 +1367,7 @@ void GtkSalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) nUserTime= getDisplay()->GetLastUserEventTime( true ); //nUserTime = gdk_x11_get_server_time(GTK_WIDGET (m_pWindow)->window); } - lcl_set_user_time( GTK_WIDGET(m_pWindow)->window, nUserTime ); + lcl_set_user_time( widget_get_window(GTK_WIDGET(m_pWindow)), nUserTime ); if( ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) ) m_bSetFocusOnMap = true; @@ -1467,7 +1476,7 @@ void GtkSalFrame::SetMaxClientSize( long nWidth, long nHeight ) { m_aMaxSize = Size( nWidth, nHeight ); // Show does a setMinMaxSize - if( GTK_WIDGET_MAPPED( m_pWindow ) ) + if( IS_WIDGET_MAPPED( m_pWindow ) ) setMinMaxSize(); } } @@ -1480,7 +1489,7 @@ void GtkSalFrame::SetMinClientSize( long nWidth, long nHeight ) { gtk_widget_set_size_request( m_pWindow, nWidth, nHeight ); // Show does a setMinMaxSize - if( GTK_WIDGET_MAPPED( m_pWindow ) ) + if( IS_WIDGET_MAPPED( m_pWindow ) ) setMinMaxSize(); } } @@ -1632,8 +1641,6 @@ void GtkSalFrame::SetWindowState( const SalFrameState* pState ) sal_uInt16 nPosSizeFlags = 0; long nX = pState->mnX - (m_pParent ? m_pParent->maGeometry.nX : 0); long nY = pState->mnY - (m_pParent ? m_pParent->maGeometry.nY : 0); - long nWidth = pState->mnWidth; - long nHeight = pState->mnHeight; if( pState->mnMask & SAL_FRAMESTATE_MASK_X ) nPosSizeFlags |= SAL_FRAME_POSSIZE_X; else @@ -1644,12 +1651,8 @@ void GtkSalFrame::SetWindowState( const SalFrameState* pState ) nY = maGeometry.nY - (m_pParent ? m_pParent->maGeometry.nY : 0); if( pState->mnMask & SAL_FRAMESTATE_MASK_WIDTH ) nPosSizeFlags |= SAL_FRAME_POSSIZE_WIDTH; - else - nWidth = maGeometry.nWidth; if( pState->mnMask & SAL_FRAMESTATE_MASK_HEIGHT ) nPosSizeFlags |= SAL_FRAME_POSSIZE_HEIGHT; - else - nHeight = maGeometry.nHeight; SetPosSize( nX, nY, pState->mnWidth, pState->mnHeight, nPosSizeFlags ); } if( pState->mnMask & SAL_FRAMESTATE_MASK_STATE && ! isChild() ) @@ -1732,7 +1735,7 @@ void GtkSalFrame::moveToScreen( int nScreen ) gtk_widget_realize( m_pWindow ); // update system data GtkSalDisplay* pDisp = getDisplay(); - m_aSystemData.aWindow = GDK_WINDOW_XWINDOW(m_pWindow->window); + m_aSystemData.aWindow = GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)); m_aSystemData.pVisual = pDisp->GetVisual( m_nScreen ).GetVisual(); m_aSystemData.nScreen = nScreen; m_aSystemData.nDepth = pDisp->GetVisual( m_nScreen ).GetDepth(); @@ -1740,10 +1743,10 @@ void GtkSalFrame::moveToScreen( int nScreen ) m_aSystemData.pAppContext = NULL; m_aSystemData.aShellWindow = m_aSystemData.aWindow; // update graphics if necessary - for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); i++ ) { if( m_aGraphics[i].bInUse ) - m_aGraphics[i].pGraphics->SetDrawable( GDK_WINDOW_XWINDOW(m_pWindow->window), m_nScreen ); + m_aGraphics[i].pGraphics->SetDrawable( GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), m_nScreen ); } updateScreenNumber(); } @@ -1772,7 +1775,7 @@ void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen ) Rectangle aOldScreenRect( pDisp->GetXineramaScreens()[maGeometry.nScreenNumber] ); Rectangle aNewScreenRect( pDisp->GetXineramaScreens()[nNewScreen] ); - bool bVisible = GTK_WIDGET_MAPPED(m_pWindow); + bool bVisible = IS_WIDGET_MAPPED(m_pWindow); if( bVisible ) Show( sal_False ); maGeometry.nX = aNewScreenRect.Left() + (maGeometry.nX - aOldScreenRect.Left()); @@ -1792,6 +1795,40 @@ void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen ) } } +void GtkSalFrame::updateWMClass() +{ + rtl::OString aResClass = rtl::OUStringToOString(m_sWMClass, RTL_TEXTENCODING_ASCII_US); + const char *pResClass = aResClass.getLength() ? aResClass.getStr() : X11SalData::getFrameClassName(); + + if( IS_WIDGET_REALIZED( m_pWindow ) ) + { + XClassHint* pClass = XAllocClassHint(); + rtl::OString aResName = X11SalData::getFrameResName( m_nExtStyle ); + pClass->res_name = const_cast<char*>(aResName.getStr()); + pClass->res_class = const_cast<char*>(pResClass); + XSetClassHint( getDisplay()->GetDisplay(), + GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), + pClass ); + XFree( pClass ); + } + else + gtk_window_set_wmclass( GTK_WINDOW(m_pWindow), + X11SalData::getFrameResName( m_nExtStyle ), + pResClass ); +} + +void GtkSalFrame::SetApplicationID( const rtl::OUString &rWMClass ) +{ + if( rWMClass != m_sWMClass && ! isChild() ) + { + m_sWMClass = rWMClass; + updateWMClass(); + + for( std::list< GtkSalFrame* >::iterator it = m_aChildren.begin(); it != m_aChildren.end(); ++it ) + (*it)->SetApplicationID(rWMClass); + } +} + void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) { if( m_pWindow && ! isChild() ) @@ -1804,7 +1841,7 @@ void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) { m_aRestorePosSize = Rectangle( Point( maGeometry.nX, maGeometry.nY ), Size( maGeometry.nWidth, maGeometry.nHeight ) ); - bool bVisible = GTK_WIDGET_MAPPED(m_pWindow); + bool bVisible = IS_WIDGET_MAPPED(m_pWindow); if( bVisible ) Show( sal_False ); m_nStyle |= SAL_FRAME_STYLE_PARTIAL_FULLSCREEN; @@ -1837,7 +1874,7 @@ void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) } else { - bool bVisible = GTK_WIDGET_MAPPED(m_pWindow); + bool bVisible = IS_WIDGET_MAPPED(m_pWindow); if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) ); if( bVisible ) @@ -2045,7 +2082,7 @@ void GtkSalFrame::StartPresentation( sal_Bool bStart ) } #ifdef ENABLE_DBUS m_nGSMCookie = dbus_inhibit_gsm(g_get_application_name(), "presentation", - GDK_WINDOW_XID(m_pWindow->window)); + GDK_WINDOW_XID(widget_get_window(m_pWindow))); #endif } else @@ -2071,16 +2108,15 @@ void GtkSalFrame::ToTop( sal_uInt16 nFlags ) { if( isChild( false, true ) ) gtk_widget_grab_focus( m_pWindow ); - else if( GTK_WIDGET_MAPPED( m_pWindow ) ) + else if( IS_WIDGET_MAPPED( m_pWindow ) ) { if( ! (nFlags & SAL_FRAME_TOTOP_GRABFOCUS_ONLY) ) gtk_window_present( GTK_WINDOW(m_pWindow) ); else { - // gdk_window_focus( m_pWindow->window, gdk_x11_get_server_time(GTK_WIDGET (m_pWindow)->window) ); /* #i99360# ugly workaround an X11 library bug */ guint32 nUserTime= getDisplay()->GetLastUserEventTime( true ); - gdk_window_focus( m_pWindow->window, nUserTime ); + gdk_window_focus( widget_get_window(m_pWindow), nUserTime ); } /* need to do an XSetInputFocus here because * gdk_window_focus will ask a EWMH compliant WM to put the focus @@ -2092,7 +2128,7 @@ void GtkSalFrame::ToTop( sal_uInt16 nFlags ) // sad but true: this can cause an XError, we need to catch that // to do this we need to synchronize with the XServer getDisplay()->GetXLib()->PushXErrorLevel( true ); - XSetInputFocus( getDisplay()->GetDisplay(), GDK_WINDOW_XWINDOW( m_pWindow->window ), RevertToParent, CurrentTime ); + XSetInputFocus( getDisplay()->GetDisplay(), GDK_WINDOW_XWINDOW( widget_get_window(m_pWindow) ), RevertToParent, CurrentTime ); XSync( getDisplay()->GetDisplay(), False ); getDisplay()->GetXLib()->PopXErrorLevel(); } @@ -2111,7 +2147,7 @@ void GtkSalFrame::SetPointer( PointerStyle ePointerStyle ) { m_ePointerStyle = ePointerStyle; GdkCursor *pCursor = getDisplay()->getCursor( ePointerStyle ); - gdk_window_set_cursor( m_pWindow->window, pCursor ); + gdk_window_set_cursor( widget_get_window(m_pWindow), pCursor ); m_pCurrentCursor = pCursor; // #i80791# use grabPointer the same way as CaptureMouse, respective float grab @@ -2124,6 +2160,8 @@ void GtkSalFrame::SetPointer( PointerStyle ePointerStyle ) void GtkSalFrame::grabPointer( sal_Bool bGrab, sal_Bool bOwnerEvents ) { + static const char* pEnv = getenv( "SAL_NO_MOUSEGRABS" ); + if( m_pWindow ) { if( bGrab ) @@ -2146,9 +2184,10 @@ void GtkSalFrame::grabPointer( sal_Bool bGrab, sal_Bool bOwnerEvents ) { const int nMask = ( GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK ); - gdk_pointer_grab( m_pWindow->window, bOwnerEvents, - (GdkEventMask) nMask, NULL, m_pCurrentCursor, - GDK_CURRENT_TIME ); + if( !pEnv || !*pEnv ) + gdk_pointer_grab( widget_get_window( m_pWindow ), bOwnerEvents, + (GdkEventMask) nMask, NULL, m_pCurrentCursor, + GDK_CURRENT_TIME ); } else { @@ -2158,23 +2197,25 @@ void GtkSalFrame::grabPointer( sal_Bool bGrab, sal_Bool bOwnerEvents ) // // this is of course a bad hack, especially as we cannot // set the right cursor this way - XGrabPointer( getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW( m_pWindow->window), - bOwnerEvents, - PointerMotionMask | ButtonPressMask | ButtonReleaseMask, - GrabModeAsync, - GrabModeAsync, - None, - None, - CurrentTime - ); + if( !pEnv || !*pEnv ) + XGrabPointer( getDisplay()->GetDisplay(), + GDK_WINDOW_XWINDOW( widget_get_window( m_pWindow ) ), + bOwnerEvents, + PointerMotionMask | ButtonPressMask | ButtonReleaseMask, + GrabModeAsync, + GrabModeAsync, + None, + None, + CurrentTime + ); } } else { // Two GdkDisplays may be open - gdk_display_pointer_ungrab( getGdkDisplay(), GDK_CURRENT_TIME); + if( !pEnv || !*pEnv ) + gdk_display_pointer_ungrab( getGdkDisplay(), GDK_CURRENT_TIME); } } } @@ -2195,7 +2236,7 @@ void GtkSalFrame::SetPointerPos( long nX, long nY ) GdkScreen *pScreen = gtk_window_get_screen( GTK_WINDOW(pFrame->m_pWindow) ); GdkDisplay *pDisplay = gdk_screen_get_display( pScreen ); - /* #87921# when the application tries to center the mouse in the dialog the + /* when the application tries to center the mouse in the dialog the * window isn't mapped already. So use coordinates relative to the root window. */ unsigned int nWindowLeft = maGeometry.nX + nX; @@ -2207,7 +2248,7 @@ void GtkSalFrame::SetPointerPos( long nX, long nY ) // #i38648# ask for the next motion hint gint x, y; GdkModifierType mask; - gdk_window_get_pointer( pFrame->m_pWindow->window, &x, &y, &mask ); + gdk_window_get_pointer( widget_get_window(pFrame->m_pWindow) , &x, &y, &mask ); } void GtkSalFrame::Flush() @@ -2256,6 +2297,18 @@ SalFrame::SalPointerState GtkSalFrame::GetPointerState() return aState; } +SalFrame::SalIndicatorState GtkSalFrame::GetIndicatorState() +{ + SalIndicatorState aState; + aState.mnState = GetX11SalData()->GetDisplay()->GetIndicatorState(); + return aState; +} + +void GtkSalFrame::SimulateKeyPress( sal_uInt16 nKeyCode ) +{ + GetX11SalData()->GetDisplay()->SimulateKeyPress(nKeyCode); +} + void GtkSalFrame::SetInputContext( SalInputContext* pContext ) { if( ! pContext ) @@ -2293,7 +2346,7 @@ SalBitmap* GtkSalFrame::SnapShot() return NULL; X11SalBitmap *pBmp = new X11SalBitmap; - GdkWindow *pWin = m_pWindow->window; + GdkWindow *pWin = widget_get_window(m_pWindow); if( pBmp->SnapShot( GDK_DISPLAY_XDISPLAY( getGdkDisplay() ), GDK_WINDOW_XID( pWin ) ) ) return pBmp; @@ -2316,7 +2369,9 @@ void GtkSalFrame::UpdateSettings( AllSettings& rSettings ) bFreeGraphics = true; } +#ifndef GTK_GRAPHICS_DISABLED pGraphics->updateSettings( rSettings ); +#endif if( bFreeGraphics ) ReleaseGraphics( pGraphics ); @@ -2355,7 +2410,7 @@ void GtkSalFrame::SetParent( SalFrame* pNewParent ) void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nScreen ) { - bool bWasVisible = GTK_WIDGET_MAPPED(m_pWindow); + bool bWasVisible = IS_WIDGET_MAPPED(m_pWindow); if( bWasVisible ) Show( sal_False ); @@ -2389,7 +2444,7 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc } // free xrender resources - for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); i++ ) if( m_aGraphics[i].bInUse ) m_aGraphics[i].pGraphics->SetDrawable( None, m_nScreen ); @@ -2400,7 +2455,13 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc m_pIMHandler = NULL; } if( m_pRegion ) +{ +#if GTK_CHECK_VERSION(3,0,0) + cairo_region_destroy( m_pRegion ); +#else gdk_region_destroy( m_pRegion ); +#endif +} if( m_pFixedContainer ) gtk_widget_destroy( GTK_WIDGET(m_pFixedContainer) ); if( m_pWindow ) @@ -2424,12 +2485,14 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc } // update graphics - for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ ) + for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); i++ ) { if( m_aGraphics[i].bInUse ) { - m_aGraphics[i].pGraphics->SetDrawable( GDK_WINDOW_XWINDOW(m_pWindow->window), m_nScreen ); + m_aGraphics[i].pGraphics->SetDrawable( GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), m_nScreen ); +#ifndef GTK_GRAPHICS_DISABLED m_aGraphics[i].pGraphics->SetWindow( m_pWindow ); +#endif } } @@ -2458,14 +2521,20 @@ bool GtkSalFrame::SetPluginParent( SystemParentData* pSysParent ) void GtkSalFrame::ResetClipRegion() { if( m_pWindow ) - gdk_window_shape_combine_region( m_pWindow->window, NULL, 0, 0 ); + gdk_window_shape_combine_region( widget_get_window( m_pWindow ), NULL, 0, 0 ); } void GtkSalFrame::BeginSetClipRegion( sal_uLong ) { +#if GTK_CHECK_VERSION(3,0,0) + if( m_pRegion ) + cairo_region_destroy( m_pRegion ); + m_pRegion = cairo_region_create(); +#else if( m_pRegion ) gdk_region_destroy( m_pRegion ); m_pRegion = gdk_region_new(); +#endif } void GtkSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) @@ -2477,15 +2546,18 @@ void GtkSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) aRect.y = nY; aRect.width = nWidth; aRect.height = nHeight; - +#if GTK_CHECK_VERSION(3,0,0) + cairo_region_union_rectangle( m_pRegion, &aRect ); +#else gdk_region_union_with_rect( m_pRegion, &aRect ); +#endif } } void GtkSalFrame::EndSetClipRegion() { if( m_pWindow && m_pRegion ) - gdk_window_shape_combine_region( m_pWindow->window, m_pRegion, 0, 0 ); + gdk_window_shape_combine_region( widget_get_window(m_pWindow), m_pRegion, 0, 0 ); } bool GtkSalFrame::Dispatch( const XEvent* pEvent ) @@ -2499,7 +2571,7 @@ bool GtkSalFrame::Dispatch( const XEvent* pEvent ) if( pEvent->xproperty.atom == nDesktopAtom && pEvent->xproperty.state == PropertyNewValue ) { - m_nWorkArea = pAdaptor->getWindowWorkArea( GDK_WINDOW_XWINDOW( m_pWindow->window) ); + m_nWorkArea = pAdaptor->getWindowWorkArea( GDK_WINDOW_XWINDOW( widget_get_window(m_pWindow)) ); } } else if( pEvent->type == ConfigureNotify ) @@ -2526,7 +2598,7 @@ bool GtkSalFrame::Dispatch( const XEvent* pEvent ) int x = 0, y = 0; XLIB_Window aChild; XTranslateCoordinates( getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW( m_pWindow->window), + GDK_WINDOW_XWINDOW( widget_get_window(m_pWindow) ), getDisplay()->GetRootWindow( getDisplay()->GetDefaultScreenNumber() ), 0, 0, &x, &y, @@ -2541,7 +2613,7 @@ bool GtkSalFrame::Dispatch( const XEvent* pEvent ) } else if( pEvent->type == ClientMessage && pEvent->xclient.message_type == getDisplay()->getWMAdaptor()->getAtom( vcl_sal::WMAdaptor::XEMBED ) && - pEvent->xclient.window == GDK_WINDOW_XWINDOW(m_pWindow->window) && + pEvent->xclient.window == GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)) && m_bWindowIsGtkPlug ) { @@ -2553,7 +2625,7 @@ bool GtkSalFrame::Dispatch( const XEvent* pEvent ) { GdkEventFocus aEvent; aEvent.type = GDK_FOCUS_CHANGE; - aEvent.window = m_pWindow->window; + aEvent.window = widget_get_window( m_pWindow ); aEvent.send_event = sal_True; aEvent.in = (pEvent->xclient.data.l[1] == 1); signalFocus( m_pWindow, &aEvent, this ); @@ -2568,7 +2640,7 @@ void GtkSalFrame::SetBackgroundBitmap( SalBitmap* pBitmap ) if( m_hBackgroundPixmap ) { XSetWindowBackgroundPixmap( getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW(m_pWindow->window), + GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), None ); XFreePixmap( getDisplay()->GetDisplay(), m_hBackgroundPixmap ); m_hBackgroundPixmap = None; @@ -2581,7 +2653,7 @@ void GtkSalFrame::SetBackgroundBitmap( SalBitmap* pBitmap ) { m_hBackgroundPixmap = XCreatePixmap( getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW(m_pWindow->window), + GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), aSize.Width(), aSize.Height(), getDisplay()->GetVisual(m_nScreen).GetDepth() ); @@ -2597,7 +2669,7 @@ void GtkSalFrame::SetBackgroundBitmap( SalBitmap* pBitmap ) aTwoRect, getDisplay()->GetCopyGC(m_nScreen) ); XSetWindowBackgroundPixmap( getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW(m_pWindow->window), + GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), m_hBackgroundPixmap ); } } @@ -2770,7 +2842,7 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer // ask for the next hint gint x, y; GdkModifierType mask; - gdk_window_get_pointer( GTK_WIDGET(pThis->m_pWindow)->window, &x, &y, &mask ); + gdk_window_get_pointer( widget_get_window(GTK_WIDGET(pThis->m_pWindow)), &x, &y, &mask ); } } @@ -2793,6 +2865,27 @@ gboolean GtkSalFrame::signalCrossing( GtkWidget*, GdkEventCrossing* pEvent, gpoi return sal_True; } +#if GTK_CHECK_VERSION(3,0,0) +// This is unpleasant: we assume that a draw event was an expose earlier in life ... +// We also hope & pray (for gtk 3.0.0) that the window was realised/mapped before draw +// was called or we will badmatch +gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame ) +{ + GtkSalFrame* pThis = (GtkSalFrame*)frame; + + double x1 = 0.0, y1 = 0.0, x2 = 0.0, y2 = 0.0; + cairo_clip_extents (cr, &x1, &y1, &x2, &y2); + + // FIXME: qutie possibly we have some co-ordinate system / translation madness here. + // pEvent->area.x, pEvent->area.y, pEvent->area.width, pEvent->area.height ); + struct SalPaintEvent aEvent( x1, y1, x2 - x1, y2 - y1 ); + + GTK_YIELD_GRAB(); + pThis->CallCallback( SALEVENT_PAINT, &aEvent ); + + return sal_False; +} +#endif gboolean GtkSalFrame::signalExpose( GtkWidget*, GdkEventExpose* pEvent, gpointer frame ) { @@ -2812,13 +2905,15 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f GTK_YIELD_GRAB(); + X11SalInstance *pSalInstance = + static_cast< X11SalInstance* >(GetSalData()->m_pInstance); + // check if printers have changed (analogous to salframe focus handler) - vcl_sal::PrinterUpdate::update(); + pSalInstance->updatePrinterUpdate(); if( !pEvent->in ) { pThis->m_nKeyModifiers = 0; - pThis->m_bSingleAltPress = false; pThis->m_bSendModChangeOnRelease = false; } @@ -2826,9 +2921,8 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f pThis->m_pIMHandler->focusChanged( pEvent->in ); // ask for changed printers like generic implementation - if( pEvent->in ) - if( static_cast< X11SalInstance* >(GetSalData()->m_pInstance)->isPrinterInit() ) - vcl_sal::PrinterUpdate::update(); + if( pEvent->in && pSalInstance->isPrinterInit() ) + pSalInstance->updatePrinterUpdate(); // FIXME: find out who the hell steals the focus from our frame // while we have the pointer grabbed, this should not come from @@ -2855,7 +2949,7 @@ IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, EMPTYARG ) XEvent aEvent; aEvent.type = ClientMessage; aEvent.xclient.display = getDisplay()->GetDisplay(); - aEvent.xclient.window = GDK_WINDOW_XWINDOW(m_pWindow->window); + aEvent.xclient.window = GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)); aEvent.xclient.message_type = nStateAtom; aEvent.xclient.format = 32; aEvent.xclient.data.l[0] = 1; @@ -2905,7 +2999,7 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) if( bSetFocus ) { XSetInputFocus( pThis->getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window), + GDK_WINDOW_XWINDOW( widget_get_window(GTK_WIDGET(pThis->m_pWindow))), RevertToParent, CurrentTime ); } @@ -2953,7 +3047,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp */ XLIB_Window aChild; XTranslateCoordinates( pThis->getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW(GTK_WIDGET(pThis->m_pWindow)->window), + GDK_WINDOW_XWINDOW(widget_get_window(GTK_WIDGET(pThis->m_pWindow))), pThis->getDisplay()->GetRootWindow( pThis->getDisplay()->GetDefaultScreenNumber() ), 0, 0, &x, &y, @@ -2987,7 +3081,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp if( ! (pThis->m_nStyle & SAL_FRAME_STYLE_PLUG) ) { GdkRectangle aRect; - gdk_window_get_frame_extents( GTK_WIDGET(pThis->m_pWindow)->window, &aRect ); + gdk_window_get_frame_extents( widget_get_window(GTK_WIDGET(pThis->m_pWindow)), &aRect ); pThis->maGeometry.nTopDecoration = y - aRect.y; pThis->maGeometry.nBottomDecoration = aRect.y + aRect.height - y - pEvent->height; pThis->maGeometry.nLeftDecoration = x - aRect.x; @@ -3022,10 +3116,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame if( pThis->m_pIMHandler ) { if( pThis->m_pIMHandler->handleKeyEvent( pEvent ) ) - { - pThis->m_bSingleAltPress = false; return sal_True; - } } GTK_YIELD_GRAB(); @@ -3112,36 +3203,6 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame pThis->CallCallback( SALEVENT_KEYMODCHANGE, &aModEvt ); - if( ! aDel.isDeleted() ) - { - // emulate KEY_MENU - if( ( pEvent->keyval == GDK_Alt_L || pEvent->keyval == GDK_Alt_R ) && - ( nModCode & ~(KEY_MOD3|KEY_MOD2)) == 0 ) - { - if( pEvent->type == GDK_KEY_PRESS ) - pThis->m_bSingleAltPress = true; - - else if( pThis->m_bSingleAltPress ) - { - SalKeyEvent aKeyEvt; - - aKeyEvt.mnCode = KEY_MENU | nModCode; - aKeyEvt.mnRepeat = 0; - aKeyEvt.mnTime = pEvent->time; - aKeyEvt.mnCharCode = 0; - - // simulate KEY_MENU - pThis->CallCallback( SALEVENT_KEYINPUT, &aKeyEvt ); - if( ! aDel.isDeleted() ) - { - pThis->CallCallback( SALEVENT_KEYUP, &aKeyEvt ); - pThis->m_bSingleAltPress = false; - } - } - } - else - pThis->m_bSingleAltPress = false; - } } else { @@ -3154,10 +3215,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame (pEvent->type == GDK_KEY_PRESS), false ); if( ! aDel.isDeleted() ) - { pThis->m_bSendModChangeOnRelease = false; - pThis->m_bSingleAltPress = false; - } } if( !aDel.isDeleted() && pThis->m_pIMHandler ) @@ -3198,7 +3256,7 @@ void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer fram * some time on the Xserver as well as prevent * some paint issues */ - GdkWindow* pWin = GTK_WIDGET(pThis->getWindow())->window; + GdkWindow* pWin = widget_get_window(GTK_WIDGET(pThis->getWindow())); if( pWin ) { XLIB_Window aWin = GDK_WINDOW_XWINDOW(pWin); @@ -3208,12 +3266,14 @@ void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer fram pThis->m_hBackgroundPixmap ); } +#ifndef GTK_GRAPHICS_DISABLED if( ! pThis->m_pParent ) { // signalize theme changed for NWF caches // FIXME: should be called only once for a style change GtkSalGraphics::bThemeChanged = sal_True; } +#endif } gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame ) @@ -3251,10 +3311,10 @@ gboolean GtkSalFrame::signalVisibility( GtkWidget*, GdkEventVisibility* pEvent, return sal_False; } -void GtkSalFrame::signalDestroy( GtkObject* pObj, gpointer frame ) +void GtkSalFrame::signalDestroy( GtkWidget* pObj, gpointer frame ) { GtkSalFrame* pThis = (GtkSalFrame*)frame; - if( GTK_WIDGET( pObj ) == pThis->m_pWindow ) + if( pObj == pThis->m_pWindow ) { pThis->m_pFixedContainer = NULL; pThis->m_pWindow = NULL; @@ -3302,7 +3362,7 @@ void GtkSalFrame::IMHandler::createIMContext() G_CALLBACK (signalIMPreeditEnd), this ); m_pFrame->getDisplay()->GetXLib()->PushXErrorLevel( true ); - gtk_im_context_set_client_window( m_pIMContext, GTK_WIDGET(m_pFrame->m_pWindow)->window ); + gtk_im_context_set_client_window( m_pIMContext, widget_get_window(GTK_WIDGET(m_pFrame->m_pWindow)) ); gtk_im_context_focus_in( m_pIMContext ); m_pFrame->getDisplay()->GetXLib()->PopXErrorLevel(); m_bFocused = true; @@ -3543,6 +3603,10 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p { GTK_YIELD_GRAB(); + const bool bWasPreedit = + (pThis->m_aInputEvent.mpTextAttr != 0) || + pThis->m_bPreeditJustChanged; + pThis->m_aInputEvent.mnTime = 0; pThis->m_aInputEvent.mpTextAttr = 0; pThis->m_aInputEvent.maText = String( pText, RTL_TEXTENCODING_UTF8 ); @@ -3566,9 +3630,6 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p * or because there never was a preedit. */ bool bSingleCommit = false; - bool bWasPreedit = - (pThis->m_aInputEvent.mpTextAttr != 0) || - pThis->m_bPreeditJustChanged; if( ! bWasPreedit && pThis->m_aInputEvent.maText.Len() == 1 && ! pThis->m_aPrevKeyPresses.empty() @@ -3756,11 +3817,18 @@ uno::Reference<accessibility::XAccessibleEditableText> lcl_GetxText() uno::Reference<accessibility::XAccessibleEditableText> xText; Window* pFocusWin = ImplGetSVData()->maWinData.mpFocusWin; if (!pFocusWin) - return xText; + return xText; - uno::Reference< accessibility::XAccessible > xAccessible( pFocusWin->GetAccessible( true ) ); - if (xAccessible.is()) - xText = FindFocus(xAccessible->getAccessibleContext()); + try + { + uno::Reference< accessibility::XAccessible > xAccessible( pFocusWin->GetAccessible( true ) ); + if (xAccessible.is()) + xText = FindFocus(xAccessible->getAccessibleContext()); + } + catch(const uno::Exception& e) + { + g_warning( "Exception in getting input method surrounding text" ); + } return xText; } @@ -3792,9 +3860,7 @@ gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint if (xText.is()) { sal_uInt32 nPosition = xText->getCaretPosition(); - // --> OD 2010-06-04 #i111768# - apply patch from kstribley: - // range checking -// xText->deleteText(nPosition + offset, nPosition + offset + nchars); + // #i111768# range checking sal_Int32 nDeletePos = nPosition + offset; sal_Int32 nDeleteEnd = nDeletePos + nchars; if (nDeletePos < 0) @@ -3805,9 +3871,23 @@ gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint nDeleteEnd = xText->getCharacterCount(); xText->deleteText(nDeletePos, nDeleteEnd); - // <-- return sal_True; } return sal_False; } + +#ifdef GTK_GRAPHICS_DISABLED + +void GtkData::initNWF() {} +void GtkData::deInitNWF() {} + +GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) + : X11SalGraphics() +{ + Init( pFrame, GDK_WINDOW_XID( widget_get_window( pWindow ) ), + gdk_x11_screen_get_screen_number( gtk_widget_get_screen( pWindow ) ) ); +} + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/window/gtkobject.cxx b/vcl/unx/gtk/window/gtkobject.cxx index 68c8f1f1286d..ca910f0c29f7 100644 --- a/vcl/unx/gtk/window/gtkobject.cxx +++ b/vcl/unx/gtk/window/gtkobject.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,10 +29,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#ifdef AIX +#define _LINUX_SOURCE_COMPAT +#include <sys/timer.h> +#undef _LINUX_SOURCE_COMPAT +#endif + #include <unx/gtk/gtkobject.hxx> #include <unx/gtk/gtkframe.hxx> #include <unx/gtk/gtkdata.hxx> #include <unx/gtk/gtkinst.hxx> +#include <unx/gtk/gtkgdi.hxx> GtkSalObject::GtkSalObject( GtkSalFrame* pParent, sal_Bool bShow ) : m_pSocket( NULL ), @@ -58,7 +66,7 @@ GtkSalObject::GtkSalObject( GtkSalFrame* pParent, sal_Bool bShow ) SalDisplay* pDisp = GetX11SalData()->GetDisplay(); m_aSystemData.nSize = sizeof( SystemChildData ); m_aSystemData.pDisplay = pDisp->GetDisplay(); - m_aSystemData.aWindow = GDK_WINDOW_XWINDOW(m_pSocket->window); + m_aSystemData.aWindow = GDK_WINDOW_XWINDOW(widget_get_window(m_pSocket)); m_aSystemData.pSalFrame = NULL; m_aSystemData.pWidget = m_pSocket; m_aSystemData.pVisual = pDisp->GetVisual(pParent->getScreenNumber()).GetVisual(); @@ -66,7 +74,7 @@ GtkSalObject::GtkSalObject( GtkSalFrame* pParent, sal_Bool bShow ) m_aSystemData.nDepth = pDisp->GetVisual(pParent->getScreenNumber()).GetDepth(); m_aSystemData.aColormap = pDisp->GetColormap(pParent->getScreenNumber()).GetXColormap(); m_aSystemData.pAppContext = NULL; - m_aSystemData.aShellWindow = GDK_WINDOW_XWINDOW(GTK_WIDGET(pParent->getWindow())->window); + m_aSystemData.aShellWindow = GDK_WINDOW_XWINDOW(widget_get_window(GTK_WIDGET(pParent->getWindow()))); m_aSystemData.pShellWidget = GTK_WIDGET(pParent->getWindow()); g_signal_connect( G_OBJECT(m_pSocket), "button-press-event", G_CALLBACK(signalButton), this ); @@ -83,7 +91,13 @@ GtkSalObject::GtkSalObject( GtkSalFrame* pParent, sal_Bool bShow ) GtkSalObject::~GtkSalObject() { if( m_pRegion ) + { +#if GTK_CHECK_VERSION(3,0,0) + cairo_region_destroy( m_pRegion ); +#else gdk_region_destroy( m_pRegion ); +#endif + } if( m_pSocket ) { // remove socket from parent frame's fixed container @@ -101,7 +115,7 @@ GtkSalObject::~GtkSalObject() void GtkSalObject::ResetClipRegion() { if( m_pSocket ) - gdk_window_shape_combine_region( m_pSocket->window, NULL, 0, 0 ); + gdk_window_shape_combine_region( widget_get_window(m_pSocket), NULL, 0, 0 ); } sal_uInt16 GtkSalObject::GetClipRegionType() @@ -111,9 +125,15 @@ sal_uInt16 GtkSalObject::GetClipRegionType() void GtkSalObject::BeginSetClipRegion( sal_uLong ) { +#if GTK_CHECK_VERSION(3,0,0) + if( m_pRegion ) + cairo_region_destroy( m_pRegion ); + m_pRegion = cairo_region_create(); +#else if( m_pRegion ) gdk_region_destroy( m_pRegion ); m_pRegion = gdk_region_new(); +#endif } void GtkSalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) @@ -124,13 +144,17 @@ void GtkSalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight aRect.width = nWidth; aRect.height = nHeight; +#if GTK_CHECK_VERSION(3,0,0) + cairo_region_union_rectangle( m_pRegion, &aRect ); +#else gdk_region_union_with_rect( m_pRegion, &aRect ); +#endif } void GtkSalObject::EndSetClipRegion() { if( m_pSocket ) - gdk_window_shape_combine_region( m_pSocket->window, m_pRegion, 0, 0 ); + gdk_window_shape_combine_region( widget_get_window(m_pSocket), m_pRegion, 0, 0 ); } void GtkSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) @@ -201,16 +225,25 @@ gboolean GtkSalObject::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer return FALSE; } -void GtkSalObject::signalDestroy( GtkObject* pObj, gpointer object ) +void GtkSalObject::signalDestroy( GtkWidget* pObj, gpointer object ) { GtkSalObject* pThis = (GtkSalObject*)object; - if( GTK_WIDGET(pObj) == pThis->m_pSocket ) + if( pObj == pThis->m_pSocket ) { pThis->m_pSocket = NULL; } } +void GtkSalObject::SetForwardKey( sal_Bool bEnable ) +{ + if( bEnable ) + gtk_widget_add_events( GTK_WIDGET( m_pSocket ), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE ); + else + gtk_widget_set_events( GTK_WIDGET( m_pSocket ), ~(GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE) & gtk_widget_get_events( GTK_WIDGET( m_pSocket ) ) ); +} + void GtkSalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) { } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkaction.cxx b/vcl/unx/gtk3/a11y/gtk3atkaction.cxx new file mode 100644 index 000000000000..71a92c8e918b --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkaction.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkaction.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkbridge.cxx b/vcl/unx/gtk3/a11y/gtk3atkbridge.cxx new file mode 100644 index 000000000000..34d094ff9d20 --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkbridge.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkbridge.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx b/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx new file mode 100644 index 000000000000..cd33fcf91e9d --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkcomponent.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkeditabletext.cxx b/vcl/unx/gtk3/a11y/gtk3atkeditabletext.cxx new file mode 100644 index 000000000000..6ba2164d2842 --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkeditabletext.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkeditabletext.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkfactory.cxx b/vcl/unx/gtk3/a11y/gtk3atkfactory.cxx new file mode 100644 index 000000000000..3fd107f960c9 --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkfactory.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkfactory.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx b/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx new file mode 100644 index 000000000000..29458829989c --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkhypertext.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkimage.cxx b/vcl/unx/gtk3/a11y/gtk3atkimage.cxx new file mode 100644 index 000000000000..e8404b199b0f --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkimage.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkimage.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx new file mode 100644 index 000000000000..a43aeab9abcb --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atklistener.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkregistry.cxx b/vcl/unx/gtk3/a11y/gtk3atkregistry.cxx new file mode 100644 index 000000000000..95c372a8c74e --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkregistry.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkregistry.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkselection.cxx b/vcl/unx/gtk3/a11y/gtk3atkselection.cxx new file mode 100644 index 000000000000..860e125d38cb --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkselection.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkselection.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atktable.cxx b/vcl/unx/gtk3/a11y/gtk3atktable.cxx new file mode 100644 index 000000000000..39dc5fc75407 --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atktable.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atktable.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atktext.cxx b/vcl/unx/gtk3/a11y/gtk3atktext.cxx new file mode 100644 index 000000000000..3239c6630114 --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atktext.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atktext.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx b/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx new file mode 100644 index 000000000000..61eeb47211d1 --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atktextattributes.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkutil.cxx b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx new file mode 100644 index 000000000000..44b41f63e575 --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkutil.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkvalue.cxx b/vcl/unx/gtk3/a11y/gtk3atkvalue.cxx new file mode 100644 index 000000000000..8398e0f5f57f --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkvalue.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkvalue.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkwindow.cxx b/vcl/unx/gtk3/a11y/gtk3atkwindow.cxx new file mode 100644 index 000000000000..3b11cf0f0780 --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkwindow.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkwindow.cxx" diff --git a/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx b/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx new file mode 100644 index 000000000000..9a6c2e9c5d22 --- /dev/null +++ b/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/a11y/atkwrapper.cxx" diff --git a/vcl/unx/gtk3/app/gtk3gtkdata.cxx b/vcl/unx/gtk3/app/gtk3gtkdata.cxx new file mode 100644 index 000000000000..a6d7a0e2abc2 --- /dev/null +++ b/vcl/unx/gtk3/app/gtk3gtkdata.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/app/gtkdata.cxx" diff --git a/vcl/unx/gtk3/app/gtk3gtkinst.cxx b/vcl/unx/gtk3/app/gtk3gtkinst.cxx new file mode 100644 index 000000000000..ad2d59ac54a5 --- /dev/null +++ b/vcl/unx/gtk3/app/gtk3gtkinst.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/app/gtkinst.cxx" diff --git a/vcl/unx/gtk3/app/gtk3gtksys.cxx b/vcl/unx/gtk3/app/gtk3gtksys.cxx new file mode 100644 index 000000000000..ee769b30e71a --- /dev/null +++ b/vcl/unx/gtk3/app/gtk3gtksys.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/app/gtksys.cxx" diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx new file mode 100644 index 000000000000..07dc4e58d395 --- /dev/null +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/gdi/salnativewidgets-gtk.cxx" diff --git a/vcl/unx/gtk3/window/gtk3gtkframe.cxx b/vcl/unx/gtk3/window/gtk3gtkframe.cxx new file mode 100644 index 000000000000..a1d950ec5a15 --- /dev/null +++ b/vcl/unx/gtk3/window/gtk3gtkframe.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/window/gtkframe.cxx" diff --git a/vcl/unx/gtk3/window/gtk3gtkobject.cxx b/vcl/unx/gtk3/window/gtk3gtkobject.cxx new file mode 100644 index 000000000000..ab1628018e06 --- /dev/null +++ b/vcl/unx/gtk3/window/gtk3gtkobject.cxx @@ -0,0 +1,28 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "../../gtk/window/gtkobject.cxx" diff --git a/vcl/unx/headless/svpbmp.cxx b/vcl/unx/headless/svpbmp.cxx index f96da7b0c12b..2d8309af5eba 100644 --- a/vcl/unx/headless/svpbmp.cxx +++ b/vcl/unx/headless/svpbmp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -116,6 +117,11 @@ bool SvpSalBitmap::Create( const SalBitmap& /*rSalBmp*/, return false; } +bool SvpSalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > /*xBitmapCanvas*/, Size& /*rSize*/, bool /*bMask*/ ) +{ + return false; +} + void SvpSalBitmap::Destroy() { m_aBitmap.reset(); @@ -321,3 +327,4 @@ bool SvpSalBitmap::GetSystemData( BitmapSystemData& ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpbmp.hxx b/vcl/unx/headless/svpbmp.hxx index e5a40320bc4c..b3adb3b9951f 100644 --- a/vcl/unx/headless/svpbmp.hxx +++ b/vcl/unx/headless/svpbmp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,6 +54,9 @@ public: SalGraphics* pGraphics ); virtual bool Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount ); + virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, + Size& rSize, + bool bMask = false ); virtual void Destroy(); virtual Size GetSize() const; virtual sal_uInt16 GetBitCount() const; @@ -64,3 +68,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpdummies.cxx b/vcl/unx/headless/svpdummies.cxx index 162b3c5f755c..3bf1a4da9cc0 100644 --- a/vcl/unx/headless/svpdummies.cxx +++ b/vcl/unx/headless/svpdummies.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -115,3 +116,4 @@ int SvpSalSystem::ShowNativeMessageBox( const String&, return 0; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpdummies.hxx b/vcl/unx/headless/svpdummies.hxx index cec6540adc79..bc46e9b22f70 100644 --- a/vcl/unx/headless/svpdummies.hxx +++ b/vcl/unx/headless/svpdummies.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -95,3 +96,5 @@ class SvpSalSystem : public SalSystem #endif // _SVP_SVPDUMMIES_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpelement.cxx b/vcl/unx/headless/svpelement.cxx index 4041e2f7739a..b6bf4822b576 100644 --- a/vcl/unx/headless/svpelement.cxx +++ b/vcl/unx/headless/svpelement.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,6 +30,7 @@ #include <basebmp/scanlineformats.hxx> #include <tools/debug.hxx> +#include <osl/diagnose.h> #if defined WITH_SVP_LISTENING #include <osl/thread.h> @@ -42,7 +44,7 @@ #include "svpframe.hxx" #include <list> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <sys/types.h> #include <sys/socket.h> @@ -173,14 +175,14 @@ IMPL_LINK( SvpElementContainer, processRequest, void*, pSocket ) rtl::OString aCommand( aBuf.makeStringAndClear() ); if( aCommand.compareTo( "list", 4 ) == 0 ) { - std::hash_map< rtl::OString, std::list<SvpElement*>, rtl::OStringHash > aMap; + boost::unordered_map< rtl::OString, std::list<SvpElement*>, rtl::OStringHash > aMap; for( std::list< SvpElement* >::const_iterator it = m_aElements.begin(); it != m_aElements.end(); ++it ) { std::list<SvpElement*>& rList = aMap[matchType(*it)]; rList.push_back( *it ); } - for( std::hash_map< rtl::OString, std::list<SvpElement*>, rtl::OStringHash>::const_iterator hash_it = aMap.begin(); + for( boost::unordered_map< rtl::OString, std::list<SvpElement*>, rtl::OStringHash>::const_iterator hash_it = aMap.begin(); hash_it != aMap.end(); ++hash_it ) { aAnswer.append( "ElementType: " ); @@ -282,10 +284,11 @@ sal_uInt32 SvpElement::getBitCountFromScanlineFormat( sal_Int32 nFormat ) nBitCount = 32; break; default: - DBG_ERROR( "unsupported basebmp format" ); + OSL_FAIL( "unsupported basebmp format" ); break; } return nBitCount; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpelement.hxx b/vcl/unx/headless/svpelement.hxx index 0706e75af9fe..c7f647cf3a03 100644 --- a/vcl/unx/headless/svpelement.hxx +++ b/vcl/unx/headless/svpelement.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,3 +45,5 @@ class SvpElement }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpframe.cxx b/vcl/unx/headless/svpframe.cxx index 9fb54cf29ef1..1b8455557fac 100644 --- a/vcl/unx/headless/svpframe.cxx +++ b/vcl/unx/headless/svpframe.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -415,6 +416,17 @@ SalFrame::SalPointerState SvpSalFrame::GetPointerState() return aState; } +SalFrame::SalIndicatorState SvpSalFrame::GetIndicatorState() +{ + SalIndicatorState aState; + aState.mnState = 0; + return aState; +} + +void SvpSalFrame::SimulateKeyPress( sal_uInt16 /*nKeyCode*/ ) +{ +} + void SvpSalFrame::SetParent( SalFrame* pNewParent ) { if( m_pParent ) @@ -447,3 +459,4 @@ void SvpSalFrame::EndSetClipRegion() { } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpframe.hxx b/vcl/unx/headless/svpframe.hxx index 0e9a78a4562e..e57381780f61 100644 --- a/vcl/unx/headless/svpframe.hxx +++ b/vcl/unx/headless/svpframe.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -112,6 +113,8 @@ public: virtual void Beep( SoundType eSoundType ); virtual const SystemEnvData* GetSystemData() const; virtual SalPointerState GetPointerState(); + virtual SalIndicatorState GetIndicatorState(); + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ); virtual void SetParent( SalFrame* pNewParent ); virtual bool SetPluginParent( SystemParentData* pNewParent ); virtual void SetBackgroundBitmap( SalBitmap* pBitmap ); @@ -122,5 +125,8 @@ public: /*TODO: functional implementation */ virtual void SetScreenNumber( unsigned int nScreen ) { (void)nScreen; } + virtual void SetApplicationID(const rtl::OUString &rApplicationID) { (void) rApplicationID; } }; #endif // _SVP_SVPFRAME_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx index 3a72e126e4d2..0a7041661d4e 100644 --- a/vcl/unx/headless/svpgdi.cxx +++ b/vcl/unx/headless/svpgdi.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,7 +64,7 @@ rDevice aBuf.append( "debug" ); mkdir( aBuf.getStr(), 0777 ); aBuf.append( "/" ); - aBuf.append( sal_Int64(reinterpret_cast<sal_uInt32>(rDevice.get())), 16 ); + aBuf.append( sal_Int64(reinterpret_cast<sal_IntPtr>(rDevice.get())), 16 ); mkdir( aBuf.getStr(), 0777 ); aBuf.append( "/bmp" ); aBuf.append( sal_Int32(dbgStreamNum++) ); @@ -132,7 +133,7 @@ void SvpSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) rDPIX = rDPIY = 96; } -sal_uInt16 SvpSalGraphics::GetBitCount() +sal_uInt16 SvpSalGraphics::GetBitCount() const { return SvpElement::getBitCountFromScanlineFormat( m_aDevice->getScanlineFormat() ); } @@ -570,7 +571,7 @@ SystemGraphicsData SvpSalGraphics::GetGraphicsData() const SystemGraphicsData aRes; aRes.nSize = sizeof(aRes); aRes.hDrawable = 0; - aRes.pRenderFormat = 0; + aRes.pXRenderFormat = 0; return aRes; } @@ -579,3 +580,4 @@ bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const return false; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx index 217d50940b11..8291a3c2f7bc 100644 --- a/vcl/unx/headless/svpgdi.hxx +++ b/vcl/unx/headless/svpgdi.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,7 +66,7 @@ public: // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual sal_uInt16 GetBitCount(); + virtual sal_uInt16 GetBitCount() const; virtual long GetGraphicsWidth() const; virtual void ResetClipRegion(); @@ -87,6 +88,7 @@ public: virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ); virtual const ImplFontCharMap* GetImplFontCharMap() const; + virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); @@ -109,8 +111,8 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual sal_Bool GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); + virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); + virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; @@ -169,3 +171,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index ebd0ee457bd5..c9e011c1a67a 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,6 +44,7 @@ #include <salframe.hxx> #include <svdata.hxx> #include <saldatabasic.hxx> +#include <vcl/solarmutex.hxx> // plugin factory function extern "C" @@ -183,10 +185,9 @@ void SvpSalInstance::deregisterFrame( SalFrame* pFrame ) void SvpSalInstance::Wakeup() { - write (m_pTimeoutFDS[1], "", 1); + OSL_VERIFY(write (m_pTimeoutFDS[1], "", 1) == 1); } - // -=-= timeval =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= inline int operator >= ( const timeval &t1, const timeval &t2 ) { @@ -296,7 +297,7 @@ SalBitmap* SvpSalInstance::CreateSalBitmap() return new SvpSalBitmap(); } -vos::IMutex* SvpSalInstance::GetYieldMutex() +osl::SolarMutex* SvpSalInstance::GetYieldMutex() { return &m_aYieldMutex; } @@ -304,7 +305,7 @@ vos::IMutex* SvpSalInstance::GetYieldMutex() sal_uLong SvpSalInstance::ReleaseYieldMutex() { if ( m_aYieldMutex.GetThreadId() == - vos::OThread::getCurrentIdentifier() ) + osl::Thread::getCurrentIdentifier() ) { sal_uLong nCount = m_aYieldMutex.GetAcquireCount(); sal_uLong n = nCount; @@ -333,8 +334,7 @@ bool SvpSalInstance::CheckYieldMutex() { bool bRet = true; - if ( m_aYieldMutex.GetThreadId() != - vos::OThread::getCurrentIdentifier() ) + if ( m_aYieldMutex.GetThreadId() != ::osl::Thread::getCurrentIdentifier() ) { bRet = false; } @@ -460,27 +460,27 @@ SvpSalYieldMutex::SvpSalYieldMutex() void SvpSalYieldMutex::acquire() { - OMutex::acquire(); - mnThreadId = vos::OThread::getCurrentIdentifier(); + SolarMutexObject::acquire(); + mnThreadId = osl::Thread::getCurrentIdentifier(); mnCount++; } void SvpSalYieldMutex::release() { - if ( mnThreadId == vos::OThread::getCurrentIdentifier() ) + if ( mnThreadId == osl::Thread::getCurrentIdentifier() ) { if ( mnCount == 1 ) mnThreadId = 0; mnCount--; } - OMutex::release(); + SolarMutexObject::release(); } sal_Bool SvpSalYieldMutex::tryToAcquire() { - if ( OMutex::tryToAcquire() ) + if ( SolarMutexObject::tryToAcquire() ) { - mnThreadId = vos::OThread::getCurrentIdentifier(); + mnThreadId = osl::Thread::getCurrentIdentifier(); mnCount++; return sal_True; } @@ -532,3 +532,4 @@ void SvpSalTimer::Start( sal_uLong nMS ) m_pInstance->StartTimer( nMS ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx index cf6def7f3d8a..6fcafe0c7f66 100644 --- a/vcl/unx/headless/svpinst.hxx +++ b/vcl/unx/headless/svpinst.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,10 @@ #ifndef _SVP_SALINST_HXX #define _SVP_SALINST_HXX -#include <vos/mutex.hxx> -#include <vos/thread.hxx> +#include <vcl/solarmutex.hxx> +#include <osl/mutex.hxx> +#include <osl/thread.hxx> #include <salinst.hxx> #include <salwtype.hxx> #include <saltimer.hxx> @@ -47,11 +49,11 @@ // SalYieldMutex // ------------------------------------------------------------------------- -class SvpSalYieldMutex : public vos::OMutex +class SvpSalYieldMutex : public ::vcl::SolarMutexObject { protected: sal_uLong mnCount; - vos::OThread::TThreadIdentifier mnThreadId; + oslThreadIdentifier mnThreadId; public: SvpSalYieldMutex(); @@ -61,7 +63,7 @@ public: virtual sal_Bool tryToAcquire(); sal_uLong GetAcquireCount() const { return mnCount; } - vos::OThread::TThreadIdentifier GetThreadId() const { return mnThreadId; } + oslThreadIdentifier GetThreadId() const { return mnThreadId; } }; // --------------- @@ -174,7 +176,7 @@ public: virtual SalBitmap* CreateSalBitmap(); // YieldMutex - virtual vos::IMutex* GetYieldMutex(); + virtual osl::SolarMutex* GetYieldMutex(); virtual sal_uLong ReleaseYieldMutex(); virtual void AcquireYieldMutex( sal_uLong nCount ); virtual bool CheckYieldMutex(); @@ -191,6 +193,12 @@ public: virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); + + virtual void updatePrinterUpdate(); + virtual void jobStartedPrinterUpdate(); + virtual void jobEndedPrinterUpdate(); }; #endif // _SV_SALINST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx index 0a5eb0ad0e7b..6f30f2d38969 100644 --- a/vcl/unx/headless/svpprn.cxx +++ b/vcl/unx/headless/svpprn.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,7 +46,9 @@ #include "svpinst.hxx" using namespace psp; -using namespace rtl; + +using ::rtl::OUString; +using ::rtl::OUStringToOString; /* * static helpers @@ -169,144 +172,6 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) } } -static bool passFileToCommandLine( const String& rFilename, const String& rCommandLine, bool bRemoveFile = true ) -{ - bool bSuccess = false; - - rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - ByteString aCmdLine( rCommandLine, aEncoding ); - ByteString aFilename( rFilename, aEncoding ); - - bool bPipe = aCmdLine.Search( "(TMP)" ) != STRING_NOTFOUND ? false : true; - - // setup command line for exec - if( ! bPipe ) - while( aCmdLine.SearchAndReplace( "(TMP)", aFilename ) != STRING_NOTFOUND ) - ; - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "%s commandline: \"%s\"\n", - bPipe ? "piping to" : "executing", - aCmdLine.GetBuffer() ); - struct stat aStat; - if( stat( aFilename.GetBuffer(), &aStat ) ) - fprintf( stderr, "stat( %s ) failed\n", aFilename.GetBuffer() ); - fprintf( stderr, "Tmp file %s has modes: 0%03lo\n", aFilename.GetBuffer(), (long)aStat.st_mode ); -#endif - const char* argv[4]; - if( ! ( argv[ 0 ] = getenv( "SHELL" ) ) ) - argv[ 0 ] = "/bin/sh"; - argv[ 1 ] = "-c"; - argv[ 2 ] = aCmdLine.GetBuffer(); - argv[ 3 ] = 0; - - bool bHavePipes = false; - int pid, fd[2]; - - if( bPipe ) - bHavePipes = pipe( fd ) ? false : true; - if( ( pid = fork() ) > 0 ) - { - if( bPipe && bHavePipes ) - { - close( fd[0] ); - char aBuffer[ 2048 ]; - FILE* fp = fopen( aFilename.GetBuffer(), "r" ); - while( fp && ! feof( fp ) ) - { - int nBytes = fread( aBuffer, 1, sizeof( aBuffer ), fp ); - if( nBytes ) - write( fd[ 1 ], aBuffer, nBytes ); - } - fclose( fp ); - close( fd[ 1 ] ); - } - int status = 0; - waitpid( pid, &status, 0 ); - if( ! status ) - bSuccess = true; - } - else if( ! pid ) - { - if( bPipe && bHavePipes ) - { - close( fd[1] ); - if( fd[0] != STDIN_FILENO ) // not probable, but who knows :) - dup2( fd[0], STDIN_FILENO ); - } - execv( argv[0], const_cast<char**>(argv) ); - fprintf( stderr, "failed to execute \"%s\"\n", aCmdLine.GetBuffer() ); - _exit( 1 ); - } - else - fprintf( stderr, "failed to fork\n" ); - - // clean up the mess - if( bRemoveFile ) - unlink( aFilename.GetBuffer() ); - - return bSuccess; -} - -static bool sendAFax( const String& rFaxNumber, const String& rFileName, const String& rCommand ) -{ - std::list< OUString > aFaxNumbers; - - if( ! rFaxNumber.Len() ) - return false; - - sal_Int32 nIndex = 0; - OUString aFaxes( rFaxNumber ); - OUString aBeginToken( RTL_CONSTASCII_USTRINGPARAM("<Fax#>") ); - OUString aEndToken( RTL_CONSTASCII_USTRINGPARAM("</Fax#>") ); - while( nIndex != -1 ) - { - nIndex = aFaxes.indexOf( aBeginToken, nIndex ); - if( nIndex != -1 ) - { - sal_Int32 nBegin = nIndex + aBeginToken.getLength(); - nIndex = aFaxes.indexOf( aEndToken, nIndex ); - if( nIndex != -1 ) - { - aFaxNumbers.push_back( aFaxes.copy( nBegin, nIndex-nBegin ) ); - nIndex += aEndToken.getLength(); - } - } - } - - bool bSuccess = true; - if( aFaxNumbers.begin() != aFaxNumbers.end() ) - { - while( aFaxNumbers.begin() != aFaxNumbers.end() && bSuccess ) - { - String aCmdLine( rCommand ); - String aFaxNumber( aFaxNumbers.front() ); - aFaxNumbers.pop_front(); - while( aCmdLine.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "(PHONE)" ) ), aFaxNumber ) != STRING_NOTFOUND ) - ; -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "sending fax to \"%s\"\n", OUStringToOString( aFaxNumber, osl_getThreadTextEncoding() ).getStr() ); -#endif - bSuccess = passFileToCommandLine( rFileName, aCmdLine, false ); - } - } - else - bSuccess = false; - - // clean up temp file - unlink( ByteString( rFileName, osl_getThreadTextEncoding() ).GetBuffer() ); - - return bSuccess; -} - -static bool createPdf( const String& rToFile, const String& rFromFile, const String& rCommandLine ) -{ - String aCommandLine( rCommandLine ); - while( aCommandLine.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "(OUTFILE)" ) ), rToFile ) != STRING_NOTFOUND ) - ; - return passFileToCommandLine( rFromFile, aCommandLine ); -} - /* * SalInstance */ @@ -317,7 +182,7 @@ SalInfoPrinter* SvpSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueIn ImplJobSetup* pJobSetup ) { // create and initialize SalInfoPrinter - PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter; + SvpSalInfoPrinter* pPrinter = new SvpSalInfoPrinter; if( pJobSetup ) { @@ -336,7 +201,7 @@ SalInfoPrinter* SvpSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueIn // set/clear backwards compatibility flag bool bStrictSO52Compatibility = false; - std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it = + boost::unordered_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it = pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) ); if( compat_it != pJobSetup->maValueMap.end() ) { @@ -362,8 +227,8 @@ void SvpSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter ) SalPrinter* SvpSalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter ) { // create and initialize SalPrinter - PspSalPrinter* pPrinter = new PspSalPrinter( pInfoPrinter ); - pPrinter->m_aJobData = static_cast<PspSalInfoPrinter*>(pInfoPrinter)->m_aJobData; + SvpSalPrinter* pPrinter = new SvpSalPrinter( pInfoPrinter ); + pPrinter->m_aJobData = static_cast<SvpSalInfoPrinter*>(pInfoPrinter)->m_aJobData; return pPrinter; } @@ -436,574 +301,37 @@ String SvpSalInstance::GetDefaultPrinter() return rManager.getDefaultPrinter(); } -// ======================================================================= - -PspSalInfoPrinter::PspSalInfoPrinter() -{ - m_pGraphics = NULL; - m_bPapersInit = false; -} - -// ----------------------------------------------------------------------- - -PspSalInfoPrinter::~PspSalInfoPrinter() -{ - if( m_pGraphics ) - { - delete m_pGraphics; - m_pGraphics = NULL; - } -} - -// ----------------------------------------------------------------------- - -void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* ) -{ - m_aPaperFormats.clear(); - m_bPapersInit = true; - - if( m_aJobData.m_pParser ) - { - const PPDKey* pKey = m_aJobData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) ); - if( pKey ) - { - int nValues = pKey->countValues(); - for( int i = 0; i < nValues; i++ ) - { - const PPDValue* pValue = pKey->getValue( i ); - int nWidth = 0, nHeight = 0; - m_aJobData.m_pParser->getPaperDimension( pValue->m_aOption, nWidth, nHeight ); - PaperInfo aInfo(PtTo10Mu( nWidth ), PtTo10Mu( nHeight )); - m_aPaperFormats.push_back( aInfo ); - } - } - } -} - -// ----------------------------------------------------------------------- - -int PspSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* ) -{ - return 900; -} - -// ----------------------------------------------------------------------- - -SalGraphics* PspSalInfoPrinter::GetGraphics() -{ - // return a valid pointer only once - // the reasoning behind this is that we could have different - // SalGraphics that can run in multiple threads - // (future plans) - SalGraphics* pRet = NULL; - if( ! m_pGraphics ) - { - m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, NULL, false, this ); - m_pGraphics->SetLayout( 0 ); - pRet = m_pGraphics; - } - return pRet; -} - -// ----------------------------------------------------------------------- - -void PspSalInfoPrinter::ReleaseGraphics( SalGraphics* pGraphics ) -{ - if( pGraphics == m_pGraphics ) - { - delete pGraphics; - m_pGraphics = NULL; - } - return; -} - -// ----------------------------------------------------------------------- - -sal_Bool PspSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* ) -{ - return sal_False; -} - -// ----------------------------------------------------------------------- - -// This function gets the driver data and puts it into pJobSetup -// If pJobSetup->mpDriverData is NOT NULL, then the independend -// data should be merged into the driver data -// If pJobSetup->mpDriverData IS NULL, then the driver defaults -// should be merged into the independent data -sal_Bool PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup ) -{ - if( pJobSetup->mpDriverData ) - return SetData( ~0, pJobSetup ); - - copyJobDataToJobSetup( pJobSetup, m_aJobData ); - - // set/clear backwards compatibility flag - bool bStrictSO52Compatibility = false; - std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it = - pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) ); - if( compat_it != pJobSetup->maValueMap.end() ) - { - if( compat_it->second.equalsIgnoreAsciiCaseAscii( "true" ) ) - bStrictSO52Compatibility = true; - } - m_aPrinterGfx.setStrictSO52Compatibility( bStrictSO52Compatibility ); - - return sal_True; -} - // ----------------------------------------------------------------------- -// This function merges the independ driver data -// and sets the new independ data in pJobSetup -// Only the data must be changed, where the bit -// in nGetDataFlags is set -sal_Bool PspSalInfoPrinter::SetData( - sal_uLong nSetDataFlags, - ImplJobSetup* pJobSetup ) +sal_Bool SvpSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* ) { - JobData aData; - JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData ); - - if( aData.m_pParser ) - { - const PPDKey* pKey; - const PPDValue* pValue; - - // merge papersize if necessary - if( nSetDataFlags & SAL_JOBSET_PAPERSIZE ) - { - int nWidth, nHeight; - if( pJobSetup->meOrientation == ORIENTATION_PORTRAIT ) - { - nWidth = pJobSetup->mnPaperWidth; - nHeight = pJobSetup->mnPaperHeight; - } - else - { - nWidth = pJobSetup->mnPaperHeight; - nHeight = pJobSetup->mnPaperWidth; - } - String aPaper; - - if( pJobSetup->mePaperFormat == PAPER_USER ) - aPaper = aData.m_pParser->matchPaper( - TenMuToPt( pJobSetup->mnPaperWidth ), - TenMuToPt( pJobSetup->mnPaperHeight ) ); - else - aPaper = rtl::OStringToOUString(PaperInfo::toPSName(pJobSetup->mePaperFormat), RTL_TEXTENCODING_ISO_8859_1); - - pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) ); - pValue = pKey ? pKey->getValue( aPaper ) : NULL; - if( ! ( pKey && pValue && aData.m_aContext.setValue( pKey, pValue, false ) == pValue ) ) - return sal_False; - } - - // merge paperbin if necessary - if( nSetDataFlags & SAL_JOBSET_PAPERBIN ) - { - pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) ); - if( pKey ) - { - int nPaperBin = pJobSetup->mnPaperBin; - if( nPaperBin == 0xffff ) - pValue = pKey->getDefaultValue(); - else - pValue = pKey->getValue( pJobSetup->mnPaperBin ); - - // may fail due to constraints; - // real paper bin is copied back to jobsetup in that case - aData.m_aContext.setValue( pKey, pValue ); - } - // if printer has no InputSlot key simply ignore this setting - // (e.g. SGENPRT has no InputSlot) - } - - // merge orientation if necessary - 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 sal_True; - } - return sal_False; } -// ----------------------------------------------------------------------- - -void PspSalInfoPrinter::GetPageInfo( - const ImplJobSetup* pJobSetup, - long& rOutWidth, long& rOutHeight, - long& rPageOffX, long& rPageOffY, - long& rPageWidth, long& rPageHeight ) -{ - if( ! pJobSetup ) - return; - - JobData aData; - JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData ); - - // get the selected page size - if( aData.m_pParser ) - { - - String aPaper; - int width, height; - int left = 0, top = 0, right = 0, bottom = 0; - int nDPI = aData.m_aContext.getRenderResolution(); - - - if( aData.m_eOrientation == psp::orientation::Portrait ) - { - aData.m_aContext.getPageSize( aPaper, width, height ); - aData.m_pParser->getMargins( aPaper, left, right, top, bottom ); - } - else - { - aData.m_aContext.getPageSize( aPaper, height, width ); - aData.m_pParser->getMargins( aPaper, top, bottom, right, left ); - } - - rPageWidth = width * nDPI / 72; - rPageHeight = height * nDPI / 72; - rPageOffX = left * nDPI / 72; - rPageOffY = top * nDPI / 72; - rOutWidth = ( width - left - right ) * nDPI / 72; - rOutHeight = ( height - top - bottom ) * nDPI / 72; - } -} - -// ----------------------------------------------------------------------- - -sal_uLong PspSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup ) -{ - if( ! pJobSetup ) - return 0; - - JobData aData; - JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData ); - - const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) ): NULL; - return pKey ? pKey->countValues() : 0; -} - -// ----------------------------------------------------------------------- - -String PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, sal_uLong nPaperBin ) -{ - JobData aData; - JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData ); - - String aRet; - if( aData.m_pParser ) - { - const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) ): NULL; - if( nPaperBin == 0xffff || ! pKey ) - aRet = aData.m_pParser->getDefaultInputSlot(); - else - { - const PPDValue* pValue = pKey->getValue( nPaperBin ); - if( pValue ) - aRet = aData.m_pParser->translateOption( pKey->getKey(), pValue->m_aOption ); - } - } - - return aRet; -} - -// ----------------------------------------------------------------------- - -sal_uLong PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, sal_uInt16 nType ) -{ - switch( nType ) - { - case PRINTER_CAPABILITIES_SUPPORTDIALOG: - return 1; - case PRINTER_CAPABILITIES_COPIES: - return 0xffff; - case PRINTER_CAPABILITIES_COLLATECOPIES: - { - // 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: - return 1; - case PRINTER_CAPABILITIES_SETPAPER: - return 0; - case PRINTER_CAPABILITIES_FAX: - { - PrinterInfoManager& rManager = PrinterInfoManager::get(); - PrinterInfo aInfo( rManager.getPrinterInfo( pJobSetup->maPrinterName ) ); - String aFeatures( aInfo.m_aFeatures ); - int nTokenCount = aFeatures.GetTokenCount( ',' ); - for( int i = 0; i < nTokenCount; i++ ) - { - if( aFeatures.GetToken( i ).CompareToAscii( "fax", 3 ) == COMPARE_EQUAL ) - return 1; - } - return 0; - } - case PRINTER_CAPABILITIES_PDF: - { - PrinterInfoManager& rManager = PrinterInfoManager::get(); - PrinterInfo aInfo( rManager.getPrinterInfo( pJobSetup->maPrinterName ) ); - String aFeatures( aInfo.m_aFeatures ); - int nTokenCount = aFeatures.GetTokenCount( ',' ); - for( int i = 0; i < nTokenCount; i++ ) - { - if( aFeatures.GetToken( i ).CompareToAscii( "pdf=", 4 ) == COMPARE_EQUAL ) - return 1; - } - return 0; - } - default: break; - }; - return 0; -} - -// ======================================================================= - /* - * SalPrinter + * svp::PrinterUpdate */ -PspSalPrinter::PspSalPrinter( SalInfoPrinter* pInfoPrinter ) - : m_bFax( false ), - m_bPdf( false ), - m_bSwallowFaxNo( false ), - m_pGraphics( NULL ), - m_nCopies( 1 ), - m_bCollate( false ), - m_pInfoPrinter( pInfoPrinter ) +namespace svp { -} - -// ----------------------------------------------------------------------- - -PspSalPrinter::~PspSalPrinter() -{ -} - -// ----------------------------------------------------------------------- - -static String getTmpName() -{ - rtl::OUString aTmp, aSys; - osl_createTempFile( NULL, NULL, &aTmp.pData ); - osl_getSystemPathFromFileURL( aTmp.pData, &aSys.pData ); - - return aSys; -} - -sal_Bool PspSalPrinter::StartJob( - const XubString* pFileName, - const XubString& rJobName, - const XubString& rAppName, - sal_uLong nCopies, - bool bCollate, - bool /*bDirect*/, - ImplJobSetup* pJobSetup ) -{ - vcl_sal::PrinterUpdate::jobStarted(); - - m_bFax = false; - m_bPdf = false; - m_aFileName = pFileName ? *pFileName : String(); - m_aTmpFile = String(); - 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; - const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) ); - sal_Int32 nIndex = 0; - while( nIndex != -1 ) + class PrinterUpdate { - OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) ); - if( ! aToken.compareToAscii( "fax", 3 ) ) - { - m_bFax = true; - m_aTmpFile = getTmpName(); - nMode = S_IRUSR | S_IWUSR; + static Timer* pPrinterUpdateTimer; + static int nActiveJobs; - ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it; - it = pJobSetup->maValueMap.find( ::rtl::OUString::createFromAscii( "FAX#" ) ); - if( it != pJobSetup->maValueMap.end() ) - m_aFaxNr = it->second; - - sal_Int32 nPos = 0; - m_bSwallowFaxNo = ! aToken.getToken( 1, '=', nPos ).compareToAscii( "swallow", 7 ) ? true : false; - - break; - } - if( ! aToken.compareToAscii( "pdf=", 4 ) ) - { - m_bPdf = true; - m_aTmpFile = getTmpName(); - nMode = S_IRUSR | S_IWUSR; - - if( ! m_aFileName.Len() ) - { - m_aFileName = getPdfDir( rInfo ); - m_aFileName.Append( '/' ); - m_aFileName.Append( rJobName ); - m_aFileName.AppendAscii( ".pdf" ); - } - break; - } - } - m_aPrinterGfx.Init( m_aJobData ); - - // set/clear backwards compatibility flag - bool bStrictSO52Compatibility = false; - std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it = - pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) ); - if( compat_it != pJobSetup->maValueMap.end() ) - { - if( compat_it->second.equalsIgnoreAsciiCaseAscii( "true" ) ) - bStrictSO52Compatibility = true; - } - m_aPrinterGfx.setStrictSO52Compatibility( bStrictSO52Compatibility ); - - return m_aPrintJob.StartJob( m_aTmpFile.Len() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, false ) ? sal_True : sal_False; -} - -// ----------------------------------------------------------------------- - -sal_Bool PspSalPrinter::EndJob() -{ - sal_Bool bSuccess = m_aPrintJob.EndJob(); - - if( bSuccess ) - { - // check for fax - if( m_bFax ) - { - - const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) ); - // sendAFax removes the file after use - bSuccess = sendAFax( m_aFaxNr, m_aTmpFile, rInfo.m_aCommand ); - } - else if( m_bPdf ) - { - const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) ); - bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand ); - } - } - vcl_sal::PrinterUpdate::jobEnded(); - return bSuccess; -} - -// ----------------------------------------------------------------------- - -sal_Bool PspSalPrinter::AbortJob() -{ - sal_Bool bAbort = m_aPrintJob.AbortJob() ? sal_True : sal_False; - vcl_sal::PrinterUpdate::jobEnded(); - return bAbort; -} - -// ----------------------------------------------------------------------- - -SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, sal_Bool ) -{ - JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData ); - 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 ); - - return m_pGraphics; -} - -// ----------------------------------------------------------------------- - -sal_Bool PspSalPrinter::EndPage() -{ - sal_Bool bResult = m_aPrintJob.EndPage(); - m_aPrinterGfx.Clear(); - return bResult ? sal_True : sal_False; -} - -// ----------------------------------------------------------------------- - -sal_uLong PspSalPrinter::GetErrorCode() -{ - return 0; + static void doUpdate(); + DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* ); + public: + static void update(); + static void jobStarted() { nActiveJobs++; } + static void jobEnded(); + }; } -/* - * vcl::PrinterUpdate - */ - -Timer* vcl_sal::PrinterUpdate::pPrinterUpdateTimer = NULL; -int vcl_sal::PrinterUpdate::nActiveJobs = 0; +Timer* svp::PrinterUpdate::pPrinterUpdateTimer = NULL; +int svp::PrinterUpdate::nActiveJobs = 0; -void vcl_sal::PrinterUpdate::doUpdate() +void svp::PrinterUpdate::doUpdate() { ::psp::PrinterInfoManager& rManager( ::psp::PrinterInfoManager::get() ); if( rManager.checkPrintersChanged( false ) && SvpSalInstance::s_pDefaultInstance ) @@ -1017,7 +345,7 @@ void vcl_sal::PrinterUpdate::doUpdate() // ----------------------------------------------------------------------- -IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, ) +IMPL_STATIC_LINK_NOINSTANCE( svp::PrinterUpdate, UpdateTimerHdl, void*, ) { if( nActiveJobs < 1 ) { @@ -1033,7 +361,7 @@ IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, ) // ----------------------------------------------------------------------- -void vcl_sal::PrinterUpdate::update() +void svp::PrinterUpdate::update() { if( Application::GetSettings().GetMiscSettings().GetDisablePrinting() ) return; @@ -1053,14 +381,19 @@ void vcl_sal::PrinterUpdate::update() { pPrinterUpdateTimer = new Timer(); pPrinterUpdateTimer->SetTimeout( 500 ); - pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, vcl_sal::PrinterUpdate, UpdateTimerHdl ) ); + pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, svp::PrinterUpdate, UpdateTimerHdl ) ); pPrinterUpdateTimer->Start(); } } +void SvpSalInstance::updatePrinterUpdate() +{ + svp::PrinterUpdate::update(); +} + // ----------------------------------------------------------------------- -void vcl_sal::PrinterUpdate::jobEnded() +void svp::PrinterUpdate::jobEnded() { nActiveJobs--; if( nActiveJobs < 1 ) @@ -1074,3 +407,15 @@ void vcl_sal::PrinterUpdate::jobEnded() } } } + +void SvpSalInstance::jobStartedPrinterUpdate() +{ + svp::PrinterUpdate::jobStarted(); +} + +void SvpSalInstance::jobEndedPrinterUpdate() +{ + svp::PrinterUpdate::jobEnded(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/unx/headless/svpprn.hxx index d7064522e2b3..f7e6a671f4b3 100644 --- a/vcl/unx/headless/svpprn.hxx +++ b/vcl/unx/headless/svpprn.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,92 +33,25 @@ #include "printergfx.hxx" #include "printerjob.hxx" -#include "salprn.hxx" +#include <unx/salprn.h> #include "vclpluginapi.h" class PspGraphics; -class PspSalInfoPrinter : public SalInfoPrinter +class SvpSalInfoPrinter : public PspSalInfoPrinter { public: - PspGraphics* m_pGraphics; - psp::JobData m_aJobData; - psp::PrinterGfx m_aPrinterGfx; - - PspSalInfoPrinter(); - virtual ~PspSalInfoPrinter(); - - // overload all pure virtual methods - virtual SalGraphics* GetGraphics(); - virtual void ReleaseGraphics( SalGraphics* pGraphics ); virtual sal_Bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ); - virtual sal_Bool SetPrinterData( ImplJobSetup* pSetupData ); - virtual sal_Bool SetData( sal_uLong nFlags, ImplJobSetup* pSetupData ); - virtual void GetPageInfo( const ImplJobSetup* pSetupData, - long& rOutWidth, long& rOutHeight, - long& rPageOffX, long& rPageOffY, - long& rPageWidth, long& rPageHeight ); - virtual sal_uLong GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType ); - virtual sal_uLong GetPaperBinCount( const ImplJobSetup* pSetupData ); - virtual String GetPaperBinName( const ImplJobSetup* pSetupData, sal_uLong nPaperBin ); - virtual void InitPaperFormats( const ImplJobSetup* pSetupData ); - virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ); -}; - -class PspSalPrinter : public SalPrinter -{ -public: - String m_aFileName; - String m_aTmpFile; - String m_aFaxNr; - bool m_bFax:1; - bool m_bPdf:1; - bool m_bSwallowFaxNo:1; - PspGraphics* m_pGraphics; - psp::PrinterJob m_aPrintJob; - psp::JobData m_aJobData; - psp::PrinterGfx m_aPrinterGfx; - sal_uLong m_nCopies; - bool m_bCollate; - SalInfoPrinter* m_pInfoPrinter; - - PspSalPrinter( SalInfoPrinter* ); - virtual ~PspSalPrinter(); - - // overload all pure virtual methods - using SalPrinter::StartJob; - virtual sal_Bool StartJob( const XubString* pFileName, - const XubString& rJobName, - const XubString& rAppName, - sal_uLong nCopies, - bool bCollate, - bool bDirect, - ImplJobSetup* pSetupData ); - virtual sal_Bool EndJob(); - virtual sal_Bool AbortJob(); - virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJobData ); - virtual sal_Bool EndPage(); - virtual sal_uLong GetErrorCode(); }; -class Timer; - -namespace vcl_sal { -class VCLPLUG_SVP_PUBLIC PrinterUpdate +class SvpSalPrinter : public PspSalPrinter { - static Timer* pPrinterUpdateTimer; - static int nActiveJobs; - - static void doUpdate(); - DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* ); public: - static void update(); - static void jobStarted() { nActiveJobs++; } - static void jobEnded(); + SvpSalPrinter( SalInfoPrinter* pInfoPrinter ) : PspSalPrinter(pInfoPrinter) {} }; -} #endif // _SVP_SVPPRN_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index cdd664c7b76a..93fb0ced68b2 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,10 +59,10 @@ #include "region.h" using namespace psp; -using namespace rtl; using namespace basebmp; using namespace basegfx; - +using ::rtl::OUString; +using ::rtl::OString; // ----- Implementation of PrinterBmp by means of SalBitmap/BitmapBuffer --------------- class SalPrinterBmp : public psp::PrinterBmp @@ -206,7 +207,7 @@ void PspGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) } } -sal_uInt16 PspGraphics::GetBitCount() +sal_uInt16 PspGraphics::GetBitCount() const { return m_pPrinterGfx->GetBitCount(); } @@ -372,7 +373,7 @@ sal_Bool PspGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void void PspGraphics::copyBits( const SalTwoRect* /*pPosAry*/, SalGraphics* /*pSSrcGraphics*/ ) { - DBG_ERROR( "Error: PrinterGfx::CopyBits() not implemented" ); + OSL_FAIL( "Error: PrinterGfx::CopyBits() not implemented" ); } void PspGraphics::copyArea ( long /*nDestX*/, long /*nDestY*/, @@ -380,7 +381,7 @@ void PspGraphics::copyArea ( long /*nDestX*/, long /*nDestY*/, long /*nSrcWidth*/, long /*nSrcHeight*/, sal_uInt16 /*nFlags*/ ) { - DBG_ERROR( "Error: PrinterGfx::CopyArea() not implemented" ); + OSL_FAIL( "Error: PrinterGfx::CopyArea() not implemented" ); } void PspGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap ) @@ -402,21 +403,21 @@ void PspGraphics::drawBitmap( const SalTwoRect* /*pPosAry*/, const SalBitmap& /*rSalBitmap*/, const SalBitmap& /*rTransBitmap*/ ) { - DBG_ERROR("Error: no PrinterGfx::DrawBitmap() for transparent bitmap"); + OSL_FAIL("Error: no PrinterGfx::DrawBitmap() for transparent bitmap"); } void PspGraphics::drawBitmap( const SalTwoRect* /*pPosAry*/, const SalBitmap& /*rSalBitmap*/, SalColor /*nTransparentColor*/ ) { - DBG_ERROR("Error: no PrinterGfx::DrawBitmap() for transparent color"); + OSL_FAIL("Error: no PrinterGfx::DrawBitmap() for transparent color"); } void PspGraphics::drawMask( const SalTwoRect* /*pPosAry*/, const SalBitmap& /*rSalBitmap*/, SalColor /*nMaskColor*/ ) { - DBG_ERROR("Error: PrinterGfx::DrawMask() not implemented"); + OSL_FAIL("Error: PrinterGfx::DrawMask() not implemented"); } SalBitmap* PspGraphics::getBitmap( long /*nX*/, long /*nY*/, long /*nDX*/, long /*nDY*/ ) @@ -427,7 +428,7 @@ SalBitmap* PspGraphics::getBitmap( long /*nX*/, long /*nY*/, long /*nDX*/, long SalColor PspGraphics::getPixel( long /*nX*/, long /*nY*/ ) { - DBG_ERROR ("Warning: PrinterGfx::GetPixel() not implemented"); + OSL_FAIL("Warning: PrinterGfx::GetPixel() not implemented"); return 0; } @@ -438,7 +439,7 @@ void PspGraphics::invert( long /*nDY*/, SalInvert /*nFlags*/ ) { - DBG_ERROR ("Warning: PrinterGfx::Invert() not implemented"); + OSL_FAIL("Warning: PrinterGfx::Invert() not implemented"); } //========================================================================== @@ -693,6 +694,13 @@ const ImplFontCharMap* PspGraphics::GetImplFontCharMap() const return pIFCMap; } +bool PspGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const +{ + if (!m_pServerFont[0]) + return false; + return m_pServerFont[0]->GetFontCapabilities(rFontCapabilities); +} + sal_uInt16 PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) { // release all fonts that are to be overridden @@ -717,13 +725,13 @@ sal_uInt16 PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel bool bArtBold = false; if( pEntry->meItalic == ITALIC_OBLIQUE || pEntry->meItalic == ITALIC_NORMAL ) { - psp::italic::type eItalic = m_pPrinterGfx->GetFontMgr().getFontItalic( nID ); - if( eItalic != psp::italic::Italic && eItalic != psp::italic::Oblique ) + FontItalic eItalic = m_pPrinterGfx->GetFontMgr().getFontItalic( nID ); + if( eItalic != ITALIC_NORMAL && eItalic != ITALIC_OBLIQUE ) bArtItalic = true; } int nWeight = (int)pEntry->meWeight; int nRealWeight = (int)m_pPrinterGfx->GetFontMgr().getFontWeight( nID ); - if( nRealWeight <= (int)psp::weight::Medium && nWeight > (int)WEIGHT_MEDIUM ) + if( nRealWeight <= (int)WEIGHT_MEDIUM && nWeight > (int)WEIGHT_MEDIUM ) { bArtBold = true; } @@ -785,7 +793,7 @@ void PspGraphics::GetDevFontSubstList( OutputDevice* pOutDev ) const psp::PrinterInfo& rInfo = psp::PrinterInfoManager::get().getPrinterInfo( m_pJobData->m_aPrinterName ); if( rInfo.m_bPerformFontSubstitution ) { - for( std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator it = rInfo.m_aFontSubstitutes.begin(); it != rInfo.m_aFontSubstitutes.end(); ++it ) + for( boost::unordered_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator it = rInfo.m_aFontSubstitutes.begin(); it != rInfo.m_aFontSubstitutes.end(); ++it ) AddDevFontSubstitute( pOutDev, it->first, it->second, FONT_SUBSTITUTE_ALWAYS ); } } @@ -840,7 +848,7 @@ sal_uLong PspGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData *pKernPa return nHavePairs; } -sal_Bool PspGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) +sal_Bool PspGraphics::GetGlyphBoundRect( sal_GlyphId nGlyphIndex, Rectangle& rRect ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) @@ -850,13 +858,13 @@ sal_Bool PspGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) if( !pSF ) return sal_False; - nGlyphIndex &= ~GF_FONTMASK; + nGlyphIndex &= GF_IDXMASK; const GlyphMetric& rGM = pSF->GetGlyphMetric( nGlyphIndex ); rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() ); return sal_True; } -sal_Bool PspGraphics::GetGlyphOutline( long nGlyphIndex, +sal_Bool PspGraphics::GetGlyphOutline( sal_GlyphId nGlyphIndex, ::basegfx::B2DPolyPolygon& rB2DPolyPoly ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; @@ -867,7 +875,7 @@ sal_Bool PspGraphics::GetGlyphOutline( long nGlyphIndex, if( !pSF ) return sal_False; - nGlyphIndex &= ~GF_FONTMASK; + nGlyphIndex &= GF_IDXMASK; if( pSF->GetGlyphOutline( nGlyphIndex, rB2DPolyPoly ) ) return sal_True; @@ -1071,91 +1079,16 @@ void PspGraphics::DoGetGlyphWidths( psp::fontID aFont, // ---------------------------------------------------------------------------- -FontWidth PspGraphics::ToFontWidth (psp::width::type eWidth) -{ - switch (eWidth) - { - case psp::width::UltraCondensed: return WIDTH_ULTRA_CONDENSED; - case psp::width::ExtraCondensed: return WIDTH_EXTRA_CONDENSED; - case psp::width::Condensed: return WIDTH_CONDENSED; - case psp::width::SemiCondensed: return WIDTH_SEMI_CONDENSED; - case psp::width::Normal: return WIDTH_NORMAL; - case psp::width::SemiExpanded: return WIDTH_SEMI_EXPANDED; - case psp::width::Expanded: return WIDTH_EXPANDED; - case psp::width::ExtraExpanded: return WIDTH_EXTRA_EXPANDED; - case psp::width::UltraExpanded: return WIDTH_ULTRA_EXPANDED; - default: break; - } - return WIDTH_DONTKNOW; -} - -FontWeight PspGraphics::ToFontWeight (psp::weight::type eWeight) -{ - switch (eWeight) - { - case psp::weight::Thin: return WEIGHT_THIN; - case psp::weight::UltraLight: return WEIGHT_ULTRALIGHT; - case psp::weight::Light: return WEIGHT_LIGHT; - case psp::weight::SemiLight: return WEIGHT_SEMILIGHT; - case psp::weight::Normal: return WEIGHT_NORMAL; - case psp::weight::Medium: return WEIGHT_MEDIUM; - case psp::weight::SemiBold: return WEIGHT_SEMIBOLD; - case psp::weight::Bold: return WEIGHT_BOLD; - case psp::weight::UltraBold: return WEIGHT_ULTRABOLD; - case psp::weight::Black: return WEIGHT_BLACK; - default: break; - } - return WEIGHT_DONTKNOW; -} - -FontPitch PspGraphics::ToFontPitch (psp::pitch::type ePitch) -{ - switch (ePitch) - { - case psp::pitch::Fixed: return PITCH_FIXED; - case psp::pitch::Variable: return PITCH_VARIABLE; - default: break; - } - return PITCH_DONTKNOW; -} - -FontItalic PspGraphics::ToFontItalic (psp::italic::type eItalic) -{ - switch (eItalic) - { - case psp::italic::Upright: return ITALIC_NONE; - case psp::italic::Oblique: return ITALIC_OBLIQUE; - case psp::italic::Italic: return ITALIC_NORMAL; - default: break; - } - return ITALIC_DONTKNOW; -} - -FontFamily PspGraphics::ToFontFamily (psp::family::type eFamily) -{ - switch (eFamily) - { - case psp::family::Decorative: return FAMILY_DECORATIVE; - case psp::family::Modern: return FAMILY_MODERN; - case psp::family::Roman: return FAMILY_ROMAN; - case psp::family::Script: return FAMILY_SCRIPT; - case psp::family::Swiss: return FAMILY_SWISS; - case psp::family::System: return FAMILY_SYSTEM; - default: break; - } - return FAMILY_DONTKNOW; -} - ImplDevFontAttributes PspGraphics::Info2DevFontAttributes( const psp::FastPrintFontInfo& rInfo ) { ImplDevFontAttributes aDFA; aDFA.maName = rInfo.m_aFamilyName; aDFA.maStyleName = rInfo.m_aStyleName; - aDFA.meFamily = ToFontFamily (rInfo.m_eFamilyStyle); - aDFA.meWeight = ToFontWeight (rInfo.m_eWeight); - aDFA.meItalic = ToFontItalic (rInfo.m_eItalic); - aDFA.meWidthType = ToFontWidth (rInfo.m_eWidth); - aDFA.mePitch = ToFontPitch (rInfo.m_ePitch); + aDFA.meFamily = rInfo.m_eFamilyStyle; + aDFA.meWeight = rInfo.m_eWeight; + aDFA.meItalic = rInfo.m_eItalic; + aDFA.meWidthType = rInfo.m_eWidth; + aDFA.mePitch = rInfo.m_ePitch; aDFA.mbSymbolFlag = (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL); switch( rInfo.m_eType ) @@ -1360,7 +1293,8 @@ SystemGraphicsData PspGraphics::GetGraphicsData() const SystemGraphicsData aRes; aRes.nSize = sizeof(aRes); aRes.hDrawable = 0; - aRes.pRenderFormat = 0; + aRes.pXRenderFormat = 0; return aRes; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx index 74f2f097a1af..1ce9109918d5 100644 --- a/vcl/unx/headless/svppspgraphics.hxx +++ b/vcl/unx/headless/svppspgraphics.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,15 +80,10 @@ public: Ucs2UIntMap& rUnicodeEnc ); static ImplDevFontAttributes Info2DevFontAttributes( const psp::FastPrintFontInfo& ); static void AnnounceFonts( ImplDevFontList*, const psp::FastPrintFontInfo& ); - static FontWidth ToFontWidth (psp::width::type eWidth); - static FontWeight ToFontWeight (psp::weight::type eWeight); - static FontPitch ToFontPitch (psp::pitch::type ePitch); - static FontItalic ToFontItalic (psp::italic::type eItalic); - static FontFamily ToFontFamily (psp::family::type eFamily); // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual sal_uInt16 GetBitCount(); + virtual sal_uInt16 GetBitCount() const; virtual long GetGraphicsWidth() const; virtual void ResetClipRegion(); @@ -106,6 +102,7 @@ public: virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ); virtual const ImplFontCharMap* GetImplFontCharMap() const; + virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); @@ -128,8 +125,8 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual sal_Bool GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); + virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); + virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; @@ -189,3 +186,4 @@ public: #endif // _SVP_PSPGRAPHICS_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svptext.cxx b/vcl/unx/headless/svptext.cxx index 243e2b6ec422..18531baf1b52 100644 --- a/vcl/unx/headless/svptext.cxx +++ b/vcl/unx/headless/svptext.cxx @@ -1,4 +1,5 @@ -#/************************************************************************* +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -40,6 +41,7 @@ #include <outfont.hxx> #include <glyphcache.hxx> #include <impfont.hxx> +#include <rtl/instance.hxx> #include "svpgdi.hxx" #include "svpbmp.hxx" @@ -76,19 +78,49 @@ protected: class SvpGlyphCache : public GlyphCache { public: - SvpGlyphPeer& GetPeer() { return reinterpret_cast<SvpGlyphPeer&>( mrPeer ); } -static SvpGlyphCache& GetInstance(); -private: SvpGlyphCache( SvpGlyphPeer& rPeer ) : GlyphCache( rPeer) {} + SvpGlyphPeer& GetPeer() { return reinterpret_cast<SvpGlyphPeer&>( mrPeer ); } + static SvpGlyphCache& GetInstance(); }; -//-------------------------------------------------------------------------- +namespace +{ + struct GlyphCacheHolder + { + private: + SvpGlyphPeer* m_pSvpGlyphPeer; + SvpGlyphCache* m_pSvpGlyphCache; + public: + GlyphCacheHolder() + { + m_pSvpGlyphPeer = new SvpGlyphPeer(); + m_pSvpGlyphCache = new SvpGlyphCache( *m_pSvpGlyphPeer ); + } + void release() + { + delete m_pSvpGlyphCache; + delete m_pSvpGlyphPeer; + m_pSvpGlyphCache = NULL; + m_pSvpGlyphPeer = NULL; + } + SvpGlyphCache& getGlyphCache() + { + return *m_pSvpGlyphCache; + } + ~GlyphCacheHolder() + { + release(); + } + }; + + struct theGlyphCacheHolder : + public rtl::Static<GlyphCacheHolder, theGlyphCacheHolder> + {}; +} SvpGlyphCache& SvpGlyphCache::GetInstance() { - static SvpGlyphPeer aSvpGlyphPeer; - static SvpGlyphCache aGC( aSvpGlyphPeer ); - return aGC; + return theGlyphCacheHolder::get().getGlyphCache(); } // =========================================================================== @@ -117,7 +149,7 @@ BitmapDeviceSharedPtr SvpGlyphPeer::GetGlyphBmp( ServerFont& rServerFont, bFound = rServerFont.GetGlyphBitmap8( nGlyphIndex, pGcpHelper->maRawBitmap ); break; default: - DBG_ERROR( "SVP GCP::GetGlyphBmp(): illegal scanline format"); + OSL_FAIL( "SVP GCP::GetGlyphBmp(): illegal scanline format"); // fall back to black&white mask nBmpFormat = Format::ONE_BIT_LSB_GREY; bFound = false; @@ -192,8 +224,6 @@ void PspKernInfo::Initialize() const if( rKernPairs.empty() ) return; - // feed psprint's kerning list into a lookup-friendly container - maUnicodeKernPairs.resize( rKernPairs.size() ); PspKernPairs::const_iterator it = rKernPairs.begin(); for(; it != rKernPairs.end(); ++it ) { @@ -281,6 +311,14 @@ const ImplFontCharMap* SvpSalGraphics::GetImplFontCharMap() const return pIFCMap; } +bool SvpSalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const +{ + if (!m_pServerFont[0]) + return false; + + return m_pServerFont[0]->GetFontCapabilities(rFontCapabilities); +} + // --------------------------------------------------------------------------- void SvpSalGraphics::GetDevFontList( ImplDevFontList* pDevFontList ) @@ -422,7 +460,7 @@ void SvpSalGraphics::GetGlyphWidths( const ImplFontData* pFont, // --------------------------------------------------------------------------- -sal_Bool SvpSalGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) +sal_Bool SvpSalGraphics::GetGlyphBoundRect( sal_GlyphId nGlyphIndex, Rectangle& rRect ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) @@ -432,7 +470,7 @@ sal_Bool SvpSalGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) if( !pSF ) return sal_False; - nGlyphIndex &= ~GF_FONTMASK; + nGlyphIndex &= GF_IDXMASK; const GlyphMetric& rGM = pSF->GetGlyphMetric( nGlyphIndex ); rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() ); return sal_True; @@ -440,7 +478,7 @@ sal_Bool SvpSalGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) // --------------------------------------------------------------------------- -sal_Bool SvpSalGraphics::GetGlyphOutline( long nGlyphIndex, B2DPolyPolygon& rPolyPoly ) +sal_Bool SvpSalGraphics::GetGlyphOutline( sal_GlyphId nGlyphIndex, B2DPolyPolygon& rPolyPoly ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) @@ -450,7 +488,7 @@ sal_Bool SvpSalGraphics::GetGlyphOutline( long nGlyphIndex, B2DPolyPolygon& rPol if( !pSF ) return sal_False; - nGlyphIndex &= ~GF_FONTMASK; + nGlyphIndex &= GF_IDXMASK; if( pSF->GetGlyphOutline( nGlyphIndex, rPolyPoly ) ) return sal_True; @@ -486,7 +524,7 @@ void SvpSalGraphics::DrawServerFontLayout( const ServerFontLayout& rSalLayout ) continue; // get the glyph's alpha mask and adjust the drawing position - nGlyphIndex &= ~GF_FONTMASK; + nGlyphIndex &= GF_IDXMASK; B2IPoint aDstPoint( aPos.X(), aPos.Y() ); BitmapDeviceSharedPtr aAlphaMask = rGlyphPeer.GetGlyphBmp( *pSF, nGlyphIndex, m_eTextFmt, aDstPoint ); @@ -500,3 +538,5 @@ void SvpSalGraphics::DrawServerFontLayout( const ServerFontLayout& rSalLayout ) } // =========================================================================== + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpvd.cxx b/vcl/unx/headless/svpvd.cxx index 4afbaefbfe7c..8477da7b3bfc 100644 --- a/vcl/unx/headless/svpvd.cxx +++ b/vcl/unx/headless/svpvd.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -108,3 +109,4 @@ void SvpSalVirtualDevice::GetSize( long& rWidth, long& rHeight ) rWidth = rHeight = 0; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpvd.hxx b/vcl/unx/headless/svpvd.hxx index d66a31905c04..211cf36846f9 100644 --- a/vcl/unx/headless/svpvd.hxx +++ b/vcl/unx/headless/svpvd.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,3 +58,5 @@ public: }; #endif // _SVP_SVPVD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index a6badfbea23e..c13c0238f822 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,7 @@ #include "precompiled_vcl.hxx" #define _SV_SALDATA_CXX -#include <shell/kde_headers.h> +#include <unx/kde/kde_headers.h> #include <unistd.h> #include <fcntl.h> @@ -49,12 +50,10 @@ #include <osl/thread.h> #include <osl/process.h> #include <osl/module.h> +#include <osl/mutex.hxx> #include <tools/debug.hxx> -#include <vos/process.hxx> -#include <vos/mutex.hxx> - #include "unx/kde/kdedata.hxx" #include "unx/i18n_im.hxx" #include "unx/i18n_xkb.hxx" @@ -101,7 +100,7 @@ SalKDEDisplay::~SalKDEDisplay() KDEXLib::~KDEXLib() { - // #158056# on 64 bit linux using libXRandr.so.2 will crash in + // on 64 bit linux using libXRandr.so.2 will crash in // XCloseDisplay when freeing extension data // no known work around, therefor currently leak. Hopefully // this does not make problems since we're shutting down anyway @@ -125,15 +124,15 @@ void KDEXLib::Init() pInputMethod->SetLocale(); XrmInitialize(); - KAboutData *kAboutData = new KAboutData( "OpenOffice.org", - I18N_NOOP( "OpenOffice.org" ), + KAboutData *kAboutData = new KAboutData( "LibreOffice", + I18N_NOOP( "LibreOffice" ), "1.1.0", - I18N_NOOP( "OpenOffice.org with KDE Native Widget Support." ), + I18N_NOOP( "LibreOffice with KDE Native Widget Support." ), KAboutData::License_LGPL, "(c) 2003, 2004 Novell, Inc", - I18N_NOOP( "OpenOffice.org is an office suite.\n" ), - "http://kde.openoffice.org/index.html", - "dev@kde.openoffice.org"); + I18N_NOOP( "LibreOffice is an office suite.\n" ), + "http://libreoffice.org", + "libreoffice@lists.freedesktop.org"); kAboutData->addAuthor( "Jan Holesovsky", I18N_NOOP( "Original author and maintainer of the KDE NWF." ), "kendy@artax.karlin.mff.cuni.cz", @@ -141,17 +140,16 @@ void KDEXLib::Init() m_nFakeCmdLineArgs = 1; sal_uInt16 nIdx; - vos::OExtCommandLine aCommandLine; - int nParams = aCommandLine.getCommandArgCount(); + int nParams = osl_getCommandArgCount(); rtl::OString aDisplay; rtl::OUString aParam, aBin; for ( nIdx = 0; nIdx < nParams; ++nIdx ) { - aCommandLine.getCommandArg( nIdx, aParam ); - if ( !m_pFreeCmdLineArgs && aParam.equalsAscii( "-display" ) && nIdx + 1 < nParams ) + osl_getCommandArg( nIdx, &aParam.pData ); + if ( !m_pFreeCmdLineArgs && aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-display" ) ) && nIdx + 1 < nParams ) { - aCommandLine.getCommandArg( nIdx + 1, aParam ); + osl_getCommandArg( nIdx + 1, &aParam.pData ); aDisplay = rtl::OUStringToOString( aParam, osl_getThreadTextEncoding() ); m_nFakeCmdLineArgs = 3; @@ -193,7 +191,7 @@ void KDEXLib::Init() SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp ); XSync( pDisp, False ); - pKbdExtension->UseExtension( ! HasXErrorOccured() ); + pKbdExtension->UseExtension( ! HasXErrorOccurred() ); PopXErrorLevel(); pSalDisplay->SetKbdExtension( pKbdExtension ); @@ -275,3 +273,5 @@ extern "C" { return pInstance; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index c9f35b295511..2bde43b0df89 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,7 @@ #include "precompiled_vcl.hxx" #define _SV_SALNATIVEWIDGETS_KDE_CXX -#include <shell/kde_headers.h> +#include <unx/kde/kde_headers.h> #include <unx/salunx.h> #include <unx/saldata.hxx> @@ -39,6 +40,7 @@ #include <unx/kde/kdedata.hxx> #include <vcl/settings.hxx> +#include <vcl/vclenum.hxx> #include <rtl/ustrbuf.hxx> @@ -390,7 +392,11 @@ WidgetPainter::WidgetPainter( void ) m_pToolBarVert( NULL ), m_pToolButton( NULL ), m_pMenuBar( NULL ), + m_nMenuBarEnabledItem( 0 ), + m_nMenuBarDisabledItem( 0 ), m_pPopupMenu( NULL ), + m_nPopupMenuEnabledItem( 0 ), + m_nPopupMenuDisabledItem( 0 ), m_pProgressBar( NULL ) { } @@ -1752,41 +1758,41 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r aInfo.m_aFamilyName = String( rQFont.family().utf8(), RTL_TEXTENCODING_UTF8 ); // set italic - aInfo.m_eItalic = ( qFontInfo.italic()? psp::italic::Italic: psp::italic::Upright ); + aInfo.m_eItalic = ( qFontInfo.italic()? ITALIC_NORMAL: ITALIC_NONE ); // set weight int nWeight = qFontInfo.weight(); if ( nWeight <= QFont::Light ) - aInfo.m_eWeight = psp::weight::Light; + aInfo.m_eWeight = WEIGHT_LIGHT; else if ( nWeight <= QFont::Normal ) - aInfo.m_eWeight = psp::weight::Normal; + aInfo.m_eWeight = WEIGHT_NORMAL; else if ( nWeight <= QFont::DemiBold ) - aInfo.m_eWeight = psp::weight::SemiBold; + aInfo.m_eWeight = WEIGHT_SEMIBOLD; else if ( nWeight <= QFont::Bold ) - aInfo.m_eWeight = psp::weight::Bold; + aInfo.m_eWeight = WEIGHT_BOLD; else - aInfo.m_eWeight = psp::weight::UltraBold; + aInfo.m_eWeight = WEIGHT_ULTRABOLD; // set width int nStretch = rQFont.stretch(); if ( nStretch <= QFont::UltraCondensed ) - aInfo.m_eWidth = psp::width::UltraCondensed; + aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED; else if ( nStretch <= QFont::ExtraCondensed ) - aInfo.m_eWidth = psp::width::ExtraCondensed; + aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED; else if ( nStretch <= QFont::Condensed ) - aInfo.m_eWidth = psp::width::Condensed; + aInfo.m_eWidth = WIDTH_CONDENSED; else if ( nStretch <= QFont::SemiCondensed ) - aInfo.m_eWidth = psp::width::SemiCondensed; + aInfo.m_eWidth = WIDTH_SEMI_CONDENSED; else if ( nStretch <= QFont::Unstretched ) - aInfo.m_eWidth = psp::width::Normal; + aInfo.m_eWidth = WIDTH_NORMAL; else if ( nStretch <= QFont::SemiExpanded ) - aInfo.m_eWidth = psp::width::SemiExpanded; + aInfo.m_eWidth = WIDTH_SEMI_EXPANDED; else if ( nStretch <= QFont::Expanded ) - aInfo.m_eWidth = psp::width::Expanded; + aInfo.m_eWidth = WIDTH_EXPANDED; else if ( nStretch <= QFont::ExtraExpanded ) - aInfo.m_eWidth = psp::width::ExtraExpanded; + aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED; else - aInfo.m_eWidth = psp::width::UltraExpanded; + aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED; #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "font name BEFORE system match: \"%s\"\n", OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); @@ -1808,14 +1814,14 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r // Create the font Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) ); - if( aInfo.m_eWeight != psp::weight::Unknown ) - aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) ); - if( aInfo.m_eWidth != psp::width::Unknown ) - aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) ); - if( aInfo.m_eItalic != psp::italic::Unknown ) - aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) ); - if( aInfo.m_ePitch != psp::pitch::Unknown ) - aFont.SetPitch( PspGraphics::ToFontPitch( aInfo.m_ePitch ) ); + if( aInfo.m_eWeight != WEIGHT_DONTKNOW ) + aFont.SetWeight( aInfo.m_eWeight ); + if( aInfo.m_eWidth != WIDTH_DONTKNOW ) + aFont.SetWidthType( aInfo.m_eWidth ); + if( aInfo.m_eItalic != ITALIC_DONTKNOW ) + aFont.SetItalic( aInfo.m_eItalic ); + if( aInfo.m_ePitch != PITCH_DONTKNOW ) + aFont.SetPitch( aInfo.m_ePitch ); return aFont; } @@ -1827,6 +1833,8 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) StyleSettings aStyleSettings( rSettings.GetStyleSettings() ); bool bSetTitleFont = false; + aStyleSettings.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_LARGE ); + // WM settings KConfig *pConfig = KGlobal::config(); if ( pConfig ) @@ -1915,17 +1923,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetFaceColor( aBack ); aStyleSettings.SetInactiveTabColor( aBack ); aStyleSettings.SetDialogColor( aBack ); - if( aBack == COL_LIGHTGRAY ) - aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - Color aColor2 = aStyleSettings.GetLightColor(); - aStyleSettings. - SetCheckedColor( Color( (sal_uInt8)(((sal_uInt16)aBack.GetRed()+(sal_uInt16)aColor2.GetRed())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) - ) ); - } + aStyleSettings.SetCheckedColorSpecialCase( ); // Selection aStyleSettings.SetHighlightColor( toColor( qColorGroup.highlight() ) ); @@ -1936,9 +1934,6 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetAppFont( aFont ); aStyleSettings.SetHelpFont( aFont ); - if( !bSetTitleFont ) - aStyleSettings.SetTitleFont( aFont ); - aStyleSettings.SetFloatTitleFont( aFont ); aStyleSettings.SetMenuFont( aFont ); // will be changed according to pMenuBar aStyleSettings.SetToolFont( aFont ); // will be changed according to pToolBar aStyleSettings.SetLabelFont( aFont ); @@ -1948,6 +1943,12 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetFieldFont( aFont ); aStyleSettings.SetIconFont( aFont ); aStyleSettings.SetGroupFont( aFont ); + + aFont.SetWeight( WEIGHT_BOLD ); + if( !bSetTitleFont ) + aStyleSettings.SetTitleFont( aFont ); + aStyleSettings.SetFloatTitleFont( aFont ); + int flash_time = QApplication::cursorFlashTime(); aStyleSettings.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME ); @@ -2105,3 +2106,5 @@ void KDEData::deInitNWF() // We have to destroy the style early kapp->setStyle( NULL ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDEData.cxx b/vcl/unx/kde4/KDEData.cxx index dcf1db32068e..97654cf41e76 100644 --- a/vcl/unx/kde4/KDEData.cxx +++ b/vcl/unx/kde4/KDEData.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,3 +53,5 @@ void KDEData::initNWF() void KDEData::deInitNWF() { } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDEData.hxx b/vcl/unx/kde4/KDEData.hxx index 753deb697e95..db1e12226673 100644 --- a/vcl/unx/kde4/KDEData.hxx +++ b/vcl/unx/kde4/KDEData.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,3 +41,5 @@ class KDEData : public X11SalData virtual void initNWF(); virtual void deInitNWF(); }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalDisplay.cxx b/vcl/unx/kde4/KDESalDisplay.cxx index 41fa9fedde3f..2b2cb510b4d4 100644 --- a/vcl/unx/kde4/KDESalDisplay.cxx +++ b/vcl/unx/kde4/KDESalDisplay.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,10 +29,19 @@ #include "KDESalDisplay.hxx" #include "KDEXLib.hxx" +#include "VCLKDEApplication.hxx" + +#include <assert.h> +#include <unx/saldata.hxx> + +SalKDEDisplay* SalKDEDisplay::selfptr = NULL; SalKDEDisplay::SalKDEDisplay( Display* pDisp ) : SalX11Display( pDisp ) { + assert( selfptr == NULL ); + selfptr = this; + xim_protocol = XInternAtom( pDisp_, "_XIM_PROTOCOL", False ); } SalKDEDisplay::~SalKDEDisplay() @@ -40,6 +50,48 @@ SalKDEDisplay::~SalKDEDisplay() static_cast<KDEXLib*>(GetXLib())->doStartup(); // clean up own members doDestruct(); + selfptr = NULL; // prevent SalDisplay from closing KApplication's display pDisp_ = NULL; } + +void SalKDEDisplay::Yield() +{ + if( DispatchInternalEvent() ) + return; + + DBG_ASSERT( static_cast<SalYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex())->GetThreadId() == + osl::Thread::getCurrentIdentifier(), + "will crash soon since solar mutex not locked in SalKDEDisplay::Yield" ); + + XEvent event; + XNextEvent( pDisp_, &event ); + if( checkDirectInputEvent( &event )) + return; + qApp->x11ProcessEvent( &event ); +} + +// HACK: When using Qt event loop, input methods (japanese, etc.) will get broken because +// of XFilterEvent() getting called twice, once by Qt, once by LO (bnc#665112). +// This function is therefore called before any XEvent is passed to Qt event handling +// and if it is a keyboard event and no Qt widget is the active window (i.e. we are +// processing events for some LO window), then feed the event only to LO directly and skip Qt +// completely. Skipped events are KeyPress, KeyRelease and also _XIM_PROTOCOL client message +// (seems to be necessary too, hopefully there are not other internal XIM messages that +// would need this handling). +bool SalKDEDisplay::checkDirectInputEvent( XEvent* ev ) +{ + if( ev->xany.type == XLIB_KeyPress || ev->xany.type == KeyRelease + || ( ev->xany.type == ClientMessage && ev->xclient.message_type == xim_protocol )) + { + if( qApp->activeWindow() == NULL ) + { + Dispatch(ev); + return true; + } + } + return false; +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalDisplay.hxx b/vcl/unx/kde4/KDESalDisplay.hxx index 8287bbfb9bda..5fd1e4459660 100644 --- a/vcl/unx/kde4/KDESalDisplay.hxx +++ b/vcl/unx/kde4/KDESalDisplay.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,6 +34,22 @@ class SalKDEDisplay : public SalX11Display { public: SalKDEDisplay( Display* pDisp ); - virtual ~SalKDEDisplay(); + virtual ~SalKDEDisplay(); + static SalKDEDisplay* self(); + inline int userEventsCount() const { return m_aUserEvents.size(); } + inline void EventGuardAcquire() { osl_acquireMutex( hEventGuard_ ); } + inline void EventGuardRelease() { osl_releaseMutex( hEventGuard_ ); } +// virtual long Dispatch( XEvent *event ); + virtual void Yield(); + bool checkDirectInputEvent( XEvent* ev ); + private: + Atom xim_protocol; + static SalKDEDisplay* selfptr; }; +inline SalKDEDisplay* SalKDEDisplay::self() +{ + return selfptr; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 1e96c3e2f7a4..98b84ce54d7a 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -88,14 +89,7 @@ static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey ) } #if 0 -/** Helper function to read color from KConfig configuration repository. -*/ -static Color readColor( KConfigGroup *pGroup, const char *pKey ) -{ - return toColor( pGroup->readEntry( pKey, QColor(Qt::white) ) ); -} #endif - /** Helper function to add information to Font from QFont. Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx). @@ -109,41 +103,41 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r aInfo.m_aFamilyName = String( (const char *) rQFont.family().toUtf8(), RTL_TEXTENCODING_UTF8 ); // set italic - aInfo.m_eItalic = ( qFontInfo.italic()? psp::italic::Italic: psp::italic::Upright ); + aInfo.m_eItalic = ( qFontInfo.italic()? ITALIC_NORMAL: ITALIC_NONE ); // set weight int nWeight = qFontInfo.weight(); if ( nWeight <= QFont::Light ) - aInfo.m_eWeight = psp::weight::Light; + aInfo.m_eWeight = WEIGHT_LIGHT; else if ( nWeight <= QFont::Normal ) - aInfo.m_eWeight = psp::weight::Normal; + aInfo.m_eWeight = WEIGHT_NORMAL; else if ( nWeight <= QFont::DemiBold ) - aInfo.m_eWeight = psp::weight::SemiBold; + aInfo.m_eWeight = WEIGHT_SEMIBOLD; else if ( nWeight <= QFont::Bold ) - aInfo.m_eWeight = psp::weight::Bold; + aInfo.m_eWeight = WEIGHT_BOLD; else - aInfo.m_eWeight = psp::weight::UltraBold; + aInfo.m_eWeight = WEIGHT_ULTRABOLD; // set width int nStretch = rQFont.stretch(); if ( nStretch <= QFont::UltraCondensed ) - aInfo.m_eWidth = psp::width::UltraCondensed; + aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED; else if ( nStretch <= QFont::ExtraCondensed ) - aInfo.m_eWidth = psp::width::ExtraCondensed; + aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED; else if ( nStretch <= QFont::Condensed ) - aInfo.m_eWidth = psp::width::Condensed; + aInfo.m_eWidth = WIDTH_CONDENSED; else if ( nStretch <= QFont::SemiCondensed ) - aInfo.m_eWidth = psp::width::SemiCondensed; + aInfo.m_eWidth = WIDTH_SEMI_CONDENSED; else if ( nStretch <= QFont::Unstretched ) - aInfo.m_eWidth = psp::width::Normal; + aInfo.m_eWidth = WIDTH_NORMAL; else if ( nStretch <= QFont::SemiExpanded ) - aInfo.m_eWidth = psp::width::SemiExpanded; + aInfo.m_eWidth = WIDTH_SEMI_EXPANDED; else if ( nStretch <= QFont::Expanded ) - aInfo.m_eWidth = psp::width::Expanded; + aInfo.m_eWidth = WIDTH_EXPANDED; else if ( nStretch <= QFont::ExtraExpanded ) - aInfo.m_eWidth = psp::width::ExtraExpanded; + aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED; else - aInfo.m_eWidth = psp::width::UltraExpanded; + aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED; #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "font name BEFORE system match: \"%s\"\n", OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); @@ -165,14 +159,14 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r // Create the font Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) ); - if( aInfo.m_eWeight != psp::weight::Unknown ) - aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) ); - if( aInfo.m_eWidth != psp::width::Unknown ) - aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) ); - if( aInfo.m_eItalic != psp::italic::Unknown ) - aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) ); - if( aInfo.m_ePitch != psp::pitch::Unknown ) - aFont.SetPitch( PspGraphics::ToFontPitch( aInfo.m_ePitch ) ); + if( aInfo.m_eWeight != WEIGHT_DONTKNOW ) + aFont.SetWeight( aInfo.m_eWeight ); + if( aInfo.m_eWidth != WIDTH_DONTKNOW ) + aFont.SetWidthType( aInfo.m_eWidth ); + if( aInfo.m_eItalic != ITALIC_DONTKNOW ) + aFont.SetItalic( aInfo.m_eItalic ); + if( aInfo.m_ePitch != PITCH_DONTKNOW ) + aFont.SetPitch( aInfo.m_ePitch ); return aFont; } @@ -187,6 +181,8 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) // General settings QPalette pal = kapp->palette(); + style.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_LARGE ); + style.SetActiveColor(toColor(pal.color(QPalette::Active, QPalette::Window))); style.SetDeactiveColor(toColor(pal.color(QPalette::Inactive, QPalette::Window))); @@ -268,18 +264,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetFaceColor( aBack ); style.SetInactiveTabColor( aBack ); style.SetDialogColor( aBack ); - - if( aBack == COL_LIGHTGRAY ) - style.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - Color aColor2 = style.GetLightColor(); - style. - SetCheckedColor( Color( (sal_uInt8)(((sal_uInt16)aBack.GetRed()+(sal_uInt16)aColor2.GetRed())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) - ) ); - } + style.SetCheckedColorSpecialCase( ); // Selection style.SetHighlightColor( aHigh ); @@ -291,12 +276,6 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetAppFont( aFont ); style.SetHelpFont( aFont ); - if( !bSetTitleFont ) - { - style.SetTitleFont( aFont ); - } - - style.SetFloatTitleFont( aFont ); style.SetMenuFont( aFont ); // will be changed according to pMenuBar //style.SetToolFont( aFont ); //already set above style.SetLabelFont( aFont ); @@ -307,6 +286,13 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetIconFont( aFont ); style.SetGroupFont( aFont ); + aFont.SetWeight( WEIGHT_BOLD ); + if( !bSetTitleFont ) + { + style.SetTitleFont( aFont ); + } + style.SetFloatTitleFont( aFont ); + int flash_time = QApplication::cursorFlashTime(); style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME ); @@ -349,6 +335,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) // Scroll bar size style.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) ); + style.SetMinThumbSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarSliderMin )); rSettings.SetStyleSettings( style ); } @@ -406,3 +393,5 @@ SalGraphics* KDESalFrame::GetGraphics() return NULL; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalFrame.hxx b/vcl/unx/kde4/KDESalFrame.hxx index c5071ce85ffa..7658ea036bb2 100644 --- a/vcl/unx/kde4/KDESalFrame.hxx +++ b/vcl/unx/kde4/KDESalFrame.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,3 +57,5 @@ class KDESalFrame : public X11SalFrame virtual void UpdateSettings( AllSettings& rSettings ); virtual void Show( sal_Bool bVisible, sal_Bool bNoActivate ); }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 9b37bf5e8e2a..5dbe49167a1a 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,14 +40,15 @@ #include <QLabel> #include <kapplication.h> +#include <kdebug.h> #undef Region #include "KDESalGraphics.hxx" -#include "vcl/settings.hxx" -#include "vcl/decoview.hxx" -#include "rtl/ustrbuf.hxx" +#include <vcl/settings.hxx> +#include <vcl/decoview.hxx> +#include <rtl/ustrbuf.hxx> using namespace ::rtl; @@ -144,41 +146,33 @@ sal_Bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA) ) return true; + if ( (type == CTRL_PROGRESS) && (part == PART_ENTIRE_CONTROL) ) return true; + return false; if ( (type == CTRL_TAB_ITEM) && (part == PART_ENTIRE_CONTROL) ) return true; if ( (type == CTRL_TAB_PANE) && (part == PART_ENTIRE_CONTROL) ) return true; // no CTRL_TAB_BODY for KDE - if ( (type == CTRL_PROGRESS) && (part == PART_ENTIRE_CONTROL) ) return true; return false; } -sal_Bool KDESalGraphics::hitTestNativeControl( ControlType, ControlPart, - const Rectangle&, const Point&, - sal_Bool& ) -{ - return FALSE; -} - /// helper drawing methods namespace { - void draw( QStyle::ControlElement element, QStyleOption* option, QImage* image, QStyle::State state ) + void draw( QStyle::ControlElement element, QStyleOption* option, QImage* image, QStyle::State state, QRect rect = QRect()) { option->state |= state; - option->rect = image->rect(); + option->rect = !rect.isNull() ? rect : image->rect(); QPainter painter(image); kapp->style()->drawControl(element, option, &painter); } - void draw( QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, QStyle::State state, int nAdjust = 0 ) + void draw( QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, QStyle::State state, QRect rect = QRect()) { option->state |= state; - option->rect = image->rect(); - if( nAdjust ) - option->rect.adjust( nAdjust, nAdjust, -nAdjust, -nAdjust ); + option->rect = !rect.isNull() ? rect : image->rect(); QPainter painter(image); kapp->style()->drawPrimitive(element, option, &painter); @@ -232,18 +226,54 @@ namespace } } +#if QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) +#define IMAGE_BASED_PAINTING +#else +#undef IMAGE_BASED_PAINTING +#endif + +#ifdef IMAGE_BASED_PAINTING +// There is a small catch with this function, although hopefully only philosophical. +// Officially Xlib's Region is an opaque data type, with only functions for manipulating it. +// However, whoever designed it apparently didn't give it that much thought, as it's impossible +// to find out what exactly a region actually is (except for really weird ways like XClipBox() +// and repeated XPointInRegion(), which would be awfully slow). Fortunately, the header file +// describing the structure actually happens to be installed too, and there's at least one +// widely used software using it (Compiz). So access the data directly too and assume that +// everybody who compiles with Qt4 support has Xlib new enough and good enough to support this. +// In case this doesn't work for somebody, try #include <X11/region.h> instead, or build +// without IMAGE_BASED_PAINTING (in which case QApplication::setGraphicsSystem( "native" ) may +// be needed too). +#include <X11/Xregion.h> +static QRegion XRegionToQRegion( XLIB_Region xr ) +{ + QRegion qr; + for( int i = 0; + i < xr->numRects; + ++i ) + { + BOX& b = xr->rects[ i ]; + qr |= QRect( b.x1, b.y1, b.x2 - b.x1, b.y2 - b.y1 ); // x2,y2 is outside, not the bottom-right corner + } + return qr; +} +#endif + sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, const Rectangle& rControlRegion, ControlState nControlState, const ImplControlValue& value, const OUString& ) { + if( lastPopupRect.isValid() && ( type != CTRL_MENU_POPUP || part != PART_MENU_ITEM )) + lastPopupRect = QRect(); + // put not implemented types here if (type == CTRL_SPINBUTTONS) { return false; } - sal_Bool returnVal = true; + sal_Bool returnVal = true; QRect widgetRect = region2QRect(rControlRegion); if( type == CTRL_SPINBOX && part == PART_ALL_BUTTONS ) @@ -270,8 +300,7 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } m_image->fill(KApplication::palette().color(QPalette::Window).rgb()); - - XLIB_Region pTempClipRegion = 0; + QRegion* clipRegion = NULL; if (type == CTRL_PUSHBUTTON) { @@ -297,35 +326,69 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == CTRL_MENU_POPUP) { - if (part == PART_MENU_ITEM) + OSL_ASSERT( part == PART_MENU_ITEM ? lastPopupRect.isValid() : !lastPopupRect.isValid()); + if( part == PART_MENU_ITEM ) { QStyleOptionMenuItem option; draw( QStyle::CE_MenuItem, &option, m_image, vclStateValue2StateFlag(nControlState, value) ); + // HACK: LO core first paints the entire popup and only then it paints menu items, + // but QMenu::paintEvent() paints popup frame after all items. That means highlighted + // items here would paint the highlight over the frame border. Since calls to PART_MENU_ITEM + // are always preceded by calls to PART_ENTIRE_CONTROL, just remember the size for the whole + // popup (otherwise not possible to get here) and draw the border afterwards. + QRect framerect( lastPopupRect.topLeft() - widgetRect.topLeft(), + widgetRect.size().expandedTo( lastPopupRect.size())); + QStyleOptionFrame frame; + draw( QStyle::PE_FrameMenu, &frame, m_image, vclStateValue2StateFlag( nControlState, value ), framerect ); } - else if (part == PART_MENU_ITEM_CHECK_MARK && (nControlState & CTRL_STATE_PRESSED) ) + else if( part == PART_MENU_SEPARATOR ) { - QStyleOptionButton option; - draw( QStyle::PE_IndicatorMenuCheckMark, &option, m_image, - vclStateValue2StateFlag(nControlState, value) ); + QStyleOptionMenuItem option; + option.menuItemType = QStyleOptionMenuItem::Separator; + // Painting the whole menu item area results in different background + // with at least Plastique style, so clip only to the separator itself + // (QSize( 2, 2 ) is hardcoded in Qt) + option.rect = m_image->rect(); + QSize size = kapp->style()->sizeFromContents( QStyle::CT_MenuItem, &option, QSize( 2, 2 )); + QRect rect = m_image->rect(); + QPoint center = rect.center(); + rect.setHeight( size.height()); + rect.moveCenter( center ); + // don't paint over popup frame border (like the hack above, but here it can be simpler) + int fw = kapp->style()->pixelMetric( QStyle::PM_MenuPanelWidth ); + clipRegion = new QRegion( rect.translated( widgetRect.topLeft()).adjusted( fw, 0, -fw, 0 )); + draw( QStyle::CE_MenuItem, &option, m_image, + vclStateValue2StateFlag(nControlState, value), rect ); } - else if (part == PART_MENU_ITEM_RADIO_MARK && (nControlState & CTRL_STATE_PRESSED) ) + else if( part == PART_MENU_ITEM_CHECK_MARK || part == PART_MENU_ITEM_RADIO_MARK ) { - QStyleOptionButton option; - draw( QStyle::PE_IndicatorRadioButton, &option, m_image, - vclStateValue2StateFlag(nControlState, value) ); + QStyleOptionMenuItem option; + option.checkType = ( part == PART_MENU_ITEM_CHECK_MARK ) + ? QStyleOptionMenuItem::NonExclusive : QStyleOptionMenuItem::Exclusive; + option.checked = ( nControlState & CTRL_STATE_PRESSED ); + // widgetRect is now the rectangle for the checkbox/radiobutton itself, but Qt + // paints the whole menu item, so translate position (and it'll be clipped); + // it is also necessary to fill the background transparently first, as this + // is painted after menuitem highlight, otherwise there would be a grey area + const MenupopupValue* menuVal = static_cast<const MenupopupValue*>(&value); + QRect menuItemRect( region2QRect( menuVal->maItemRect )); + QRect rect( menuItemRect.topLeft() - widgetRect.topLeft(), + widgetRect.size().expandedTo( menuItemRect.size())); + m_image->fill( Qt::transparent ); + draw( QStyle::CE_MenuItem, &option, m_image, + vclStateValue2StateFlag(nControlState, value), rect ); } - else + else if( part == PART_ENTIRE_CONTROL ) { - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - QStyleOptionFrameV3 option; - option.frameShape = QFrame::StyledPanel; - #else - QStyleOptionFrameV2 option; - #endif - draw( QStyle::PE_FrameMenu, &option, m_image, - vclStateValue2StateFlag(nControlState, value) ); + QStyleOptionMenuItem option; + draw( QStyle::PE_PanelMenu, &option, m_image, vclStateValue2StateFlag( nControlState, value )); + QStyleOptionFrame frame; + draw( QStyle::PE_FrameMenu, &frame, m_image, vclStateValue2StateFlag( nControlState, value )); + lastPopupRect = widgetRect; } + else + returnVal = false; } else if ( (type == CTRL_TOOLBAR) && (part == PART_BUTTON) ) { @@ -351,26 +414,25 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, vclStateValue2StateFlag(nControlState, value) ); } else if ( (type == CTRL_TOOLBAR) && (part == PART_THUMB_VERT) ) - { - const int tw = widgetRect.width(); - widgetRect.setWidth(kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent)); + { // reduce paint area only to the handle area + const int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent); + QRect rect( 0, 0, width, widgetRect.height()); + clipRegion = new QRegion( widgetRect.x(), widgetRect.y(), width, widgetRect.height()); QStyleOption option; option.state = QStyle::State_Horizontal; draw( QStyle::PE_IndicatorToolBarHandle, &option, m_image, - vclStateValue2StateFlag(nControlState, value) ); - - widgetRect.setWidth(tw); + vclStateValue2StateFlag(nControlState, value), rect ); } else if (type == CTRL_EDITBOX) { QStyleOptionFrameV2 option; draw( QStyle::PE_PanelLineEdit, &option, m_image, - vclStateValue2StateFlag(nControlState, value), 2 ); + vclStateValue2StateFlag(nControlState, value), m_image->rect().adjusted( 2, 2, -2, -2 )); draw( QStyle::PE_FrameLineEdit, &option, m_image, - vclStateValue2StateFlag(nControlState, value), 0 ); + vclStateValue2StateFlag(nControlState, value)); } else if (type == CTRL_COMBOBOX) { @@ -440,6 +502,7 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, //setup parameters from the OO values option.minimum = sbVal->mnMin; option.maximum = sbVal->mnMax - sbVal->mnVisibleSize; + option.maximum = qMax( option.maximum, option.minimum ); // bnc#619772 option.sliderValue = sbVal->mnCur; option.sliderPosition = sbVal->mnCur; option.pageStep = sbVal->mnVisibleSize; @@ -497,24 +560,8 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, vclStateValue2StateFlag(nControlState, value) ); // draw just the border, see http://qa.openoffice.org/issues/show_bug.cgi?id=107945 - int nFrameWidth = getFrameWidth(); - pTempClipRegion = XCreateRegion(); - XRectangle xRect = { widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height() }; - XUnionRectWithRegion( &xRect, pTempClipRegion, pTempClipRegion ); - xRect.x += nFrameWidth; - xRect.y += nFrameWidth; - - // do not crash for too small widgets, see http://qa.openoffice.org/issues/show_bug.cgi?id=112102 - if( xRect.width > 2*nFrameWidth && xRect.height > 2*nFrameWidth ) - { - xRect.width -= 2*nFrameWidth; - xRect.height -= 2*nFrameWidth; - - XLIB_Region pSubtract = XCreateRegion(); - XUnionRectWithRegion( &xRect, pSubtract, pSubtract ); - XSubtractRegion( pTempClipRegion, pSubtract, pTempClipRegion ); - XDestroyRegion( pSubtract ); - } + int fw = getFrameWidth(); + clipRegion = new QRegion( QRegion( widgetRect ).subtracted( widgetRect.adjusted( fw, fw, -fw, -fw ))); } else if (type == CTRL_FIXEDBORDER) { @@ -549,6 +596,18 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, draw( QStyle::CC_Slider, &option, m_image, vclStateValue2StateFlag(nControlState, value) ); } + else if( type == CTRL_PROGRESS && part == PART_ENTIRE_CONTROL ) + { + QStyleOptionProgressBarV2 option; + option.minimum = 0; + option.maximum = widgetRect.width(); + option.progress = value.getNumericVal(); + option.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); + option.state = vclStateValue2StateFlag( nControlState, value ); + + draw( QStyle::CE_ProgressBar, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); + } else { returnVal = false; @@ -556,12 +615,40 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, if (returnVal) { - GC gc = GetFontGC(); - +#ifdef IMAGE_BASED_PAINTING + // Create a wrapper QPixmap around the destination pixmap, allowing the use of QPainter. + // Using X11SalGraphics::CopyScreenArea() would require using QPixmap and if Qt uses + // other graphics system than native, QPixmap::handle() would be 0 (i.e. it wouldn't work), + // I have no idea how to create QPixmap with non-null handle() in such case, so go this way. + // See XRegionToQRegion() comment for a small catch (although not real hopefully). + QPixmap destPixmap = QPixmap::fromX11Pixmap( GetDrawable(), QPixmap::ExplicitlyShared ); + QPainter paint( &destPixmap ); + if( clipRegion && mpClipRegion ) + paint.setClipRegion( clipRegion->intersected( XRegionToQRegion( mpClipRegion ))); + else if( clipRegion ) + paint.setClipRegion( *clipRegion ); + else if( mpClipRegion ) + paint.setClipRegion( XRegionToQRegion( mpClipRegion )); + paint.drawImage( widgetRect.left(), widgetRect.top(), *m_image, + 0, 0, widgetRect.width(), widgetRect.height(), + Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither ); +#else + GC gc = SelectFont(); if( gc ) { - if( pTempClipRegion ) + XLIB_Region pTempClipRegion = NULL; + if( clipRegion ) { + pTempClipRegion = XCreateRegion(); + foreach( const QRect& r, clipRegion->rects()) + { + XRectangle xr; + xr.x = r.x(); + xr.y = r.y(); + xr.width = r.width(); + xr.height = r.height(); + XUnionRectWithRegion( &xr, pTempClipRegion, pTempClipRegion ); + } if( mpClipRegion ) XIntersectRegion( pTempClipRegion, mpClipRegion, pTempClipRegion ); XSetRegion( GetXDisplay(), gc, pTempClipRegion ); @@ -578,14 +665,14 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, XSetRegion( GetXDisplay(), gc, mpClipRegion ); else XSetClipMask( GetXDisplay(), gc, None ); + XDestroyRegion( pTempClipRegion ); } } else returnVal = false; +#endif } - if( pTempClipRegion ) - XDestroyRegion( pTempClipRegion ); - + delete clipRegion; return returnVal; } @@ -595,7 +682,7 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p const OUString&, Rectangle &nativeBoundingRegion, Rectangle &nativeContentRegion ) { - bool retVal = false; + sal_Bool retVal = false; QRect boundingRect = region2QRect( controlRegion ); QRect contentRect = boundingRect; @@ -750,16 +837,8 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p break; } case CTRL_MENU_POPUP: - //just limit the widget of the menu items - //OO isn't very flexible in all reguards with the menu - //so we do the best we can - if (part == PART_MENU_ITEM_CHECK_MARK) - { - contentRect.setWidth(contentRect.height()); - retVal = true; - } - else if (part == PART_MENU_ITEM_RADIO_MARK) - { + if (part == PART_MENU_ITEM_CHECK_MARK || part == PART_MENU_ITEM_RADIO_MARK) + { // core uses this to detect radio/checkbox sizes, so just set a square contentRect.setWidth(contentRect.height()); retVal = true; } @@ -815,79 +894,38 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p } break; } - default: - break; - } -#if 0 - - - // Metrics of the scroll bar case CTRL_SCROLLBAR: - //pWidget = pWidgetPainter->scrollBar( rControlRegion, - //( part == PART_BUTTON_LEFT || part == PART_BUTTON_RIGHT ), - //ImplControlValue() ); - //aStyleOption.initFrom( pWidget ); - - switch ( part ) + { + // core can't handle 3-button scrollbars well, so we fix that in hitTestNativeControl(), + // for the rest also provide the track area (i.e. area not taken by buttons) + if( part == PART_TRACK_VERT_AREA || part == PART_TRACK_HORZ_AREA ) { - case PART_BUTTON_LEFT: - case PART_BUTTON_UP: - qRect = kapp->style()->subControlRect( - QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarSubLine ); - - // Workaround for Platinum style scroll bars. It makes the - // left/up button invisible. - if ( part == PART_BUTTON_LEFT ) - { - if ( qRect.left() > kapp->style()->subControlRect( - QStyle::CC_ScrollBar, &aStyleOption, - QStyle::SC_ScrollBarSubPage ).left() ) - { - qRect.setLeft( 0 ); - qRect.setRight( 0 ); - } - } - else - { - if ( qRect.top() > kapp->style()->subControlRect( - QStyle::CC_ScrollBar, &aStyleOption, - QStyle::SC_ScrollBarSubPage ).top() ) - { - qRect.setTop( 0 ); - qRect.setBottom( 0 ); - } - } - - qRect.translate( qBoundingRect.left(), qBoundingRect.top() ); - - bReturn = TRUE; - break; - - case PART_BUTTON_RIGHT: - case PART_BUTTON_DOWN: - qRect = kapp->style()->subControlRect( - QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarAddLine ); - - // Workaround for Platinum and 3 button style scroll bars. - // It makes the right/down button bigger. - if ( part == PART_BUTTON_RIGHT ) - qRect.setLeft( kapp->style()->subControlRect( - QStyle::CC_ScrollBar, &aStyleOption, - QStyle::SC_ScrollBarAddPage ).right() + 1 ); - else - qRect.setTop( kapp->style()->subControlRect( - QStyle::CC_ScrollBar, &aStyleOption, - QStyle::SC_ScrollBarAddPage ).bottom() + 1 ); - - qRect.translate( qBoundingRect.left(), qBoundingRect.top() ); - - bReturn = TRUE; - break; + QStyleOptionSlider option; + option.orientation = ( part == PART_TRACK_HORZ_AREA ) ? Qt::Horizontal : Qt::Vertical; + // getNativeControlRegion usually gets ImplControlValue as 'val' (i.e. not the proper + // subclass), so use random sensible values (doesn't matter anyway, as the wanted + // geometry here depends only on button sizes) + option.maximum = 10; + option.minimum = 0; + option.sliderPosition = option.sliderValue = 4; + option.pageStep = 2; + // Adjust coordinates to make the widget appear to be at (0,0), i.e. make + // widget and screen coordinates the same. QStyle functions should use screen + // coordinates but at least QPlastiqueStyle::subControlRect() is buggy + // and sometimes uses widget coordinates. + QRect rect = contentRect; + rect.moveTo( 0, 0 ); + option.rect = rect; + rect = kapp->style()->subControlRect( QStyle::CC_ScrollBar, &option, + QStyle::SC_ScrollBarGroove ); + rect.translate( contentRect.topLeft()); // reverse the workaround above + contentRect = boundingRect = rect; + retVal = true; } + } + default: break; } -#endif - if (retVal) { // Bounding region @@ -903,3 +941,52 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p return retVal; } + +/** Test whether the position is in the native widget. + If the return value is TRUE, bIsInside contains information whether + aPos was or was not inside the native widget specified by the + nType/nPart combination. +*/ +sal_Bool KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, + const Rectangle& rControlRegion, const Point& rPos, + sal_Bool& rIsInside ) +{ + if ( nType == CTRL_SCROLLBAR ) + { + if( nPart != PART_BUTTON_UP && nPart != PART_BUTTON_DOWN + && nPart != PART_BUTTON_LEFT && nPart != PART_BUTTON_RIGHT ) + { // we adjust only for buttons (because some scrollbars have 3 buttons, + // and LO core doesn't handle such scrollbars well) + return FALSE; + } + rIsInside = FALSE; + bool bHorizontal = ( nPart == PART_BUTTON_LEFT || nPart == PART_BUTTON_RIGHT ); + QRect rect = region2QRect( rControlRegion ); + QPoint pos( rPos.X(), rPos.Y()); + // Adjust coordinates to make the widget appear to be at (0,0), i.e. make + // widget and screen coordinates the same. QStyle functions should use screen + // coordinates but at least QPlastiqueStyle::subControlRect() is buggy + // and sometimes uses widget coordinates. + pos -= rect.topLeft(); + rect.moveTo( 0, 0 ); + QStyleOptionSlider options; + options.orientation = bHorizontal ? Qt::Horizontal : Qt::Vertical; + options.rect = rect; + // some random sensible values, since we call this code only for scrollbar buttons, + // the slider position does not exactly matter + options.maximum = 10; + options.minimum = 0; + options.sliderPosition = options.sliderValue = 4; + options.pageStep = 2; + QStyle::SubControl control = kapp->style()->hitTestComplexControl( QStyle::CC_ScrollBar, &options, pos ); + if( nPart == PART_BUTTON_UP || nPart == PART_BUTTON_LEFT ) + rIsInside = ( control == QStyle::SC_ScrollBarSubLine ); + else // DOWN, RIGHT + rIsInside = ( control == QStyle::SC_ScrollBarAddLine ); + return TRUE; + } + return FALSE; +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx index ea1deebfc35c..2f4c3f384c75 100644 --- a/vcl/unx/kde4/KDESalGraphics.hxx +++ b/vcl/unx/kde4/KDESalGraphics.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,6 +40,7 @@ class KDESalGraphics : public X11SalGraphics { QImage* m_image; + QRect lastPopupRect; public: KDESalGraphics(); @@ -111,3 +113,5 @@ class KDESalGraphics : public X11SalGraphics const rtl::OUString& aCaption, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalInstance.cxx b/vcl/unx/kde4/KDESalInstance.cxx index c8d0858279f3..c63d328e29c3 100644 --- a/vcl/unx/kde4/KDESalInstance.cxx +++ b/vcl/unx/kde4/KDESalInstance.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,3 +34,5 @@ SalFrame* KDESalInstance::CreateFrame( SalFrame *pParent, sal_uLong nState ) { return new KDESalFrame( pParent, nState ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDESalInstance.hxx b/vcl/unx/kde4/KDESalInstance.hxx index 32f51c4e8c0e..a8efcd4dcde1 100644 --- a/vcl/unx/kde4/KDESalInstance.hxx +++ b/vcl/unx/kde4/KDESalInstance.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,5 @@ class KDESalInstance : public X11SalInstance virtual ~KDESalInstance() {} virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ); }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index 427c9e7576a8..28b514148f50 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,8 +26,6 @@ * ************************************************************************/ -#include <vos/process.hxx> - #include "VCLKDEApplication.hxx" #define Region QtXRegion @@ -36,6 +35,9 @@ #include <kaboutdata.h> #include <kcmdlineargs.h> #include <kstartupinfo.h> +#include <qabstracteventdispatcher.h> +#include <qclipboard.h> +#include <qthread.h> #undef Region @@ -45,6 +47,7 @@ #include <unx/i18n_xkb.hxx> #include <unx/saldata.hxx> +#include <osl/process.h> #include "KDESalDisplay.hxx" @@ -52,15 +55,40 @@ #include <stdio.h> #endif +#include <stdio.h> + +#if QT_VERSION >= QT_VERSION_CHECK( 4, 8, 0 ) +#define QT_UNIX_EVENT_LOOP_SUPPORT +#ifdef KDE_HAVE_GLIB +#define GLIB_EVENT_LOOP_SUPPORT +#endif +#endif + +#ifdef GLIB_EVENT_LOOP_SUPPORT +#include <glib-2.0/glib.h> +#endif + KDEXLib::KDEXLib() : SalXLib(), m_bStartupDone(false), m_pApplication(0), - m_pFreeCmdLineArgs(0), m_pAppCmdLineArgs(0), m_nFakeCmdLineArgs( 0 ) + m_pFreeCmdLineArgs(0), m_pAppCmdLineArgs(0), m_nFakeCmdLineArgs( 0 ), + eventLoopType( LibreOfficeEventLoop ) { + // the timers created here means they belong to the main thread + connect( &timeoutTimer, SIGNAL( timeout()), this, SLOT( timeoutActivated())); + connect( &userEventTimer, SIGNAL( timeout()), this, SLOT( userEventActivated())); + // QTimer::start() can be called only in its (here main) thread, so this will + // forward between threads if needed + connect( this, SIGNAL( startTimeoutTimerSignal()), this, SLOT( startTimeoutTimer()), Qt::QueuedConnection ); + connect( this, SIGNAL( startUserEventTimerSignal()), this, SLOT( startUserEventTimer()), Qt::QueuedConnection ); + // this one needs to be blocking, so that the handling in main thread is processed before + // the thread emitting the signal continues + connect( this, SIGNAL( processYieldSignal( bool, bool )), this, SLOT( processYield( bool, bool )), + Qt::BlockingQueuedConnection ); } KDEXLib::~KDEXLib() { - delete (VCLKDEApplication*)m_pApplication; + delete m_pApplication; // free the faked cmdline arguments no longer needed by KApplication for( int i = 0; i < m_nFakeCmdLineArgs; i++ ) @@ -78,16 +106,16 @@ void KDEXLib::Init() pInputMethod->SetLocale(); XrmInitialize(); - KAboutData *kAboutData = new KAboutData("OpenOffice.org", + KAboutData *kAboutData = new KAboutData("LibreOffice", "kdelibs4", - ki18n( "OpenOffice.org" ), - "3.0.0", - ki18n( "OpenOffice.org with KDE Native Widget Support." ), + ki18n( "LibreOffice" ), + "3.3.0", + ki18n( "LibreOffice with KDE Native Widget Support." ), KAboutData::License_LGPL, ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Novell, Inc"), - ki18n( "OpenOffice.org is an office suite.\n" ), - "http://kde.openoffice.org/index.html", - "dev@kde.openoffice.org" ); + ki18n( "LibreOffice is an office suite.\n" ), + "http://libreoffice.org", + "libreoffice@lists.freedesktop.org" ); kAboutData->addAuthor( ki18n( "Jan Holesovsky" ), ki18n( "Original author and maintainer of the KDE NWF." ), @@ -102,25 +130,25 @@ void KDEXLib::Init() //kAboutData->setProgramIconName("OpenOffice"); - m_nFakeCmdLineArgs = 1; - int nIdx; - vos::OExtCommandLine aCommandLine; - int nParams = aCommandLine.getCommandArgCount(); + m_nFakeCmdLineArgs = 2; + sal_uInt16 nIdx; + + int nParams = osl_getCommandArgCount(); rtl::OString aDisplay; rtl::OUString aParam, aBin; for ( nIdx = 0; nIdx < nParams; ++nIdx ) { - aCommandLine.getCommandArg( nIdx, aParam ); - if ( !m_pFreeCmdLineArgs && aParam.equalsAscii( "-display" ) && nIdx + 1 < nParams ) + osl_getCommandArg( nIdx, &aParam.pData ); + if ( !m_pFreeCmdLineArgs && aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-display" ) ) && nIdx + 1 < nParams ) { - aCommandLine.getCommandArg( nIdx + 1, aParam ); + osl_getCommandArg( nIdx + 1, &aParam.pData ); aDisplay = rtl::OUStringToOString( aParam, osl_getThreadTextEncoding() ); - m_nFakeCmdLineArgs = 3; - m_pFreeCmdLineArgs = new char*[ m_nFakeCmdLineArgs ]; - m_pFreeCmdLineArgs[ 1 ] = strdup( "-display" ); - m_pFreeCmdLineArgs[ 2 ] = strdup( aDisplay.getStr() ); + m_pFreeCmdLineArgs = new char*[ m_nFakeCmdLineArgs + 2 ]; + m_pFreeCmdLineArgs[ m_nFakeCmdLineArgs + 0 ] = strdup( "-display" ); + m_pFreeCmdLineArgs[ m_nFakeCmdLineArgs + 1 ] = strdup( aDisplay.getStr() ); + m_nFakeCmdLineArgs += 2; } } if ( !m_pFreeCmdLineArgs ) @@ -130,6 +158,7 @@ void KDEXLib::Init() osl_getSystemPathFromFileURL( aParam.pData, &aBin.pData ); rtl::OString aExec = rtl::OUStringToOString( aBin, osl_getThreadTextEncoding() ); m_pFreeCmdLineArgs[0] = strdup( aExec.getStr() ); + m_pFreeCmdLineArgs[1] = strdup( "--nocrashhandler" ); // make a copy of the string list for freeing it since // KApplication manipulates the pointers inside the argument vector @@ -143,12 +172,11 @@ void KDEXLib::Init() m_pApplication = new VCLKDEApplication(); kapp->disableSessionManagement(); KApplication::setQuitOnLastWindowClosed(false); + setupEventLoop(); Display* pDisp = QX11Info::display(); SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp); - ((VCLKDEApplication*)m_pApplication)->disp = pSalDisplay; - pInputMethod->CreateMethod( pDisp ); pInputMethod->AddConnectionWatch( pDisp, (void*)this ); pSalDisplay->SetInputMethod( pInputMethod ); @@ -157,12 +185,228 @@ void KDEXLib::Init() SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp ); XSync( pDisp, False ); - pKbdExtension->UseExtension( ! HasXErrorOccured() ); + pKbdExtension->UseExtension( ! HasXErrorOccurred() ); PopXErrorLevel(); pSalDisplay->SetKbdExtension( pKbdExtension ); } +// When we use Qt event loop, it can actually use its own event loop handling, or wrap +// the Glib event loop (the latter is the default is Qt is built with Glib support +// and $QT_NO_GLIB is not set). We mostly do not care which one it is, as QSocketNotifier's +// and QTimer's can handle it transparently, but it matters for the SolarMutex, which +// needs to be unlocked shortly before entering the main sleep (e.g. select()) and locked +// immediatelly after. So we need to know which event loop implementation is used and +// hook accordingly. +#ifdef GLIB_EVENT_LOOP_SUPPORT +static GPollFunc old_gpoll = NULL; +static gint gpoll_wrapper( GPollFD*, guint, gint ); +#endif +#ifdef QT_UNIX_EVENT_LOOP_SUPPORT +static int (*qt_select)(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, + const struct timeval *orig_timeout); +static int lo_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, + const struct timeval *orig_timeout); +#endif + +static bool ( *old_qt_event_filter )( void* ); +static bool qt_event_filter( void* m ) +{ + if( old_qt_event_filter != NULL && old_qt_event_filter( m )) + return true; + if( SalKDEDisplay::self() && SalKDEDisplay::self()->checkDirectInputEvent( static_cast< XEvent* >( m ))) + return true; + return false; +} + +void KDEXLib::setupEventLoop() +{ + old_qt_event_filter = QAbstractEventDispatcher::instance()->setEventFilter( qt_event_filter ); +#ifdef GLIB_EVENT_LOOP_SUPPORT +// Glib is simple, it has g_main_context_set_poll_func() for wrapping the sleep call. +// The catch is that Qt has a bug that allows triggering timers even when they should +// not be, leading to crashes caused by QClipboard re-entering the event loop. +// (http://bugreports.qt.nokia.com/browse/QTBUG-14461), so enable only with Qt>=4.8.0, +// where it is(?) fixed. + if( QAbstractEventDispatcher::instance()->inherits( "QEventDispatcherGlib" )) + { + eventLoopType = GlibEventLoop; + old_gpoll = g_main_context_get_poll_func( NULL ); + g_main_context_set_poll_func( NULL, gpoll_wrapper ); + // set QClipboard to use event loop, otherwise the main thread will hold + // SolarMutex locked, which will prevent the clipboard thread from answering + m_pApplication->clipboard()->setProperty( "useEventLoopWhenWaiting", true ); + return; + } +#endif +#ifdef QT_UNIX_EVENT_LOOP_SUPPORT +// When Qt does not use Glib support, it uses its own Unix event dispatcher. +// That one has aboutToBlock() and awake() signals, but they are broken (either +// functionality or semantics), as e.g. awake() is not emitted right after the dispatcher +// is woken up from sleep again, but only later (which is too late for re-acquiring SolarMutex). +// This should be fixed with Qt-4.8.0 (?) where support for adding custom select() function +// has been added too (http://bugreports.qt.nokia.com/browse/QTBUG-16934). + if( QAbstractEventDispatcher::instance()->inherits( "QEventDispatcherUNIX" )) + { + eventLoopType = QtUnixEventLoop; + QInternal::callFunction( QInternal::GetUnixSelectFunction, reinterpret_cast< void** >( &qt_select )); + QInternal::callFunction( QInternal::SetUnixSelectFunction, reinterpret_cast< void** >( lo_select )); + // set QClipboard to use event loop, otherwise the main thread will hold + // SolarMutex locked, which will prevent the clipboard thread from answering + m_pApplication->clipboard()->setProperty( "useEventLoopWhenWaiting", true ); + return; + } +#endif +} + +#ifdef GLIB_EVENT_LOOP_SUPPORT +gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout ) +{ + YieldMutexReleaser release; // release YieldMutex (and re-acquire at block end) + return old_gpoll( ufds, nfds, timeout ); +} +#endif + +#ifdef QT_UNIX_EVENT_LOOP_SUPPORT +int lo_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, + const struct timeval *orig_timeout) +{ + YieldMutexReleaser release; // release YieldMutex (and re-acquire at block end) + return qt_select( nfds, fdread, fdwrite, fdexcept, orig_timeout ); +} +#endif + +void KDEXLib::Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle ) +{ + if( eventLoopType == LibreOfficeEventLoop ) + return SalXLib::Insert( fd, data, pending, queued, handle ); + SocketData sdata; + sdata.data = data; + sdata.pending = pending; + sdata.queued = queued; + sdata.handle = handle; + // qApp as parent to make sure it uses the main thread event loop + sdata.notifier = new QSocketNotifier( fd, QSocketNotifier::Read, qApp ); + connect( sdata.notifier, SIGNAL( activated( int )), this, SLOT( socketNotifierActivated( int ))); + socketData[ fd ] = sdata; +} + +void KDEXLib::Remove( int fd ) +{ + if( eventLoopType == LibreOfficeEventLoop ) + return SalXLib::Remove( fd ); + SocketData sdata = socketData.take( fd );// according to SalXLib::Remove() this should be safe + delete sdata.notifier; +} + +void KDEXLib::socketNotifierActivated( int fd ) +{ + const SocketData& sdata = socketData[ fd ]; + sdata.handle( fd, sdata.data ); +} + +void KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) +{ + if( eventLoopType == LibreOfficeEventLoop ) + { + if( qApp->thread() == QThread::currentThread()) + { + // even if we use the LO event loop, still process Qt's events, + // otherwise they can remain unhandled for quite a long while + processYield( false, bHandleAllCurrentEvents ); + } + return SalXLib::Yield( bWait, bHandleAllCurrentEvents ); + } + // if we are the main thread (which is where the event processing is done), + // good, just do it + if( qApp->thread() == QThread::currentThread()) + processYield( bWait, bHandleAllCurrentEvents ); + else + { // if this deadlocks, event processing needs to go into a separate thread + // or some other solution needs to be found + emit processYieldSignal( bWait, bHandleAllCurrentEvents ); + } +} + +bool KDEXLib::processYield( bool bWait, bool bHandleAllCurrentEvents ) +{ + QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread()); + bool wasEvent = false; + for( int cnt = bHandleAllCurrentEvents ? 100 : 1; + cnt > 0; + --cnt ) + { + if( !dispatcher->processEvents( QEventLoop::AllEvents )) + break; + wasEvent = true; + } + if( bWait && !wasEvent ) + wasEvent = dispatcher->processEvents( QEventLoop::WaitForMoreEvents ); + return wasEvent; +} + +void KDEXLib::StartTimer( sal_uLong nMS ) +{ + if( eventLoopType == LibreOfficeEventLoop ) + return SalXLib::StartTimer( nMS ); + timeoutTimer.setInterval( nMS ); + // QTimer's can be started only in their thread (main thread here) + if( qApp->thread() == QThread::currentThread()) + startTimeoutTimer(); + else + emit startTimeoutTimerSignal(); +} + +void KDEXLib::startTimeoutTimer() +{ + timeoutTimer.start(); +} + +void KDEXLib::StopTimer() +{ + if( eventLoopType == LibreOfficeEventLoop ) + return SalXLib::StopTimer(); + timeoutTimer.stop(); +} + +void KDEXLib::timeoutActivated() +{ + GetX11SalData()->Timeout(); + // QTimer is not single shot, so will be restarted immediatelly +} + +void KDEXLib::Wakeup() +{ + if( eventLoopType == LibreOfficeEventLoop ) + return SalXLib::Wakeup(); + QAbstractEventDispatcher::instance( qApp->thread())->wakeUp(); // main thread event loop +} + +void KDEXLib::PostUserEvent() +{ + if( eventLoopType == LibreOfficeEventLoop ) + return SalXLib::PostUserEvent(); + if( qApp->thread() == QThread::currentThread()) + startUserEventTimer(); + else + emit startUserEventTimerSignal(); +} + +void KDEXLib::startUserEventTimer() +{ + userEventTimer.start( 0 ); +} + +void KDEXLib::userEventActivated() +{ + SalKDEDisplay::self()->EventGuardAcquire(); + if( SalKDEDisplay::self()->userEventsCount() <= 1 ) + userEventTimer.stop(); + SalKDEDisplay::self()->EventGuardRelease(); + SalKDEDisplay::self()->DispatchInternalEvent(); + // QTimer is not single shot, so will be restarted immediatelly +} + void KDEXLib::doStartup() { if( ! m_bStartupDone ) @@ -174,3 +418,7 @@ void KDEXLib::doStartup() #endif } } + +#include "KDEXLib.moc" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDEXLib.hxx b/vcl/unx/kde4/KDEXLib.hxx index 561f6ee73a78..497a97f3b828 100644 --- a/vcl/unx/kde4/KDEXLib.hxx +++ b/vcl/unx/kde4/KDEXLib.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,21 +30,65 @@ #include <unx/saldisp.hxx> -class KDEXLib : public SalXLib +#include <fixx11h.h> + +#include <qhash.h> +#include <qsocketnotifier.h> +#include <qtimer.h> + +class VCLKDEApplication; + +class KDEXLib : public QObject, public SalXLib { + Q_OBJECT private: bool m_bStartupDone; - void* m_pApplication; + VCLKDEApplication* m_pApplication; char** m_pFreeCmdLineArgs; char** m_pAppCmdLineArgs; int m_nFakeCmdLineArgs; + struct SocketData + { + void* data; + YieldFunc pending; + YieldFunc queued; + YieldFunc handle; + QSocketNotifier* notifier; + }; + QHash< int, SocketData > socketData; // key is fd + QTimer timeoutTimer; + QTimer userEventTimer; + enum { LibreOfficeEventLoop, GlibEventLoop, QtUnixEventLoop } eventLoopType; + + private: + void setupEventLoop(); + + private slots: + void socketNotifierActivated( int fd ); + void timeoutActivated(); + void userEventActivated(); + void startTimeoutTimer(); + void startUserEventTimer(); + bool processYield( bool bWait, bool bHandleAllCurrentEvents ); + signals: + void startTimeoutTimerSignal(); + void startUserEventTimerSignal(); + void processYieldSignal( bool bWait, bool bHandleAllCurrentEvents ); public: KDEXLib(); - virtual ~KDEXLib(); + virtual void Init(); + virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); + virtual void Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle ); + virtual void Remove( int fd ); + virtual void StartTimer( sal_uLong nMS ); + virtual void StopTimer(); + virtual void Wakeup(); + virtual void PostUserEvent(); void doStartup(); }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/Makefile b/vcl/unx/kde4/Makefile new file mode 100644 index 000000000000..4259715656f4 --- /dev/null +++ b/vcl/unx/kde4/Makefile @@ -0,0 +1,32 @@ +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Caolan McNamara <caolanm@redhat.com> (Red Hat, Inc.) +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +KDEXLib.cxx : KDEXLib.moc + +KDEXLib.moc : $(realpath $(dir $(firstword $(MAKEFILE_LIST))))/KDEXLib.hxx + $(MOC4) $< -o $@ + +.PHONY : all +# vim: set noet sw=4: diff --git a/vcl/unx/kde4/VCLKDEApplication.cxx b/vcl/unx/kde4/VCLKDEApplication.cxx index 94d28d2e698a..bb6e4cb299a7 100644 --- a/vcl/unx/kde4/VCLKDEApplication.cxx +++ b/vcl/unx/kde4/VCLKDEApplication.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,17 +37,18 @@ VCLKDEApplication::VCLKDEApplication() : KApplication() { - disp = 0; } bool VCLKDEApplication::x11EventFilter(XEvent* ev) { //if we have a display and the display consumes the event //do not process the event in qt - if (disp && disp->Dispatch(ev) > 0) + if (SalKDEDisplay::self() && SalKDEDisplay::self()->Dispatch(ev) > 0) { return true; } return false; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/VCLKDEApplication.hxx b/vcl/unx/kde4/VCLKDEApplication.hxx index 7cbbe38b61df..17a9b6eb0917 100644 --- a/vcl/unx/kde4/VCLKDEApplication.hxx +++ b/vcl/unx/kde4/VCLKDEApplication.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,8 +36,6 @@ #undef Region -class SalKDEDisplay; - /* #i59042# override KApplications method for session management * since it will interfere badly with our own. */ @@ -48,6 +47,6 @@ class VCLKDEApplication : public KApplication virtual void commitData(QSessionManager&) {}; virtual bool x11EventFilter(XEvent* event); - - SalKDEDisplay* disp; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/main.cxx b/vcl/unx/kde4/main.cxx index 063cdf2bef86..9e0a36120222 100644 --- a/vcl/unx/kde4/main.cxx +++ b/vcl/unx/kde4/main.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,7 +36,7 @@ #include "KDEData.hxx" #include "KDESalInstance.hxx" -#include "vclpluginapi.h" +#include <vclpluginapi.h> #if OSL_DEBUG_LEVEL > 1 #include <stdio.h> @@ -63,15 +64,16 @@ extern "C" { #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "qt version string is \"%s\"\n", aVersion.getStr() ); #endif - sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0, nMicro = 0; + sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0; nMajor = aVersion.getToken( 0, '.', nIndex ).toInt32(); if( nIndex > 0 ) nMinor = aVersion.getToken( 0, '.', nIndex ).toInt32(); - if( nIndex > 0 ) - nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32(); if( nMajor != 4 || nMinor < 1 ) { #if OSL_DEBUG_LEVEL > 1 + sal_Int32 nMicro = 0; + if( nIndex > 0 ) + nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32(); fprintf( stderr, "unsuitable qt version %d.%d.%d\n", nMajor, nMinor, nMicro ); #endif return NULL; @@ -93,3 +95,5 @@ extern "C" { return pInstance; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index 75b3f9f527c1..c8dc1012dd8f 100644..100755 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -135,7 +135,6 @@ SHL11FILE= $(MISC)$/app.slo SHL12FILE= $(MISC)$/gdi.slo SHL13FILE= $(MISC)$/win.slo SHL14FILE= $(MISC)$/ctrl.slo -#SHL15FILE= $(MISC)$/ex.slo SHL16FILE= $(MISC)$/salapp.slo SHL17FILE= $(MISC)$/salwin.slo SHL18FILE= $(MISC)$/salgdi.slo @@ -177,7 +176,6 @@ SHL1STDLIBS+=\ $(UCBHELPERLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ - $(VOSLIB) \ $(SALLIB) \ $(BASEGFXLIB) \ $(ICUUCLIB) \ @@ -190,7 +188,7 @@ SHL1STDLIBS+=\ .IF "$(SYSTEM_GRAPHITE)" == "YES" SHL1STDLIBS+= $(GRAPHITE_LIBS) .ELSE -SHL1STDLIBS+= $(SOLARVERSION)/$(INPATH)/lib$(UPDMINOREXT)/libgraphite.a +SHL1STDLIBS+= -lgraphite2_off .ENDIF .ENDIF .ENDIF @@ -216,11 +214,6 @@ LIB1FILES+= \ .ENDIF # USE_BUILTIN_RASTERIZER SHL1LIBS= $(LIB1TARGET) -.IF "$(GUI)"!="UNX" -.IF "$(COM)"!="GCC" -#SHL1OBJS= $(SLO)$/salshl.obj -.ENDIF -.ENDIF .IF "$(GUI)" != "UNX" SHL1RES= $(RES)$/salsrc.res @@ -240,9 +233,10 @@ DEFLIB1NAME =vcl .IF "$(ENABLE_GRAPHITE)" == "TRUE" .IF "$(COM)" == "GCC" -SHL1STDLIBS += -lgraphite +SHL1STDLIBS += -Wl,-Bstatic -lgraphite2_off -Wl,-Bdynamic +#SHL1STDLIBS += -lgraphite2_off .ELSE -SHL1STDLIBS += graphite_dll.lib +SHL1STDLIBS += graphite2_off.lib .ENDIF .ENDIF @@ -253,7 +247,8 @@ SHL1STDLIBS += $(UWINAPILIB) \ $(WINSPOOLLIB) \ $(OLE32LIB) \ $(SHELL32LIB) \ - $(ADVAPI32LIB) + $(ADVAPI32LIB) \ + $(VERSIONLIB) SHL1STDLIBS += $(IMM32LIB) @@ -262,12 +257,6 @@ LINKFLAGSSHL += /ENTRY:LibMain@12 .ENDIF .ENDIF -# --- OS2 ---------------------------------------------------------------- - -.IF "$(GUI)" == "OS2" -STDSHL1 += ft2lib.lib -.ENDIF - # --- UNX ---------------------------------------------------------------- # UNX sal plugins @@ -302,7 +291,6 @@ SHL2STDLIBS=\ $(I18NPAPERLIB) \ $(I18NISOLANGLIB) \ $(TOOLSLIB) \ - $(VOSLIB) \ $(BASEGFXLIB) \ $(UNOTOOLSLIB) \ $(COMPHELPERLIB) \ @@ -335,7 +323,8 @@ SHL2STDLIBS+=`pkg-config --libs xrender` .IF "$(GUIBASE)"=="unx" SHL2STDLIBS += -lXext -lSM -lICE -lX11 -.IF "$(OS)"!="MACOSX" && "$(OS)"!="FREEBSD" && "$(OS)"!="NETBSD" +.IF "$(OS)"!="MACOSX" && "$(OS)"!="FREEBSD" && "$(OS)"!="NETBSD" && \ + && "$(OS)"!="OPENBSD" "$(OS)"!="DRAGONFLY" # needed by salprnpsp.cxx SHL2STDLIBS+= -ldl .ENDIF @@ -382,7 +371,6 @@ SHL4STDLIBS+=\ $(TOOLSLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ - $(VOSLIB) \ $(SALLIB) \ $(X11LINK_DYNAMIC) @@ -409,12 +397,10 @@ SHL5IMPLIB=ikde_plug_ SHL5LIBS=$(LIB5TARGET) SHL5DEPN=$(SHL2TARGETN) # libs for KDE plugin -SHL5LINKFLAGS+=$(KDE_LIBS) SHL5STDLIBS+=-l$(SHL2TARGET) SHL5STDLIBS+=\ $(VCLLIB) \ $(TOOLSLIB) \ - $(VOSLIB) \ $(SALLIB) \ $(X11LINK_DYNAMIC) @@ -424,6 +410,8 @@ SHL5STDLIBS+= $(XRANDR_LIBS) .ENDIF .ENDIF +SHL5LINKFLAGS+=$(KDE_LIBS) + .ENDIF # "$(ENABLE_KDE)" != "" # KDE4 plugin @@ -438,13 +426,11 @@ SHL6IMPLIB=ikde4_plug_ SHL6LIBS=$(LIB6TARGET) SHL6DEPN=$(SHL2TARGETN) # libs for KDE4 plugin -SHL6LINKFLAGS+=$(KDE4_LIBS) SHL6STDLIBS+=-l$(SHL2TARGET) SHL6STDLIBS+=\ $(VCLLIB) \ $(PSPLIB) \ $(TOOLSLIB) \ - $(VOSLIB) \ $(SALLIB) \ $(X11LINK_DYNAMIC) @@ -454,6 +440,8 @@ SHL6STDLIBS+= $(XRANDR_LIBS) .ENDIF .ENDIF +SHL6STDLIBS+=$(KDE4_LIBS) $(KDE_GLIB_LIBS) + .ENDIF # "$(ENABLE_KDE4)" != "" .ENDIF # UNX diff --git a/vcl/win/source/app/saldata.cxx b/vcl/win/source/app/saldata.cxx index 4faaf7bd4def..805ca84dc906 100755 --- a/vcl/win/source/app/saldata.cxx +++ b/vcl/win/source/app/saldata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,8 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" - -#include "tools/svwin.h" +#include <svsys.h> #include "rtl/tencinfo.h" #include "vcl/svapp.hxx" @@ -118,20 +118,6 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 ) // ======================================================================= -LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong ) -{ - return SetWindowLongW( hWnd, nIndex, dwNewLong ); -} - -// ----------------------------------------------------------------------- - -LONG ImplGetWindowLong( HWND hWnd, int nIndex ) -{ - return GetWindowLongW( hWnd, nIndex ); -} - -// ----------------------------------------------------------------------- - BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) { return PostMessageW( hWnd, nMsg, wParam, lParam ); @@ -141,8 +127,7 @@ BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) { - BOOL bRet = SendMessageW( hWnd, nMsg, wParam, lParam ); - return bRet; + return SendMessageW( hWnd, nMsg, wParam, lParam ); } // ----------------------------------------------------------------------- @@ -166,3 +151,4 @@ LONG ImplDispatchMessage( CONST MSG *lpMsg ) return DispatchMessageW( lpMsg ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx index 431e9ca9c15f..4436c0243f1d 100755 --- a/vcl/win/source/app/salinfo.cxx +++ b/vcl/win/source/app/salinfo.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,7 +50,7 @@ #include "svdata.hxx" -#include <hash_map> +#include <boost/unordered_map.hpp> SalSystem* WinSalInstance::CreateSalSystem() { @@ -112,88 +113,8 @@ bool WinSalSystem::initMonitors() if( m_aMonitors.size() > 0 ) return true; - bool winVerOk = true; - - // multi monitor calls not available on Win95/NT - if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) - { - if ( aSalShlData.maVersionInfo.dwMajorVersion <= 4 ) - winVerOk = false; // NT - } - else if( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) - { - if ( aSalShlData.maVersionInfo.dwMajorVersion == 4 && aSalShlData.maVersionInfo.dwMinorVersion == 0 ) - winVerOk = false; // Win95 - } - if( winVerOk ) - { - int nMonitors = GetSystemMetrics( SM_CMONITORS ); - if( nMonitors == 1 ) - { - int w = GetSystemMetrics( SM_CXSCREEN ); - int h = GetSystemMetrics( SM_CYSCREEN ); - m_aMonitors.push_back( DisplayMonitor( rtl::OUString(), - rtl::OUString(), - Rectangle( Point(), Size( w, h ) ), - Rectangle( Point(), Size( w, h ) ), - 0 ) ); - m_aDeviceNameToMonitor[ rtl::OUString() ] = 0; - m_nPrimary = 0; - RECT aWorkRect; - if( SystemParametersInfo( SPI_GETWORKAREA, 0, &aWorkRect, 0 ) ) - m_aMonitors.back().m_aWorkArea = Rectangle( aWorkRect.left, aWorkRect.top, - aWorkRect.right, aWorkRect.bottom ); - } - else - { - DISPLAY_DEVICEW aDev; - aDev.cb = sizeof( aDev ); - DWORD nDevice = 0; - std::hash_map< rtl::OUString, int, rtl::OUStringHash > aDeviceStringCount; - while( EnumDisplayDevicesW( NULL, nDevice++, &aDev, 0 ) ) - { - if( (aDev.StateFlags & DISPLAY_DEVICE_ACTIVE) - && !(aDev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) ) // sort out non/disabled monitors - { - aDev.DeviceName[31] = 0; - aDev.DeviceString[127] = 0; - rtl::OUString aDeviceName( reinterpret_cast<const sal_Unicode *>(aDev.DeviceName) ); - rtl::OUString aDeviceString( reinterpret_cast<const sal_Unicode *>(aDev.DeviceString) ); - if( aDeviceStringCount.find( aDeviceString ) == aDeviceStringCount.end() ) - aDeviceStringCount[ aDeviceString ] = 1; - else - aDeviceStringCount[ aDeviceString ]++; - m_aDeviceNameToMonitor[ aDeviceName ] = m_aMonitors.size(); - m_aMonitors.push_back( DisplayMonitor( aDeviceString, - aDeviceName, - Rectangle(), - Rectangle(), - aDev.StateFlags ) ); - } - } - HDC aDesktopRC = GetDC( NULL ); - EnumDisplayMonitors( aDesktopRC, NULL, ImplEnumMonitorProc, reinterpret_cast<LPARAM>(this) ); - - // append monitor numbers to name strings - std::hash_map< rtl::OUString, int, rtl::OUStringHash > aDevCount( aDeviceStringCount ); - unsigned int nMonitors = m_aMonitors.size(); - for( unsigned int i = 0; i < nMonitors; i++ ) - { - const rtl::OUString& rDev( m_aMonitors[i].m_aName ); - if( aDeviceStringCount[ rDev ] > 1 ) - { - int nInstance = aDeviceStringCount[ rDev ] - (-- aDevCount[ rDev ] ); - rtl::OUStringBuffer aBuf( rDev.getLength() + 8 ); - aBuf.append( rDev ); - aBuf.appendAscii( " (" ); - aBuf.append( sal_Int32( nInstance ) ); - aBuf.append( sal_Unicode(')') ); - m_aMonitors[ i ].m_aName = aBuf.makeStringAndClear(); - } - } - } - } - else + int nMonitors = GetSystemMetrics( SM_CMONITORS ); + if( nMonitors == 1 ) { int w = GetSystemMetrics( SM_CXSCREEN ); int h = GetSystemMetrics( SM_CYSCREEN ); @@ -209,6 +130,54 @@ bool WinSalSystem::initMonitors() m_aMonitors.back().m_aWorkArea = Rectangle( aWorkRect.left, aWorkRect.top, aWorkRect.right, aWorkRect.bottom ); } + else + { + DISPLAY_DEVICEW aDev; + aDev.cb = sizeof( aDev ); + DWORD nDevice = 0; + boost::unordered_map< rtl::OUString, int, rtl::OUStringHash > aDeviceStringCount; + while( EnumDisplayDevicesW( NULL, nDevice++, &aDev, 0 ) ) + { + if( (aDev.StateFlags & DISPLAY_DEVICE_ACTIVE) + && !(aDev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) ) // sort out non/disabled monitors + { + aDev.DeviceName[31] = 0; + aDev.DeviceString[127] = 0; + rtl::OUString aDeviceName( reinterpret_cast<const sal_Unicode *>(aDev.DeviceName) ); + rtl::OUString aDeviceString( reinterpret_cast<const sal_Unicode *>(aDev.DeviceString) ); + if( aDeviceStringCount.find( aDeviceString ) == aDeviceStringCount.end() ) + aDeviceStringCount[ aDeviceString ] = 1; + else + aDeviceStringCount[ aDeviceString ]++; + m_aDeviceNameToMonitor[ aDeviceName ] = m_aMonitors.size(); + m_aMonitors.push_back( DisplayMonitor( aDeviceString, + aDeviceName, + Rectangle(), + Rectangle(), + aDev.StateFlags ) ); + } + } + HDC aDesktopRC = GetDC( NULL ); + EnumDisplayMonitors( aDesktopRC, NULL, ImplEnumMonitorProc, reinterpret_cast<LPARAM>(this) ); + + // append monitor numbers to name strings + boost::unordered_map< rtl::OUString, int, rtl::OUStringHash > aDevCount( aDeviceStringCount ); + unsigned int nMonitors = m_aMonitors.size(); + for( unsigned int i = 0; i < nMonitors; i++ ) + { + const rtl::OUString& rDev( m_aMonitors[i].m_aName ); + if( aDeviceStringCount[ rDev ] > 1 ) + { + int nInstance = aDeviceStringCount[ rDev ] - (-- aDevCount[ rDev ] ); + rtl::OUStringBuffer aBuf( rDev.getLength() + 8 ); + aBuf.append( rDev ); + aBuf.appendAscii( " (" ); + aBuf.append( sal_Int32( nInstance ) ); + aBuf.append( sal_Unicode(')') ); + m_aMonitors[ i ].m_aName = aBuf.makeStringAndClear(); + } + } + } return m_aMonitors.size() > 0; } @@ -291,3 +260,5 @@ int WinSalSystem::ShowNativeMessageBox(const String& rTitle, const String& rMess reinterpret_cast<LPCWSTR>(rTitle.GetBuffer()), nFlags); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 1e5a306d852d..6db248c0ddb4 100755..100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,8 +30,8 @@ #include "precompiled_vcl.hxx" #include <string.h> -#include <tools/svwin.h> #ifdef WNT +#include <svsys.h> #include <process.h> #endif #ifdef __MINGW32__ @@ -38,8 +39,7 @@ #endif #include <osl/file.hxx> - -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/solarmutex.hxx> #include <tools/debug.hxx> @@ -47,6 +47,7 @@ #include <vcl/timer.hxx> #include <vcl/apptypes.hxx> +#include <vcl/solarmutex.hxx> #include <win/wincomp.hxx> #include <win/salids.hrc> #include <win/saldata.hxx> @@ -108,7 +109,7 @@ LRESULT CALLBACK SalComWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPa // ======================================================================= -class SalYieldMutex : public vos::OMutex +class SalYieldMutex : public vcl::SolarMutexObject { public: // for ImplSalYield() WinSalInstance* mpInstData; @@ -138,7 +139,7 @@ SalYieldMutex::SalYieldMutex( WinSalInstance* pInstData ) void SAL_CALL SalYieldMutex::acquire() { - OMutex::acquire(); + SolarMutexObject::acquire(); mnCount++; mnThreadId = GetCurrentThreadId(); } @@ -149,7 +150,7 @@ void SAL_CALL SalYieldMutex::release() { DWORD nThreadId = GetCurrentThreadId(); if ( mnThreadId != nThreadId ) - OMutex::release(); + SolarMutexObject::release(); else { SalData* pSalData = GetSalData(); @@ -166,13 +167,13 @@ void SAL_CALL SalYieldMutex::release() ImplPostMessage( mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 ); mnThreadId = 0; mnCount--; - OMutex::release(); + SolarMutexObject::release(); mpInstData->mpSalWaitMutex->release(); } else { mnCount--; - OMutex::release(); + SolarMutexObject::release(); } } else @@ -180,7 +181,7 @@ void SAL_CALL SalYieldMutex::release() if ( mnCount == 1 ) mnThreadId = 0; mnCount--; - OMutex::release(); + SolarMutexObject::release(); } } } @@ -189,7 +190,7 @@ void SAL_CALL SalYieldMutex::release() sal_Bool SAL_CALL SalYieldMutex::tryToAcquire() { - if( OMutex::tryToAcquire() ) + if( SolarMutexObject::tryToAcquire() ) { mnCount++; mnThreadId = GetCurrentThreadId(); @@ -379,6 +380,9 @@ void SalData::initKeyCodeMap() initKey( '=', KEY_EQUAL ); initKey( '~', KEY_TILDE ); initKey( '`', KEY_QUOTELEFT ); + initKey( '[', KEY_BRACKETLEFT ); + initKey( ']', KEY_BRACKETRIGHT ); + initKey( ';', KEY_SEMICOLON ); } // ======================================================================= @@ -514,22 +518,16 @@ SalInstance* CreateSalInstance() aSalShlData.mbWXP = 0; aSalShlData.mbWPrinter = 0; WORD nVer = (WORD)GetVersion(); - aSalShlData.mnVersion = (((WORD)LOBYTE(nVer)) * 100) + HIBYTE(nVer); - if ( aSalShlData.mnVersion >= 400 ) - aSalShlData.mbW40 = 1; rtl_zeroMemory( &aSalShlData.maVersionInfo, sizeof(aSalShlData.maVersionInfo) ); aSalShlData.maVersionInfo.dwOSVersionInfoSize = sizeof( aSalShlData.maVersionInfo ); if ( GetVersionEx( &aSalShlData.maVersionInfo ) ) { - if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) - { - // Windows XP ? - if ( aSalShlData.maVersionInfo.dwMajorVersion > 5 || - ( aSalShlData.maVersionInfo.dwMajorVersion == 5 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) ) - aSalShlData.mbWXP = 1; - if( aSalShlData.maVersionInfo.dwMajorVersion >= 5 ) - aSalShlData.mbWPrinter = 1; - } + // Windows XP ? + if ( aSalShlData.maVersionInfo.dwMajorVersion > 5 || + ( aSalShlData.maVersionInfo.dwMajorVersion == 5 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) ) + aSalShlData.mbWXP = 1; + if( aSalShlData.maVersionInfo.dwMajorVersion >= 5 ) + aSalShlData.mbWPrinter = 1; } pSalData->mnAppThreadId = GetCurrentThreadId(); @@ -537,46 +535,46 @@ SalInstance* CreateSalInstance() // register frame class if ( !pSalData->mhPrevInst ) { - WNDCLASSEXW aWndClassEx; - aWndClassEx.cbSize = sizeof( aWndClassEx ); - aWndClassEx.style = CS_OWNDC; - aWndClassEx.lpfnWndProc = SalFrameWndProcW; - aWndClassEx.cbClsExtra = 0; - aWndClassEx.cbWndExtra = SAL_FRAME_WNDEXTRA; - aWndClassEx.hInstance = pSalData->mhInst; - aWndClassEx.hCursor = 0; - aWndClassEx.hbrBackground = 0; - aWndClassEx.lpszMenuName = 0; - aWndClassEx.lpszClassName = SAL_FRAME_CLASSNAMEW; - ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, aWndClassEx.hIcon, aWndClassEx.hIconSm ); - if ( !RegisterClassExW( &aWndClassEx ) ) - return NULL; - - aWndClassEx.hIcon = 0; - aWndClassEx.hIconSm = 0; - aWndClassEx.style |= CS_SAVEBITS; - aWndClassEx.lpszClassName = SAL_SUBFRAME_CLASSNAMEW; - if ( !RegisterClassExW( &aWndClassEx ) ) - return NULL; - - // shadow effect for popups on XP - if( aSalShlData.mbWXP ) - aWndClassEx.style |= CS_DROPSHADOW; - aWndClassEx.lpszClassName = SAL_TMPSUBFRAME_CLASSNAMEW; - if ( !RegisterClassExW( &aWndClassEx ) ) - return NULL; - - aWndClassEx.style = 0; - aWndClassEx.lpfnWndProc = SalComWndProcW; - aWndClassEx.cbWndExtra = 0; - aWndClassEx.lpszClassName = SAL_COM_CLASSNAMEW; - if ( !RegisterClassExW( &aWndClassEx ) ) - return NULL; + WNDCLASSEXW aWndClassEx; + aWndClassEx.cbSize = sizeof( aWndClassEx ); + aWndClassEx.style = CS_OWNDC; + aWndClassEx.lpfnWndProc = SalFrameWndProcW; + aWndClassEx.cbClsExtra = 0; + aWndClassEx.cbWndExtra = SAL_FRAME_WNDEXTRA; + aWndClassEx.hInstance = pSalData->mhInst; + aWndClassEx.hCursor = 0; + aWndClassEx.hbrBackground = 0; + aWndClassEx.lpszMenuName = 0; + aWndClassEx.lpszClassName = SAL_FRAME_CLASSNAMEW; + ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, aWndClassEx.hIcon, aWndClassEx.hIconSm ); + if ( !RegisterClassExW( &aWndClassEx ) ) + return NULL; + + aWndClassEx.hIcon = 0; + aWndClassEx.hIconSm = 0; + aWndClassEx.style |= CS_SAVEBITS; + aWndClassEx.lpszClassName = SAL_SUBFRAME_CLASSNAMEW; + if ( !RegisterClassExW( &aWndClassEx ) ) + return NULL; + + // shadow effect for popups on XP + if( aSalShlData.mbWXP ) + aWndClassEx.style |= CS_DROPSHADOW; + aWndClassEx.lpszClassName = SAL_TMPSUBFRAME_CLASSNAMEW; + if ( !RegisterClassExW( &aWndClassEx ) ) + return NULL; + + aWndClassEx.style = 0; + aWndClassEx.lpfnWndProc = SalComWndProcW; + aWndClassEx.cbWndExtra = 0; + aWndClassEx.lpszClassName = SAL_COM_CLASSNAMEW; + if ( !RegisterClassExW( &aWndClassEx ) ) + return NULL; } HWND hComWnd = CreateWindowExW( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEW, - L"", WS_POPUP, 0, 0, 0, 0, 0, 0, - pSalData->mhInst, NULL ); + L"", WS_POPUP, 0, 0, 0, 0, 0, 0, + pSalData->mhInst, NULL ); if ( !hComWnd ) return NULL; @@ -616,7 +614,7 @@ WinSalInstance::WinSalInstance() { mhComWnd = 0; mpSalYieldMutex = new SalYieldMutex( this ); - mpSalWaitMutex = new vos::OMutex; + mpSalWaitMutex = new osl::Mutex; mnYieldWaitCount = 0; mpSalYieldMutex->acquire(); ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); @@ -635,7 +633,7 @@ WinSalInstance::~WinSalInstance() // ----------------------------------------------------------------------- -vos::IMutex* WinSalInstance::GetYieldMutex() +osl::SolarMutex* WinSalInstance::GetYieldMutex() { return mpSalYieldMutex; } @@ -810,7 +808,7 @@ LRESULT CALLBACK SalComWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar //in the structure (GetWindowPtr()). if (DestroyWindow((HWND)lParam) == 0) { - OSL_ENSURE(0, "DestroyWindow failed!"); + OSL_FAIL("DestroyWindow failed!"); //Failure: We remove the SalFrame from the window structure. So we avoid that // the window structure may contain an invalid pointer, once the SalFrame is deleted. SetWindowPtr((HWND)lParam, 0); @@ -1138,3 +1136,5 @@ int WinSalInstance::WorkaroundExceptionHandlingInUSER32Lib(int, LPEXCEPTION_POIN return UnhandledExceptionFilter( pExceptionInfo ); } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/app/salshl.cxx b/vcl/win/source/app/salshl.cxx index 427f2092a0dc..caebe9ca5b18 100755 --- a/vcl/win/source/app/salshl.cxx +++ b/vcl/win/source/app/salshl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#include <svsys.h> #include <tools/debug.hxx> -#include <tools/svwin.h> #include <win/saldata.hxx> // ======================================================================= @@ -163,3 +164,5 @@ sal_Bool ImplLoadSalIcon( int nId, HICON& rIcon, HICON& rSmallIcon ) return (rSmallIcon != 0); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/app/saltimer.cxx b/vcl/win/source/app/saltimer.cxx index f0b88a8e381c..60c917475a94 100755 --- a/vcl/win/source/app/saltimer.cxx +++ b/vcl/win/source/app/saltimer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <tools/svwin.h> +#include <svsys.h> #ifdef __MINGW32__ #include <excpt.h> #endif @@ -152,3 +153,5 @@ void CALLBACK SalTimerProc( HWND, UINT, UINT_PTR nId, DWORD ) } #endif } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx index 3dc176ae23b8..7661fa5f6ed1 100755 --- a/vcl/win/source/gdi/salbmp.cxx +++ b/vcl/win/source/gdi/salbmp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <tools/svwin.h> +#include <svsys.h> #include <vcl/bitmap.hxx> // for BitmapSystemData #include <vcl/salbtype.hxx> @@ -268,6 +269,13 @@ bool WinSalBitmap::Create( const SalBitmap& rSSalBmp, sal_uInt16 nNewBitCount ) // ------------------------------------------------------------------ +bool WinSalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > /*xBitmapCanvas*/, Size& /*rSize*/, bool /*bMask*/ ) +{ + return false; +} + +// ------------------------------------------------------------------ + void WinSalBitmap::Destroy() { if( mhDIB ) @@ -634,3 +642,5 @@ bool WinSalBitmap::GetSystemData( BitmapSystemData& rData ) } return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index bc2f8ade3ccc..ae490d41584c 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,9 @@ #include <stdio.h> #include <string.h> +#include <svsys.h> #include <rtl/strbuf.hxx> -#include <tools/svwin.h> #include <tools/debug.hxx> #include <tools/poly.hxx> @@ -47,8 +48,7 @@ #include <region.h> -using namespace rtl; - +using ::rtl::OStringBuffer; // ======================================================================= // comment out to prevent use of beziers on GDI functions @@ -486,11 +486,8 @@ void ImplUpdateSysColorEntries() // create new sys color list ImplInsertSysColorEntry( COLOR_ACTIVEBORDER ); ImplInsertSysColorEntry( COLOR_INACTIVEBORDER ); - if( aSalShlData.mnVersion >= 410 ) - { - ImplInsertSysColorEntry( COLOR_GRADIENTACTIVECAPTION ); - ImplInsertSysColorEntry( COLOR_GRADIENTINACTIVECAPTION ); - } + ImplInsertSysColorEntry( COLOR_GRADIENTACTIVECAPTION ); + ImplInsertSysColorEntry( COLOR_GRADIENTINACTIVECAPTION ); ImplInsertSysColorEntry( COLOR_3DFACE ); ImplInsertSysColorEntry( COLOR_3DHILIGHT ); ImplInsertSysColorEntry( COLOR_3DLIGHT ); @@ -630,7 +627,7 @@ void ImplClearHDCCache( SalData* pData ) // Make sure pWinPointAry and pWinFlagAry are big enough void ImplPreparePolyDraw( bool bCloseFigures, sal_uLong nPoly, - const sal_uLong* pPoints, + const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry, POINT* pWinPointAry, @@ -641,7 +638,7 @@ void ImplPreparePolyDraw( bool bCloseFigures, { const POINT* pCurrPoint = reinterpret_cast<const POINT*>( *pPtAry++ ); const BYTE* pCurrFlag = *pFlgAry++; - const sal_uLong nCurrPoints = *pPoints++; + const sal_uInt32 nCurrPoints = *pPoints++; const bool bHaveFlagArray( pCurrFlag ); sal_uLong nCurrPoint; @@ -735,9 +732,10 @@ WinSalGraphics::WinSalGraphics() mhFonts[ i ] = 0; mpWinFontData[ i ] = NULL; mpWinFontEntry[ i ] = NULL; + mfFontScale[ i ] = 1.0; } - mfFontScale = 1.0; + mfCurrentFontScale = 1.0; mhDC = 0; mhPen = 0; @@ -813,7 +811,7 @@ void WinSalGraphics::GetResolution( long& rDPIX, long& rDPIY ) // ----------------------------------------------------------------------- -sal_uInt16 WinSalGraphics::GetBitCount() +sal_uInt16 WinSalGraphics::GetBitCount() const { return (sal_uInt16)GetDeviceCaps( mhDC, BITSPIXEL ); } @@ -896,9 +894,9 @@ bool WinSalGraphics::setClipRegion( const Region& i_rClip ) } else { - ULONG nRectCount = i_rClip.GetRectCount(); + sal_uLong nRectCount = i_rClip.GetRectCount(); - ULONG nRectBufSize = sizeof(RECT)*nRectCount; + sal_uLong nRectBufSize = sizeof(RECT)*nRectCount; if ( nRectCount < SAL_CLIPRECT_COUNT ) { if ( !mpStdClipRgnData ) @@ -971,7 +969,7 @@ bool WinSalGraphics::setClipRegion( const Region& i_rClip ) } else if( mpClipRgnData->rdh.nCount > 1 ) { - ULONG nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); + sal_uLong nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); mhRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData ); // if ExtCreateRegion(...) is not supported @@ -985,7 +983,7 @@ bool WinSalGraphics::setClipRegion( const Region& i_rClip ) mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); pRect++; - for( ULONG n = 1; n < pHeader->nCount; n++, pRect++ ) + for( sal_uLong n = 1; n < pHeader->nCount; n++, pRect++ ) { HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); CombineRgn( mhRegion, mhRegion, hRgn, RGN_OR ); @@ -1488,7 +1486,8 @@ sal_Bool WinSalGraphics::drawPolygonBezier( sal_uLong nPoints, const SalPoint* p pWinFlagAry = aStackAry2; } - ImplPreparePolyDraw(true, 1, &nPoints, &pPtAry, &pFlgAry, pWinPointAry, pWinFlagAry); + sal_uInt32 nPoints_i32(nPoints); + ImplPreparePolyDraw(true, 1, &nPoints_i32, &pPtAry, &pFlgAry, pWinPointAry, pWinFlagAry); sal_Bool bRet( sal_False ); @@ -1526,7 +1525,7 @@ sal_Bool WinSalGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt "WinSalGraphics::DrawPolyPolygonBezier(): POINT != SalPoint" ); sal_uLong nCurrPoly, nTotalPoints; - const sal_uLong* pCurrPoints = pPoints; + const sal_uInt32* pCurrPoints = pPoints; for( nCurrPoly=0, nTotalPoints=0; nCurrPoly<nPoly; ++nCurrPoly ) nTotalPoints += *pCurrPoints++; @@ -1824,3 +1823,5 @@ SystemGraphicsData WinSalGraphics::GetGraphicsData() const } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salgdi2.cxx b/vcl/win/source/gdi/salgdi2.cxx index 5ac117a596d9..27265b3939d9 100644 --- a/vcl/win/source/gdi/salgdi2.cxx +++ b/vcl/win/source/gdi/salgdi2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #include <string.h> #include <stdlib.h> -#include <tools/svwin.h> +#include <svsys.h> #include <tools/debug.hxx> #include <win/wincomp.hxx> @@ -41,6 +42,10 @@ #include <win/salgdi.h> #include <win/salframe.h> +#include "vcl/salbtype.hxx" +#include "vcl/bmpacc.hxx" +#include "outdata.hxx" + bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const { static bool bAllowForTest(true); @@ -392,8 +397,24 @@ void ImplDrawBitmap( HDC hDC, if( bMono ) { - nOldBkColor = SetBkColor( hDC, RGB( 0xFF, 0xFF, 0xFF ) ); - nOldTextColor = ::SetTextColor( hDC, RGB( 0x00, 0x00, 0x00 ) ); + COLORREF nBkColor = RGB( 0xFF, 0xFF, 0xFF ); + COLORREF nTextColor = RGB( 0x00, 0x00, 0x00 ); + //fdo#33455 handle 1 bit depth pngs with palette entries + //to set fore/back colors + if (const BitmapBuffer* pBitmapBuffer = const_cast<WinSalBitmap&>(rSalBitmap).AcquireBuffer(true)) + { + const BitmapPalette& rPalette = pBitmapBuffer->maPalette; + if (rPalette.GetEntryCount() == 2) + { + SalColor nCol; + nCol = ImplColorToSal(rPalette[0]); + nTextColor = RGB( SALCOLOR_RED(nCol), SALCOLOR_GREEN(nCol), SALCOLOR_BLUE(nCol) ); + nCol = ImplColorToSal(rPalette[1]); + nBkColor = RGB( SALCOLOR_RED(nCol), SALCOLOR_GREEN(nCol), SALCOLOR_BLUE(nCol) ); + } + } + nOldBkColor = SetBkColor( hDC, nBkColor ); + nOldTextColor = ::SetTextColor( hDC, nTextColor ); } if ( (pPosAry->mnSrcWidth == pPosAry->mnDestWidth) && @@ -822,3 +843,5 @@ void WinSalGraphics::invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInver SelectBrush( mhDC, hOldBrush ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index d07f61bc23d1..5943c1749761 100755..100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,6 +32,7 @@ #include <string.h> #include <malloc.h> +#include <svsys.h> #include "rtl/logfile.hxx" #include "rtl/tencinfo.h" #include "rtl/textcvt.h" @@ -57,10 +59,6 @@ #include "tools/debug.hxx" #include "tools/stream.hxx" -#include <tools/prewin.h> -#include <windows.h> -#include <tools/postwin.h> - #include <vcl/sysdata.hxx> #include "win/wincomp.hxx" @@ -78,8 +76,7 @@ #endif #ifdef ENABLE_GRAPHITE -#include <graphite/GrClient.h> -#include <graphite/WinFont.h> +#include <graphite2/Font.h> #endif #include <vector> @@ -212,7 +209,7 @@ ImplFontAttrCache::~ImplFontAttrCache() aCacheFile.WriteByteStringLine( rDFA.maStyleName, RTL_TEXTENCODING_UTF8 ); - aIter++; + ++aIter; } // EOF Marker String aEmptyStr; @@ -556,13 +553,14 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFo { // guess a locale matching to the missing chars com::sun::star::lang::Locale aLocale; + LanguageType eLang = LANGUAGE_DONTKNOW; sal_Int32 nStrIdx = 0; const sal_Int32 nStrLen = rMissingChars.getLength(); while( nStrIdx < nStrLen ) { const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIdx ); - const LanguageType eLang = MapCharToLanguage( uChar ); + eLang = MapCharToLanguage( uChar ); if( eLang == LANGUAGE_DONTKNOW ) continue; MsLangId::convertLanguageToLocale( eLang, aLocale ); @@ -570,7 +568,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFo } // fall back to default UI locale if the missing characters are inconclusive - if( nStrIdx >= nStrLen ) + if( eLang == LANGUAGE_DONTKNOW ) aLocale = Application::GetSettings().GetUILocale(); // first level fallback: @@ -1093,6 +1091,106 @@ void ImplSalLogFontToFontW( HDC hDC, const LOGFONTW& rLogFont, Font& rFont ) } // ======================================================================= +#ifdef ENABLE_GRAPHITE + +#ifdef DEBUG +static FILE * grLogFile = NULL; +static FILE * grLog() +{ +#ifdef WNT + std::string logFileName(getenv("TEMP")); + logFileName.append("\\grface.log"); + if (grLogFile == NULL) grLogFile = fopen(logFileName.c_str(),"w"); + else fflush(grLogFile); + return grLogFile; +#else + fflush(stdout); + return stdout; +#endif +} +#undef NDEBUG +#endif + +const void * getGrTable(const void* appFaceHandle, unsigned int name, size_t *len) +{ + const GrFontData * fontTables = reinterpret_cast<const GrFontData*>(appFaceHandle); + return fontTables->getTable(name, len); +} + +GrFontData::GrFontData(HDC hDC) : + mhDC(hDC), mpFace(NULL), mnRefCount(1) +{ + // The face options ensure that the tables are all read at construction + // time so there is no need to keep the hDC uptodate + static const char* pGraphiteCacheStr = getenv( "SAL_GRAPHITE_CACHE_SIZE" ); + unsigned long graphiteSegCacheSize = pGraphiteCacheStr ? (atoi(pGraphiteCacheStr)) : 0; + if (graphiteSegCacheSize > 500) + mpFace = gr_make_face_with_seg_cache(this, getGrTable, + graphiteSegCacheSize, gr_face_preloadGlyphs | gr_face_cacheCmap); + else + mpFace = gr_make_face(this, getGrTable, + gr_face_preloadGlyphs | gr_face_cacheCmap); +#ifdef DEBUG + fprintf(grLog(), "gr_make_face %lx for WinFontData %lx\n", (unsigned long)mpFace, + (unsigned long)this); +#endif + mhDC = NULL; +} + +GrFontData::~GrFontData() +{ + if (mpFace) + { +#ifdef DEBUG + fprintf(grLog(), "gr_face_destroy %lx for WinFontData %lx\n", (unsigned long)mpFace, + (unsigned long)this); +#endif + gr_face_destroy(mpFace); + mpFace = NULL; + } + std::vector<RawFontData*>::iterator i = mvData.begin(); + while (i != mvData.end()) + { + delete *i; + ++i; + } + mvData.clear(); +} + +const void * GrFontData::getTable(unsigned int name, size_t *len) const +{ +#ifdef DEBUG +#undef NDEBUG +#endif + assert(mhDC); + // swap the bytes + union TtfTag { + unsigned int i; + unsigned char c[4]; + }; + TtfTag littleEndianTag; + littleEndianTag.i = name; + TtfTag bigEndianTag; + bigEndianTag.c[0] = littleEndianTag.c[3]; + bigEndianTag.c[1] = littleEndianTag.c[2]; + bigEndianTag.c[2] = littleEndianTag.c[1]; + bigEndianTag.c[3] = littleEndianTag.c[0]; + mvData.push_back(new RawFontData(mhDC, bigEndianTag.i)); + const RawFontData * data = mvData[mvData.size()-1]; + if (data && (data->size() > 0)) + { + if (len) + *len = data->size(); + return reinterpret_cast<const void *>(data->get()); + } + else + { + if (len) + *len = 0; + return NULL; + } +} +#endif ImplWinFontData::ImplWinFontData( const ImplDevFontAttributes& rDFS, int nHeight, BYTE eWinCharSet, BYTE nPitchAndFamily ) @@ -1109,10 +1207,14 @@ ImplWinFontData::ImplWinFontData( const ImplDevFontAttributes& rDFS, mbHasGraphiteSupport( false ), #endif mbHasArabicSupport ( false ), + mbFontCapabilitiesRead( false ), mbAliasSymbolsLow( false ), mbAliasSymbolsHigh( false ), mnId( 0 ), mpEncodingVector( NULL ) +#ifdef ENABLE_GRAPHITE + ,mpGraphiteData(NULL) +#endif { SetBitmapSize( 0, nHeight ); @@ -1136,6 +1238,9 @@ ImplWinFontData::ImplWinFontData( const ImplDevFontAttributes& rDFS, mbAliasSymbolsHigh = true; } } +#ifdef DEBUG + fprintf(grLog(), "ImplWinFontData::ImplWinFontData() %lx\n", (unsigned long)this); +#endif } // ----------------------------------------------------------------------- @@ -1146,6 +1251,13 @@ ImplWinFontData::~ImplWinFontData() if( mpUnicodeMap ) mpUnicodeMap->DeReference(); +#ifdef ENABLE_GRAPHITE + if (mpGraphiteData) + mpGraphiteData->DeReference(); +#ifdef DEBUG + fprintf(grLog(), "ImplWinFontData::~ImplWinFontData %lx\n", (unsigned long)this); +#endif +#endif // ENABLE_GRAPHITE delete mpEncodingVector; } @@ -1158,6 +1270,13 @@ sal_IntPtr ImplWinFontData::GetFontId() const // ----------------------------------------------------------------------- +static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);} +static unsigned GetUShort( const unsigned char* p ){ return((p[0]<<8)+p[1]);} +//static signed GetSShort( const unsigned char* p ){ return((short)((p[0]<<8)+p[1]));} +static inline DWORD CalcTag( const char p[4]) { return (p[0]+(p[1]<<8)+(p[2]<<16)+(p[3]<<24)); } + +// ----------------------------------------------------------------------- + void ImplWinFontData::UpdateFromHDC( HDC hDC ) const { // short circuit if already initialized @@ -1165,12 +1284,31 @@ void ImplWinFontData::UpdateFromHDC( HDC hDC ) const return; ReadCmapTable( hDC ); - ReadOs2Table( hDC ); + GetFontCapabilities( hDC ); #ifdef ENABLE_GRAPHITE static const char* pDisableGraphiteText = getenv( "SAL_DISABLE_GRAPHITE" ); if( !pDisableGraphiteText || (pDisableGraphiteText[0] == '0') ) { - mbHasGraphiteSupport = gr::WinFont::FontHasGraphiteTables(hDC); + const DWORD nSilfTag = CalcTag("Silf"); + const RawFontData aRawFontData( hDC, nSilfTag ); + mbHasGraphiteSupport = (aRawFontData.size() > 0); + if (mbHasGraphiteSupport) + { +#ifdef DEBUG + fprintf(grLog(), "ImplWinFontData::UpdateFromHDC %lx\n", + (unsigned long)this); +#endif + if (mpGraphiteData == NULL) + { + mpGraphiteData = new GrFontData(hDC); + if (!mpGraphiteData->getFace()) + { + mbHasGraphiteSupport = false; + delete mpGraphiteData; + mpGraphiteData = NULL; + } + } + } } #endif @@ -1182,14 +1320,19 @@ void ImplWinFontData::UpdateFromHDC( HDC hDC ) const || (aTextMetric.tmPitchAndFamily & TMPF_DEVICE) ) mbDisableGlyphApi = true; -#if 0 - // #110548# more important than #107885# => TODO: better solution - DWORD nFLI = GetFontLanguageInfo( hDC ); - if( 0 == (nFLI & GCP_GLYPHSHAPE) ) - mbDisableGlyphApi = true; -#endif } +#ifdef ENABLE_GRAPHITE +const gr_face* ImplWinFontData::GraphiteFace() const +{ +#ifdef DEBUG + fprintf(grLog(), "ImplWinFontData::GraphiteFace %lx has face %lx\n", + (unsigned long)this, mpGraphiteData? mpGraphiteData->getFace(): 0); +#endif + assert((mpGraphiteData == NULL) || (mpGraphiteData->getFontData() == this)); + return (mpGraphiteData)? mpGraphiteData->getFace() : NULL; +} +#endif // ----------------------------------------------------------------------- bool ImplWinFontData::HasGSUBstitutions( HDC hDC ) const @@ -1215,40 +1358,10 @@ const ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const return mpUnicodeMap; } -// ----------------------------------------------------------------------- - -static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);} -static unsigned GetUShort( const unsigned char* p ){ return((p[0]<<8)+p[1]);} -//static signed GetSShort( const unsigned char* p ){ return((short)((p[0]<<8)+p[1]));} -static inline DWORD CalcTag( const char p[4]) { return (p[0]+(p[1]<<8)+(p[2]<<16)+(p[3]<<24)); } - -void ImplWinFontData::ReadOs2Table( HDC hDC ) const +bool ImplWinFontData::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const { - const DWORD Os2Tag = CalcTag( "OS/2" ); - DWORD nLength = ::GetFontData( hDC, Os2Tag, 0, NULL, 0 ); - if( (nLength == GDI_ERROR) || !nLength ) - return; - std::vector<unsigned char> aOS2map( nLength ); - unsigned char* pOS2map = &aOS2map[0]; - ::GetFontData( hDC, Os2Tag, 0, pOS2map, nLength ); - sal_uInt32 nVersion = GetUShort( pOS2map ); - if ( nVersion >= 0x0001 && nLength >= 58 ) - { - // We need at least version 0x0001 (TrueType rev 1.66) - // to have access to the needed struct members. - sal_uInt32 ulUnicodeRange1 = GetUInt( pOS2map + 42 ); - sal_uInt32 ulUnicodeRange2 = GetUInt( pOS2map + 46 ); -#if 0 - sal_uInt32 ulUnicodeRange3 = GetUInt( pOS2map + 50 ); - sal_uInt32 ulUnicodeRange4 = GetUInt( pOS2map + 54 ); -#endif - - // Check for CJK capabilities of the current font - mbHasCJKSupport = (ulUnicodeRange2 & 0x2DF00000); - mbHasKoreanRange= (ulUnicodeRange1 & 0x10000000) - | (ulUnicodeRange2 & 0x01100000); - mbHasArabicSupport = (ulUnicodeRange1 & 0x00002000); - } + rFontCapabilities = maFontCapabilities; + return !rFontCapabilities.maUnicodeRange.empty() || !rFontCapabilities.maCodePageRange.empty(); } // ----------------------------------------------------------------------- @@ -1324,6 +1437,50 @@ void ImplWinFontData::ReadCmapTable( HDC hDC ) const mpUnicodeMap->AddReference(); } +void ImplWinFontData::GetFontCapabilities( HDC hDC ) const +{ + // read this only once per font + if( mbFontCapabilitiesRead ) + return; + + mbFontCapabilitiesRead = true; + + // GSUB table + DWORD nLength; + const DWORD GsubTag = CalcTag( "GSUB" ); + nLength = ::GetFontData( hDC, GsubTag, 0, NULL, 0 ); + if( (nLength != GDI_ERROR) && nLength ) + { + std::vector<unsigned char> aTable( nLength ); + unsigned char* pTable = &aTable[0]; + ::GetFontData( hDC, GsubTag, 0, pTable, nLength ); + vcl::getTTScripts(maFontCapabilities.maGSUBScriptTags, pTable, nLength); + } + + // OS/2 table + const DWORD OS2Tag = CalcTag( "OS/2" ); + nLength = ::GetFontData( hDC, OS2Tag, 0, NULL, 0 ); + if( (nLength != GDI_ERROR) && nLength ) + { + std::vector<unsigned char> aTable( nLength ); + unsigned char* pTable = &aTable[0]; + ::GetFontData( hDC, OS2Tag, 0, pTable, nLength ); + if (vcl::getTTCoverage(maFontCapabilities.maUnicodeRange, maFontCapabilities.maCodePageRange, pTable, nLength)) + { + // Check for CJK capabilities of the current font + // TODO, we have this info already from getTT, decode bits to + // a readable dynamic_bitset + sal_uInt32 ulUnicodeRange1 = GetUInt( pTable + 42 ); + sal_uInt32 ulUnicodeRange2 = GetUInt( pTable + 46 ); + + mbHasCJKSupport = (ulUnicodeRange2 & 0x2DF00000); + mbHasKoreanRange= (ulUnicodeRange1 & 0x10000000) + | (ulUnicodeRange2 & 0x01100000); + mbHasArabicSupport = (ulUnicodeRange1 & 0x00002000); + } + } +} + // ======================================================================= void WinSalGraphics::SetTextColor( SalColor nSalColor ) @@ -1354,32 +1511,22 @@ int CALLBACK SalEnumQueryFontProcExW( const ENUMLOGFONTEXW*, // ----------------------------------------------------------------------- -int CALLBACK SalEnumQueryFontProcExA( const ENUMLOGFONTEXA*, - const NEWTEXTMETRICEXA*, - DWORD, LPARAM lParam ) -{ - *((bool*)(void*)lParam) = true; - return 0; -} - -// ----------------------------------------------------------------------- - bool ImplIsFontAvailable( HDC hDC, const UniString& rName ) { - // Test, if Font available - LOGFONTW aLogFont; - memset( &aLogFont, 0, sizeof( aLogFont ) ); - aLogFont.lfCharSet = DEFAULT_CHARSET; + // Test, if Font available + LOGFONTW aLogFont; + memset( &aLogFont, 0, sizeof( aLogFont ) ); + aLogFont.lfCharSet = DEFAULT_CHARSET; - UINT nNameLen = rName.Len(); - if ( nNameLen > (sizeof( aLogFont.lfFaceName )/sizeof( wchar_t ))-1 ) - nNameLen = (sizeof( aLogFont.lfFaceName )/sizeof( wchar_t ))-1; - memcpy( aLogFont.lfFaceName, rName.GetBuffer(), nNameLen*sizeof( wchar_t ) ); - aLogFont.lfFaceName[nNameLen] = 0; + UINT nNameLen = rName.Len(); + if ( nNameLen > (sizeof( aLogFont.lfFaceName )/sizeof( wchar_t ))-1 ) + nNameLen = (sizeof( aLogFont.lfFaceName )/sizeof( wchar_t ))-1; + memcpy( aLogFont.lfFaceName, rName.GetBuffer(), nNameLen*sizeof( wchar_t ) ); + aLogFont.lfFaceName[nNameLen] = 0; bool bAvailable = false; EnumFontFamiliesExW( hDC, &aLogFont, (FONTENUMPROCW)SalEnumQueryFontProcExW, - (LPARAM)(void*)&bAvailable, 0 ); + (LPARAM)(void*)&bAvailable, 0 ); return bAvailable; } @@ -1459,80 +1606,6 @@ void ImplGetLogFontFromFontSelect( HDC hDC, // ----------------------------------------------------------------------- -static void ImplGetLogFontFromFontSelect( HDC hDC, - const ImplFontSelectData* pFont, - LOGFONTA& rLogFont, - bool /*bTestVerticalAvail*/ ) -{ - ByteString aName; - if( pFont->mpFontData ) - aName = ImplSalGetWinAnsiString( pFont->mpFontData->maName ); - else - aName = ImplSalGetWinAnsiString( pFont->maName.GetToken( 0 ) ); - - int nNameLen = aName.Len(); - if( nNameLen > LF_FACESIZE ) - nNameLen = LF_FACESIZE; - memcpy( rLogFont.lfFaceName, aName.GetBuffer(), nNameLen ); - if( nNameLen < LF_FACESIZE ) - rLogFont.lfFaceName[nNameLen] = '\0'; - - if( !pFont->mpFontData ) - { - rLogFont.lfCharSet = pFont->IsSymbolFont() ? SYMBOL_CHARSET : DEFAULT_CHARSET; - rLogFont.lfPitchAndFamily = ImplPitchToWin( pFont->mePitch ) - | ImplFamilyToWin( pFont->meFamily ); - } - else - { - const ImplWinFontData* pWinFontData = static_cast<const ImplWinFontData*>( pFont->mpFontData ); - rLogFont.lfCharSet = pWinFontData->GetCharSet(); - rLogFont.lfPitchAndFamily = pWinFontData->GetPitchAndFamily(); - } - - rLogFont.lfWeight = ImplWeightToWin( pFont->meWeight ); - rLogFont.lfHeight = (LONG)-pFont->mnHeight; - rLogFont.lfWidth = (LONG)pFont->mnWidth; - rLogFont.lfUnderline = 0; - rLogFont.lfStrikeOut = 0; - rLogFont.lfItalic = (pFont->meItalic) != ITALIC_NONE; - rLogFont.lfEscapement = pFont->mnOrientation; - rLogFont.lfOrientation = rLogFont.lfEscapement; // ignored by W98 - rLogFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; - rLogFont.lfQuality = DEFAULT_QUALITY; - rLogFont.lfOutPrecision = OUT_TT_PRECIS; - if( pFont->mnOrientation ) - rLogFont.lfClipPrecision |= CLIP_LH_ANGLES; - - // disable antialiasing if requested - if( pFont->mbNonAntialiased ) - rLogFont.lfQuality = NONANTIALIASED_QUALITY; - - // select vertical mode if requested and available - if( pFont->mbVertical && nNameLen ) - { - // vertical fonts start with an '@' - memmove( &rLogFont.lfFaceName[1], &rLogFont.lfFaceName[0], - sizeof(rLogFont.lfFaceName)-sizeof(rLogFont.lfFaceName[0]) ); - rLogFont.lfFaceName[0] = '@'; - - // check availability of vertical mode for this font - bool bAvailable = false; - EnumFontFamiliesExA( hDC, &rLogFont, (FONTENUMPROCA)SalEnumQueryFontProcExA, - (LPARAM)&bAvailable, 0 ); - - if( !bAvailable ) - { - // restore non-vertical name if vertical mode is not supported - memcpy( rLogFont.lfFaceName, aName.GetBuffer(), nNameLen ); - if( nNameLen < LF_FACESIZE ) - rLogFont.lfFaceName[nNameLen] = '\0'; - } - } -} - -// ----------------------------------------------------------------------- - HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, HFONT& o_rOldFont ) { HFONT hNewFont = 0; @@ -1542,65 +1615,62 @@ HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFont // only required for virtual devices, see below for details hdcScreen = GetDC(0); - if( true/*aSalShlData.mbWNT*/ ) + LOGFONTW aLogFont; + ImplGetLogFontFromFontSelect( mhDC, i_pFont, aLogFont, true ); + + // on the display we prefer Courier New when Courier is a + // bitmap only font and we need to stretch or rotate it + if( mbScreen + && (i_pFont->mnWidth != 0 + || i_pFont->mnOrientation != 0 + || i_pFont->mpFontData == NULL + || (i_pFont->mpFontData->GetHeight() != i_pFont->mnHeight)) + && !bImplSalCourierScalable + && bImplSalCourierNew + && (ImplSalWICompareAscii( aLogFont.lfFaceName, "Courier" ) == 0) ) + lstrcpynW( aLogFont.lfFaceName, L"Courier New", 11 ); + + // #i47675# limit font requests to MAXFONTHEIGHT + // TODO: share MAXFONTHEIGHT font instance + if( (-aLogFont.lfHeight <= MAXFONTHEIGHT) + && (+aLogFont.lfWidth <= MAXFONTHEIGHT) ) { - LOGFONTW aLogFont; - ImplGetLogFontFromFontSelect( mhDC, i_pFont, aLogFont, true ); - - // on the display we prefer Courier New when Courier is a - // bitmap only font and we need to stretch or rotate it - if( mbScreen - && (i_pFont->mnWidth != 0 - || i_pFont->mnOrientation != 0 - || i_pFont->mpFontData == NULL - || (i_pFont->mpFontData->GetHeight() != i_pFont->mnHeight)) - && !bImplSalCourierScalable - && bImplSalCourierNew - && (ImplSalWICompareAscii( aLogFont.lfFaceName, "Courier" ) == 0) ) - lstrcpynW( aLogFont.lfFaceName, L"Courier New", 11 ); - - // #i47675# limit font requests to MAXFONTHEIGHT - // TODO: share MAXFONTHEIGHT font instance - if( (-aLogFont.lfHeight <= MAXFONTHEIGHT) - && (+aLogFont.lfWidth <= MAXFONTHEIGHT) ) - { - o_rFontScale = 1.0; - } - else if( -aLogFont.lfHeight >= +aLogFont.lfWidth ) - { - o_rFontScale = -aLogFont.lfHeight / (float)MAXFONTHEIGHT; - aLogFont.lfHeight = -MAXFONTHEIGHT; - aLogFont.lfWidth = FRound( aLogFont.lfWidth / o_rFontScale ); - } - else // #i95867# also limit font widths - { - o_rFontScale = +aLogFont.lfWidth / (float)MAXFONTHEIGHT; - aLogFont.lfWidth = +MAXFONTHEIGHT; - aLogFont.lfHeight = FRound( aLogFont.lfHeight / o_rFontScale ); - } + o_rFontScale = 1.0; + } + else if( -aLogFont.lfHeight >= +aLogFont.lfWidth ) + { + o_rFontScale = -aLogFont.lfHeight / (float)MAXFONTHEIGHT; + aLogFont.lfHeight = -MAXFONTHEIGHT; + aLogFont.lfWidth = FRound( aLogFont.lfWidth / o_rFontScale ); + } + else // #i95867# also limit font widths + { + o_rFontScale = +aLogFont.lfWidth / (float)MAXFONTHEIGHT; + aLogFont.lfWidth = +MAXFONTHEIGHT; + aLogFont.lfHeight = FRound( aLogFont.lfHeight / o_rFontScale ); + } - hNewFont = ::CreateFontIndirectW( &aLogFont ); - if( hdcScreen ) - { - // select font into screen hdc first to get an antialiased font - // see knowledge base article 305290: - // "PRB: Fonts Not Drawn Antialiased on Device Context for DirectDraw Surface" - SelectFont( hdcScreen, SelectFont( hdcScreen , hNewFont ) ); - } - o_rOldFont = ::SelectFont( mhDC, hNewFont ); + hNewFont = ::CreateFontIndirectW( &aLogFont ); + if( hdcScreen ) + { + // select font into screen hdc first to get an antialiased font + // see knowledge base article 305290: + // "PRB: Fonts Not Drawn Antialiased on Device Context for DirectDraw Surface" + SelectFont( hdcScreen, SelectFont( hdcScreen , hNewFont ) ); + } + o_rOldFont = ::SelectFont( mhDC, hNewFont ); - TEXTMETRICW aTextMetricW; - if( !::GetTextMetricsW( mhDC, &aTextMetricW ) ) - { - // the selected font doesn't work => try a replacement - // TODO: use its font fallback instead - lstrcpynW( aLogFont.lfFaceName, L"Courier New", 11 ); - aLogFont.lfPitchAndFamily = FIXED_PITCH; - HFONT hNewFont2 = CreateFontIndirectW( &aLogFont ); - SelectFont( mhDC, hNewFont2 ); - DeleteFont( hNewFont ); - hNewFont = hNewFont2; - } + TEXTMETRICW aTextMetricW; + if( !::GetTextMetricsW( mhDC, &aTextMetricW ) ) + { + // the selected font doesn't work => try a replacement + // TODO: use its font fallback instead + lstrcpynW( aLogFont.lfFaceName, L"Courier New", 11 ); + aLogFont.lfPitchAndFamily = FIXED_PITCH; + HFONT hNewFont2 = CreateFontIndirectW( &aLogFont ); + SelectFont( mhDC, hNewFont2 ); + DeleteFont( hNewFont ); + hNewFont = hNewFont2; } if( hdcScreen ) @@ -1617,6 +1687,7 @@ sal_uInt16 WinSalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLeve // deselect still active font if( mhDefFont ) ::SelectFont( mhDC, mhDefFont ); + mfCurrentFontScale = mfFontScale[nFallbackLevel]; // release no longer referenced font handles for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) { @@ -1633,7 +1704,8 @@ sal_uInt16 WinSalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLeve mpWinFontData[ nFallbackLevel ] = static_cast<const ImplWinFontData*>( pFont->mpFontData ); HFONT hOldFont = 0; - HFONT hNewFont = ImplDoSetFont( pFont, mfFontScale, hOldFont ); + HFONT hNewFont = ImplDoSetFont( pFont, mfFontScale[ nFallbackLevel ], hOldFont ); + mfCurrentFontScale = mfFontScale[nFallbackLevel]; if( !mhDefFont ) { @@ -1688,9 +1760,9 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe // temporarily change the HDC to the font in the fallback level HFONT hOldFont = SelectFont( mhDC, mhFonts[nFallbackLevel] ); - wchar_t aFaceName[LF_FACESIZE+60]; - if( ::GetTextFaceW( mhDC, sizeof(aFaceName)/sizeof(wchar_t), aFaceName ) ) - pMetric->maName = reinterpret_cast<const sal_Unicode*>(aFaceName); + wchar_t aFaceName[LF_FACESIZE+60]; + if( ::GetTextFaceW( mhDC, sizeof(aFaceName)/sizeof(wchar_t), aFaceName ) ) + pMetric->maName = reinterpret_cast<const sal_Unicode*>(aFaceName); // get the font metric TEXTMETRICA aWinMetric; @@ -1727,11 +1799,11 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe } // transformation dependend font metrics - pMetric->mnWidth = static_cast<int>( mfFontScale * aWinMetric.tmAveCharWidth ); - pMetric->mnIntLeading = static_cast<int>( mfFontScale * aWinMetric.tmInternalLeading ); - pMetric->mnExtLeading = static_cast<int>( mfFontScale * aWinMetric.tmExternalLeading ); - pMetric->mnAscent = static_cast<int>( mfFontScale * aWinMetric.tmAscent ); - pMetric->mnDescent = static_cast<int>( mfFontScale * aWinMetric.tmDescent ); + pMetric->mnWidth = static_cast<int>( mfFontScale[nFallbackLevel] * aWinMetric.tmAveCharWidth ); + pMetric->mnIntLeading = static_cast<int>( mfFontScale[nFallbackLevel] * aWinMetric.tmInternalLeading ); + pMetric->mnExtLeading = static_cast<int>( mfFontScale[nFallbackLevel] * aWinMetric.tmExternalLeading ); + pMetric->mnAscent = static_cast<int>( mfFontScale[nFallbackLevel] * aWinMetric.tmAscent ); + pMetric->mnDescent = static_cast<int>( mfFontScale[nFallbackLevel] * aWinMetric.tmDescent ); // #107888# improved metric compatibility for Asian fonts... // TODO: assess workaround below for CWS >= extleading @@ -1952,6 +2024,13 @@ const ImplFontCharMap* WinSalGraphics::GetImplFontCharMap() const return mpWinFontData[0]->GetImplFontCharMap(); } +bool WinSalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const +{ + if( !mpWinFontData[0] ) + return false; + return mpWinFontData[0]->GetImplFontCapabilities(rFontCapabilities); +} + // ----------------------------------------------------------------------- int CALLBACK SalEnumFontsProcExA( const ENUMLOGFONTEXA* pLogFont, @@ -2362,7 +2441,7 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) while( aFontDir.getNextItem( aDirItem, 10 ) == osl::FileBase::E_None ) { - osl::FileStatus aFileStatus( FileStatusMask_FileURL ); + osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL ); rcOSL = aDirItem.getFileStatus( aFileStatus ); if ( rcOSL == osl::FileBase::E_None ) AddTempDevFont( pFontList, aFileStatus.getFileURL(), aEmptyString ); @@ -2404,7 +2483,7 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) aLogFont.lfCharSet = DEFAULT_CHARSET; aInfo.mpLogFontW = &aLogFont; EnumFontFamiliesExW( mhDC, &aLogFont, - (FONTENUMPROCW)SalEnumFontsProcExW, (LPARAM)(void*)&aInfo, 0 ); + (FONTENUMPROCW)SalEnumFontsProcExW, (LPARAM)(void*)&aInfo, 0 ); // Feststellen, was es fuer Courier-Schriften auf dem Bildschirm gibt, // um in SetFont() evt. Courier auf Courier New zu mappen @@ -2426,7 +2505,7 @@ void WinSalGraphics::GetDevFontSubstList( OutputDevice* ) // ----------------------------------------------------------------------- -sal_Bool WinSalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect ) +sal_Bool WinSalGraphics::GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& rRect ) { HDC hDC = mhDC; @@ -2449,16 +2528,16 @@ sal_Bool WinSalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect ) rRect = Rectangle( Point( +aGM.gmptGlyphOrigin.x, -aGM.gmptGlyphOrigin.y ), Size( aGM.gmBlackBoxX, aGM.gmBlackBoxY ) ); - rRect.Left() = static_cast<int>( mfFontScale * rRect.Left() ); - rRect.Right() = static_cast<int>( mfFontScale * rRect.Right() ); - rRect.Top() = static_cast<int>( mfFontScale * rRect.Top() ); - rRect.Bottom() = static_cast<int>( mfFontScale * rRect.Bottom() ); + rRect.Left() = static_cast<int>( mfCurrentFontScale * rRect.Left() ); + rRect.Right() = static_cast<int>( mfCurrentFontScale * rRect.Right() ); + rRect.Top() = static_cast<int>( mfCurrentFontScale * rRect.Top() ); + rRect.Bottom() = static_cast<int>( mfCurrentFontScale * rRect.Bottom() ); return true; } // ----------------------------------------------------------------------- -sal_Bool WinSalGraphics::GetGlyphOutline( long nIndex, +sal_Bool WinSalGraphics::GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& rB2DPolyPoly ) { rB2DPolyPoly.clear(); @@ -2503,7 +2582,7 @@ sal_Bool WinSalGraphics::GetGlyphOutline( long nIndex, // get start point; next start points are end points // of previous segment - USHORT nPnt = 0; + sal_uInt16 nPnt = 0; long nX = IntTimes256FromFixed( pHeader->pfxStart.x ); long nY = IntTimes256FromFixed( pHeader->pfxStart.y ); @@ -2523,7 +2602,7 @@ sal_Bool WinSalGraphics::GetGlyphOutline( long nIndex, nPtSize = 2 * nNeededSize; pPoints = new Point[ nPtSize ]; pFlags = new BYTE[ nPtSize ]; - for( USHORT i = 0; i < nPnt; ++i ) + for( sal_uInt16 i = 0; i < nPnt; ++i ) { pPoints[ i ] = pOldPoints[ i ]; pFlags[ i ] = pOldFlags[ i ]; @@ -2633,7 +2712,7 @@ sal_Bool WinSalGraphics::GetGlyphOutline( long nIndex, // rescaling needed for the PolyPolygon conversion if( rB2DPolyPoly.count() ) { - const double fFactor(mfFontScale/256); + const double fFactor(mfCurrentFontScale/256); rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor)); } @@ -2937,15 +3016,8 @@ const Ucs2SIntMap* WinSalGraphics::GetFontEncodingVector( const ImplFontData* pF if( pEncoding == NULL ) { Ucs2SIntMap* pNewEncoding = new Ucs2SIntMap; - #if 0 - // TODO: get correct encoding vector - GLYPHSET aGlyphSet; - aGlyphSet.cbThis = sizeof(aGlyphSet); - DWORD aW = ::GetFontUnicodeRanges( mhDC, &aGlyphSet); - #else for( sal_Unicode i = 32; i < 256; ++i ) (*pNewEncoding)[i] = i; - #endif pWinFontData->SetEncodingVector( pNewEncoding ); pEncoding = pNewEncoding; } @@ -3077,3 +3149,4 @@ SystemFontData WinSalGraphics::GetSysFontData( int nFallbacklevel ) const //-------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx index 2b46ce47b82d..3c55685f0aba 100644 --- a/vcl/win/source/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #include <stdio.h> #include <string.h> -#include <tools/svwin.h> +#include <svsys.h> #include <tools/debug.hxx> #include <win/wincomp.hxx> @@ -265,3 +266,5 @@ bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double f } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 0f1b8151967d..09d214593a42 100755..100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,9 +47,10 @@ #include <map> #include <string> -using namespace rtl; using namespace std; +using ::rtl::OUString; + typedef map< wstring, HTHEME > ThemeMap; static ThemeMap aThemeMap; @@ -187,7 +189,7 @@ void SalData::deInitNWF( void ) while( iter != aThemeMap.end() ) { vsAPI.CloseThemeData(iter->second); - iter++; + ++iter; } aThemeMap.clear(); if( maDwmLib ) @@ -1417,3 +1419,4 @@ sal_Bool WinSalGraphics::getNativeControlRegion( ControlType nType, return( bRet ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index 263d06670584..07a6b633e11b 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#define WINVER 0x0500 + #include <string.h> +#include <svsys.h> + #include <osl/module.h> #include <tools/urlobj.hxx> -#include <tools/svwin.h> + #ifdef __MINGW32__ #include <excpt.h> #endif @@ -81,14 +86,14 @@ } \ __except(WinSalInstance::WorkaroundExceptionHandlingInUSER32Lib(GetExceptionCode(), GetExceptionInformation()))\ { \ - DBG_ERROR( mes ); \ + OSL_FAIL( mes ); \ p->markInvalid(); \ } #define CATCH_DRIVER_EX_END_2(mes) \ } \ __except(WinSalInstance::WorkaroundExceptionHandlingInUSER32Lib(GetExceptionCode(), GetExceptionInformation()))\ { \ - DBG_ERROR( mes ); \ + OSL_FAIL( mes ); \ } #endif @@ -97,7 +102,7 @@ using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::ui::dialogs; -using namespace rtl; +using ::rtl::OUString; // ======================================================================= @@ -1715,15 +1720,12 @@ sal_uLong WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, sa return nRet; return 0; case PRINTER_CAPABILITIES_COLLATECOPIES: - if ( aSalShlData.mbW40 ) + nRet = ImplDeviceCaps( this, DC_COLLATE, NULL, pSetupData ); + if ( nRet && (nRet != GDI_ERROR) ) { - nRet = ImplDeviceCaps( this, DC_COLLATE, NULL, pSetupData ); + nRet = ImplDeviceCaps( this, DC_COPIES, NULL, pSetupData ); if ( nRet && (nRet != GDI_ERROR) ) - { - nRet = ImplDeviceCaps( this, DC_COPIES, NULL, pSetupData ); - if ( nRet && (nRet != GDI_ERROR) ) - return nRet; - } + return nRet; } return 0; @@ -1843,14 +1845,11 @@ static LPDEVMODEA ImplSalSetCopies( LPDEVMODEA pDevMode, sal_uLong nCopies, sal_ pDevMode = pNewDevMode; pDevMode->dmFields |= DM_COPIES; pDevMode->dmCopies = (short)(sal_uInt16)nCopies; - if ( aSalShlData.mbW40 ) - { - pDevMode->dmFields |= DM_COLLATE; - if ( bCollate ) - pDevMode->dmCollate = DMCOLLATE_TRUE; - else - pDevMode->dmCollate = DMCOLLATE_FALSE; - } + pDevMode->dmFields |= DM_COLLATE; + if ( bCollate ) + pDevMode->dmCollate = DMCOLLATE_TRUE; + else + pDevMode->dmCollate = DMCOLLATE_FALSE; } return pNewDevMode; @@ -1869,14 +1868,11 @@ static LPDEVMODEW ImplSalSetCopies( LPDEVMODEW pDevMode, sal_uLong nCopies, sal_ pDevMode = pNewDevMode; pDevMode->dmFields |= DM_COPIES; pDevMode->dmCopies = (short)(sal_uInt16)nCopies; - if ( aSalShlData.mbW40 ) - { - pDevMode->dmFields |= DM_COLLATE; - if ( bCollate ) - pDevMode->dmCollate = DMCOLLATE_TRUE; - else - pDevMode->dmCollate = DMCOLLATE_FALSE; - } + pDevMode->dmFields |= DM_COLLATE; + if ( bCollate ) + pDevMode->dmCollate = DMCOLLATE_TRUE; + else + pDevMode->dmCollate = DMCOLLATE_FALSE; } return pNewDevMode; @@ -2370,3 +2366,5 @@ sal_uLong WinSalPrinter::GetErrorCode() { return mnError; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index 94f08a33179c..564a50d71ebb 100755 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <tools/svwin.h> +#include <svsys.h> #include <vcl/sysdata.hxx> @@ -257,3 +258,5 @@ void WinSalVirtualDevice::GetSize( long& rWidth, long& rHeight ) rWidth = GetDeviceCaps( mhDC, HORZRES ); rHeight= GetDeviceCaps( mhDC, VERTRES ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index dd896059160e..ec4917f4201a 100755..100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,13 +29,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#include <svsys.h> #include "rtl/ustring.hxx" #include "osl/module.h" #include "osl/file.h" -#include "tools/svwin.h" - #include "vcl/svapp.hxx" #include "win/salgdi.h" @@ -62,26 +62,24 @@ #include <winver.h> #endif // USE_UNISCRIBE -#include <hash_map> +#include <boost/unordered_map.hpp> #include <set> -typedef std::hash_map<int,int> IntMap; +typedef boost::unordered_map<int,int> IntMap; typedef std::set<int> IntSet; // Graphite headers #ifdef ENABLE_GRAPHITE #include <i18npool/mslangid.hxx> -#include <graphite/GrClient.h> -#include <graphite/WinFont.h> -#include <graphite/Segment.h> #include <graphite_layout.hxx> -#include <graphite_cache.hxx> #include <graphite_features.hxx> #endif #define DROPPED_OUTGLYPH 0xFFFF -using namespace rtl; +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OUStringToOString; // ======================================================================= @@ -1506,11 +1504,6 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) if( nRC != 0 ) continue; -#if 0 // keep the glyphs for now because they are better than nothing - // mark as NotDef glyphs - for( i = 0; i < nGlyphCount; ++i ) - mpOutGlyphs[ i + rVisualItem.mnMinGlyphPos ] = 0; -#endif } else if( nRC != 0 ) // something undefined happened => give up for this visual item @@ -1547,11 +1540,10 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) { if( mpLogClusters[ c ] == i ) { - // --> HDU/FME 2005-10-25 #i55716# skip WORDJOINER + // #i55716# if( rArgs.mpStr[ c ] == 0x2060 ) mpOutGlyphs[ i + rVisualItem.mnMinGlyphPos ] = 1; else - // <-- rArgs.NeedFallback( c, false ); } } @@ -1563,11 +1555,10 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) { if( mpLogClusters[ c ] == i ) { - // --> HDU/FME 2005-10-25 #i55716# skip WORDJOINER + // #i55716# if( rArgs.mpStr[ c ] == 0x2060 ) mpOutGlyphs[ i + rVisualItem.mnMinGlyphPos ] = 1; else - // <-- rArgs.NeedFallback( c, true ); } } @@ -1865,6 +1856,28 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, const VisualItem& rVI = mpVisualItems[ nItem ]; if( rVI.IsEmpty() ) continue; + + //Resolves: fdo#33090 Ensure that all glyph slots, even if 0-width + //or empty due to combining chars etc, map back to a character + //position so that iterating over glyph slots one at a time for + //glyph fallback can keep context as to what characters are the + //inputs that caused a missing glyph in a given font. + { + int dir = 1; + int out = rVI.mnMinCharPos; + if (rVI.IsRTL()) + { + dir = -1; + out = rVI.mnEndCharPos-1; + } + for(c = rVI.mnMinCharPos; c < rVI.mnEndCharPos; ++c) + { + int i = out; + mpGlyphs2Chars[i] = c; + out += dir; + } + } + // calculate the mapping by using mpLogClusters[] // mpGlyphs2Chars[] should obey the logical order // => reversing the loop does this by overwriting higher logicals @@ -1923,11 +1936,11 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, } else { - nExtraOfs += nToFillWidth; // at right of cell - nSubIter = 0; // done with glyph injection + nExtraOfs += nToFillWidth; // at right of cell + nSubIter = 0; // done with glyph injection } if( !bManualCellAlign ) - nExtraOfs -= nExtraWidth; // adjust for right-aligned cells + nExtraOfs -= nExtraWidth; // adjust for right-aligned cells // adjust the draw position for the injected-glyphs case if( nExtraOfs ) @@ -2063,7 +2076,7 @@ void UniscribeLayout::DropGlyph( int nStartx8 ) if( GetItemSubrange( *pVI, nStart, nDummy ) ) break; DBG_ASSERT( nStart <= mnGlyphCount, "USPLayout::DropG overflow" ); - int nOffset = 0; + int j = pVI->mnMinGlyphPos; while (mpOutGlyphs[j] == DROPPED_OUTGLYPH) j++; if (j == nStart) @@ -2110,7 +2123,6 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ ) } // remove the dropped glyphs - const int* pGlyphWidths = mpJustifications ? mpJustifications : mpGlyphAdvances; for( int nItem = 0; nItem < mnItemCount; ++nItem ) { VisualItem& rVI = mpVisualItems[ nItem ]; @@ -2131,7 +2143,6 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ ) i = nMinGlyphPos; while( (mpOutGlyphs[i] == cDroppedGlyph) && (i < nEndGlyphPos) ) { - //rVI.mnXOffset += pGlyphWidths[ i ]; rVI.mnMinGlyphPos = ++i; } @@ -2205,12 +2216,6 @@ void UniscribeLayout::DrawText( SalGraphics& ) const else nBaseGlyphPos = nMinGlyphPos; - const int* pGlyphWidths; - if( mpJustifications ) - pGlyphWidths = mpJustifications; - else - pGlyphWidths = mpGlyphAdvances; - int i = mnMinCharPos; while( (--i >= rVisualItem.mnMinCharPos) && (nBaseGlyphPos == mpLogClusters[i]) ) @@ -2556,8 +2561,8 @@ void UniscribeLayout::KashidaItemFix( int nMinGlyphPos, int nEndGlyphPos ) { // check for vowels if( (i > nMinGlyphPos && !mpGlyphAdvances[ i-1 ]) - && (1U << mpVisualAttrs[i].uJustification) & 0xFF83 ) // all Arabic justifiction types - { // including SCRIPT_JUSTIFY_NONE + && (1U << mpVisualAttrs[i].uJustification) & 0xFF83 ) // all Arabic justifiction types + { // including SCRIPT_JUSTIFY_NONE // vowel, we do it like ScriptJustify does // the vowel gets the extra width long nSpaceAdded = mpJustifications[ i ] - mpGlyphAdvances[ i ]; @@ -2690,7 +2695,7 @@ void UniscribeLayout::Justify( long nNewWidth ) if( nOldWidth <= 0 ) return; - nNewWidth *= mnUnitsPerPixel; // convert into font units + nNewWidth *= mnUnitsPerPixel; // convert into font units if( nNewWidth == nOldWidth ) return; // prepare to distribute the extra width evenly among the visual items @@ -2703,7 +2708,6 @@ void UniscribeLayout::Justify( long nNewWidth ) // justify stretched script items long nXOffset = 0; - SCRIPT_CACHE& rScriptCache = GetScriptCache(); for( int nItem = 0; nItem < mnItemCount; ++nItem ) { VisualItem& rVisualItem = mpVisualItems[ nItem ]; @@ -2753,8 +2757,8 @@ bool UniscribeLayout::IsKashidaPosValid ( int nCharPos ) const if ( nMinGlyphIndex == -1 || !mpLogClusters[ nCharPos ] ) return false; -// This test didn't give the expected results -/* if( mpLogClusters[ nCharPos+1 ] == mpLogClusters[ nCharPos ]) +// This test didn't give the expected results +/* if( mpLogClusters[ nCharPos+1 ] == mpLogClusters[ nCharPos ]) // two chars, one glyph return false;*/ @@ -2778,9 +2782,9 @@ bool UniscribeLayout::IsKashidaPosValid ( int nCharPos ) const class GraphiteLayoutWinImpl : public GraphiteLayout { public: - GraphiteLayoutWinImpl(const gr::Font & font, ImplWinFontEntry & rFont) + GraphiteLayoutWinImpl(const gr_face * pFace, ImplWinFontEntry & rFont) throw() - : GraphiteLayout(font), mrFont(rFont) {}; + : GraphiteLayout(pFace), mrFont(rFont) {}; virtual ~GraphiteLayoutWinImpl() throw() {}; virtual sal_GlyphId getKashidaGlyph(int & rWidth); private: @@ -2799,18 +2803,15 @@ sal_GlyphId GraphiteLayoutWinImpl::getKashidaGlyph(int & rWidth) class GraphiteWinLayout : public WinLayout { private: - mutable GraphiteWinFont mpFont; + gr_font * mpFont; grutils::GrFeatureParser * mpFeatures; mutable GraphiteLayoutWinImpl maImpl; public: GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE); - static bool IsGraphiteEnabledFont(HDC hDC) throw(); - // used by upper layers virtual bool LayoutText( ImplLayoutArgs& ); // first step of layout virtual void AdjustLayout( ImplLayoutArgs& ); // adjusting after fallback etc. - // virtual void InitFont() const; virtual void DrawText( SalGraphics& ) const; // methods using string indexing @@ -2827,21 +2828,36 @@ public: virtual void MoveGlyph( int nStart, long nNewXPos ); virtual void DropGlyph( int nStart ); virtual void Simplify( bool bIsBase ); - ~GraphiteWinLayout() { delete mpFeatures; mpFeatures = NULL; }; -protected: - virtual void ReplaceDC(gr::Segment & segment) const; - virtual void RestoreDC(gr::Segment & segment) const; + ~GraphiteWinLayout() + { + delete mpFeatures; + gr_font_destroy(maImpl.GetFont()); + } }; -bool GraphiteWinLayout::IsGraphiteEnabledFont(HDC hDC) throw() +float gr_fontAdvance(const void* appFontHandle, gr_uint16 glyphId) { - return gr::WinFont::FontHasGraphiteTables(hDC); + HDC hDC = reinterpret_cast<HDC>(const_cast<void*>(appFontHandle)); + GLYPHMETRICS gm; + const MAT2 mat2 = {{0,1}, {0,0}, {0,0}, {0,1}}; + if (GDI_ERROR == ::GetGlyphOutlineW(hDC, glyphId, GGO_GLYPH_INDEX | GGO_METRICS, + &gm, 0, NULL, &mat2)) + { + return .0f; + } + return gm.gmCellIncX; } GraphiteWinLayout::GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE) throw() - : WinLayout(hDC, rWFD, rWFE), mpFont(hDC), - maImpl(mpFont, rWFE) + : WinLayout(hDC, rWFD, rWFE), mpFont(NULL), + maImpl(rWFD.GraphiteFace(), rWFE) { + // the log font size may differ from the font entry size if scaling is used for large fonts + LOGFONTW aLogFont; + ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont); + mpFont = gr_make_font_with_advance_fn(static_cast<float>(-aLogFont.lfHeight), + hDC, gr_fontAdvance, rWFD.GraphiteFace()); + maImpl.SetFont(mpFont); const rtl::OString aLang = MsLangId::convertLanguageToIsoByteString( rWFE.maFontSelData.meLanguage ); rtl::OString name = rtl::OUStringToOString( rWFE.maFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 ); @@ -2849,27 +2865,15 @@ GraphiteWinLayout::GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplW if (nFeat > 0) { rtl::OString aFeat = name.copy(nFeat, name.getLength() - nFeat); - mpFeatures = new grutils::GrFeatureParser(mpFont, aFeat.getStr(), aLang.getStr()); + mpFeatures = new grutils::GrFeatureParser(rWFD.GraphiteFace(), aFeat.getStr(), aLang.getStr()); } else { - mpFeatures = new grutils::GrFeatureParser(mpFont, aLang.getStr()); + mpFeatures = new grutils::GrFeatureParser(rWFD.GraphiteFace(), aLang.getStr()); } maImpl.SetFeatures(mpFeatures); } -void GraphiteWinLayout::ReplaceDC(gr::Segment & segment) const -{ - COLORREF color = GetTextColor(mhDC); - dynamic_cast<gr::WinFont&>(segment.getFont()).replaceDC(mhDC); - SetTextColor(mhDC, color); -} - -void GraphiteWinLayout::RestoreDC(gr::Segment & segment) const -{ - dynamic_cast<gr::WinFont&>(segment.getFont()).restoreDC(); -} - bool GraphiteWinLayout::LayoutText( ImplLayoutArgs & args) { if (args.mnMinCharPos >= args.mnEndCharPos) @@ -2877,7 +2881,7 @@ bool GraphiteWinLayout::LayoutText( ImplLayoutArgs & args) maImpl.clear(); return true; } - HFONT hUnRotatedFont; + HFONT hUnRotatedFont = 0; if (args.mnOrientation) { // Graphite gets very confused if the font is rotated @@ -2889,36 +2893,16 @@ bool GraphiteWinLayout::LayoutText( ImplLayoutArgs & args) ::SelectFont(mhDC, hUnRotatedFont); } WinLayout::AdjustLayout(args); - mpFont.replaceDC(mhDC); maImpl.SetFontScale(WinLayout::mfFontScale); - //bool succeeded = maImpl.LayoutText(args); -#ifdef GRCACHE - GrSegRecord * pSegRecord = NULL; - gr::Segment * pSegment = maImpl.CreateSegment(args, &pSegRecord); -#else - gr::Segment * pSegment = maImpl.CreateSegment(args); -#endif + gr_segment * pSegment = maImpl.CreateSegment(args); bool bSucceeded = false; if (pSegment) { // replace the DC on the font within the segment - ReplaceDC(*pSegment); // create glyph vectors -#ifdef GRCACHE - bSucceeded = maImpl.LayoutGlyphs(args, pSegment, pSegRecord); -#else bSucceeded = maImpl.LayoutGlyphs(args, pSegment); -#endif - // restore original DC - RestoreDC(*pSegment); -#ifdef GRCACHE - if (pSegRecord) pSegRecord->unlock(); - else delete pSegment; -#else - delete pSegment; -#endif + gr_seg_destroy(pSegment); } - mpFont.restoreDC(); if (args.mnOrientation) { // restore the rotated font @@ -2967,9 +2951,7 @@ void GraphiteWinLayout::DrawText(SalGraphics &sal_graphics) const int GraphiteWinLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const { - mpFont.replaceDC(mhDC); int nBreak = maImpl.GetTextBreak(nMaxWidth, nCharExtra, nFactor); - mpFont.restoreDC(); return nBreak; } @@ -3023,7 +3005,9 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe { #ifdef ENABLE_GRAPHITE if (rFontFace.SupportsGraphite()) + { pWinLayout = new GraphiteWinLayout(mhDC, rFontFace, rFontInstance); + } else #endif // ENABLE_GRAPHITE // script complexity is determined in upper layers @@ -3056,20 +3040,20 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe pWinLayout = new SimpleWinLayout( mhDC, eCharSet, rFontFace, rFontInstance ); } - if( mfFontScale != 1.0 ) - pWinLayout->SetFontScale( mfFontScale ); + if( mfFontScale[nFallbackLevel] != 1.0 ) + pWinLayout->SetFontScale( mfFontScale[nFallbackLevel] ); return pWinLayout; } // ----------------------------------------------------------------------- -int WinSalGraphics::GetMinKashidaWidth() +int WinSalGraphics::GetMinKashidaWidth() { if( !mpWinFontEntry[0] ) return 0; mpWinFontEntry[0]->InitKashidaHandling( mhDC ); - int nMinKashida = static_cast<int>(mfFontScale * mpWinFontEntry[0]->GetMinKashidaWidth()); + int nMinKashida = static_cast<int>(mfFontScale[0] * mpWinFontEntry[0]->GetMinKashidaWidth()); return nMinKashida; } @@ -3080,8 +3064,8 @@ ImplWinFontEntry::ImplWinFontEntry( ImplFontSelectData& rFSD ) , maWidthMap( 512 ) , mpKerningPairs( NULL ) , mnKerningPairs( -1 ) -, mnMinKashidaWidth( -1 ) -, mnMinKashidaGlyph( -1 ) +, mnMinKashidaWidth( -1 ) +, mnMinKashidaGlyph( -1 ) { #ifdef USE_UNISCRIBE maScriptCache = NULL; @@ -3171,6 +3155,10 @@ ImplFontData* ImplWinFontData::Clone() const { if( mpUnicodeMap ) mpUnicodeMap->AddReference(); +#ifdef ENABLE_GRAPHITE + if ( mpGraphiteData ) + mpGraphiteData->AddReference(); +#endif ImplFontData* pClone = new ImplWinFontData( *this ); return pClone; } @@ -3184,3 +3172,5 @@ ImplFontEntry* ImplWinFontData::CreateFontInstance( ImplFontSelectData& rFSD ) c } // ======================================================================= + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/wntgdi.cxx b/vcl/win/source/gdi/wntgdi.cxx index eb53fb4d8699..5adc7fe18cf5 100755..100644 --- a/vcl/win/source/gdi/wntgdi.cxx +++ b/vcl/win/source/gdi/wntgdi.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,3 +66,5 @@ BOOL WINAPI WIN_PolyPolygon( HDC hDC, CONST POINT * ppt, LPINT npcnt, int ncnt ) return PolyPolygon( hDC, ppt, npcnt, ncnt ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/src/ase.cur b/vcl/win/source/src/ase.cur Binary files differindex 7634a7d34a7b..7634a7d34a7b 100755..100644 --- a/vcl/win/source/src/ase.cur +++ b/vcl/win/source/src/ase.cur diff --git a/vcl/win/source/src/asn.cur b/vcl/win/source/src/asn.cur Binary files differindex e444e42bf37e..e444e42bf37e 100755..100644 --- a/vcl/win/source/src/asn.cur +++ b/vcl/win/source/src/asn.cur diff --git a/vcl/win/source/src/asne.cur b/vcl/win/source/src/asne.cur Binary files differindex e92cc65e7eb1..e92cc65e7eb1 100755..100644 --- a/vcl/win/source/src/asne.cur +++ b/vcl/win/source/src/asne.cur diff --git a/vcl/win/source/src/asns.cur b/vcl/win/source/src/asns.cur Binary files differindex 04d0b09c353e..04d0b09c353e 100755..100644 --- a/vcl/win/source/src/asns.cur +++ b/vcl/win/source/src/asns.cur diff --git a/vcl/win/source/src/asnswe.cur b/vcl/win/source/src/asnswe.cur Binary files differindex a0e25b16de1f..a0e25b16de1f 100755..100644 --- a/vcl/win/source/src/asnswe.cur +++ b/vcl/win/source/src/asnswe.cur diff --git a/vcl/win/source/src/asnw.cur b/vcl/win/source/src/asnw.cur Binary files differindex 20322bc97b16..20322bc97b16 100755..100644 --- a/vcl/win/source/src/asnw.cur +++ b/vcl/win/source/src/asnw.cur diff --git a/vcl/win/source/src/ass.cur b/vcl/win/source/src/ass.cur Binary files differindex 7166636a1a77..7166636a1a77 100755..100644 --- a/vcl/win/source/src/ass.cur +++ b/vcl/win/source/src/ass.cur diff --git a/vcl/win/source/src/asse.cur b/vcl/win/source/src/asse.cur Binary files differindex 8cb71234b0a9..8cb71234b0a9 100755..100644 --- a/vcl/win/source/src/asse.cur +++ b/vcl/win/source/src/asse.cur diff --git a/vcl/win/source/src/assw.cur b/vcl/win/source/src/assw.cur Binary files differindex fddaf3f57cbf..fddaf3f57cbf 100755..100644 --- a/vcl/win/source/src/assw.cur +++ b/vcl/win/source/src/assw.cur diff --git a/vcl/win/source/src/asw.cur b/vcl/win/source/src/asw.cur Binary files differindex 0ccac50f4596..0ccac50f4596 100755..100644 --- a/vcl/win/source/src/asw.cur +++ b/vcl/win/source/src/asw.cur diff --git a/vcl/win/source/src/aswe.cur b/vcl/win/source/src/aswe.cur Binary files differindex c238b7e10aef..c238b7e10aef 100755..100644 --- a/vcl/win/source/src/aswe.cur +++ b/vcl/win/source/src/aswe.cur diff --git a/vcl/win/source/src/chain.cur b/vcl/win/source/src/chain.cur Binary files differindex 02abb7ab714f..02abb7ab714f 100755..100644 --- a/vcl/win/source/src/chain.cur +++ b/vcl/win/source/src/chain.cur diff --git a/vcl/win/source/src/chainnot.cur b/vcl/win/source/src/chainnot.cur Binary files differindex 938ece03f329..938ece03f329 100755..100644 --- a/vcl/win/source/src/chainnot.cur +++ b/vcl/win/source/src/chainnot.cur diff --git a/vcl/win/source/src/timemove.cur b/vcl/win/source/src/timemove.cur Binary files differindex 319b6edc5774..319b6edc5774 100755..100644 --- a/vcl/win/source/src/timemove.cur +++ b/vcl/win/source/src/timemove.cur diff --git a/vcl/win/source/src/timesize.cur b/vcl/win/source/src/timesize.cur Binary files differindex 1ec23de05b71..1ec23de05b71 100755..100644 --- a/vcl/win/source/src/timesize.cur +++ b/vcl/win/source/src/timesize.cur diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index bcbaee6d8b6c..9ed173ee6170 100755..100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,7 +47,7 @@ #include <stdio.h> -#include <tools/svwin.h> +#include <svsys.h> #ifdef __MINGW32__ #include <excpt.h> #endif @@ -65,7 +66,6 @@ #include <vcl/window.hxx> #include <vcl/wrkwin.hxx> #include <vcl/svapp.hxx> -#include <vcl/impdel.hxx> // Warning in SDK header #if defined(_MSC_VER) && (_MSC_VER > 1400) @@ -506,34 +506,31 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, } // create frame - if( true/*aSalShlData.mbWNT*/ ) + LPCWSTR pClassName; + if ( bSubFrame ) { - LPCWSTR pClassName; - if ( bSubFrame ) - { - if ( nSalFrameStyle & (SAL_FRAME_STYLE_MOVEABLE|SAL_FRAME_STYLE_NOSHADOW) ) // check if shadow not wanted - pClassName = SAL_SUBFRAME_CLASSNAMEW; - else - pClassName = SAL_TMPSUBFRAME_CLASSNAMEW; // undecorated floaters will get shadow on XP - } + if ( nSalFrameStyle & (SAL_FRAME_STYLE_MOVEABLE|SAL_FRAME_STYLE_NOSHADOW) ) // check if shadow not wanted + pClassName = SAL_SUBFRAME_CLASSNAMEW; else - { - if ( nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE ) - pClassName = SAL_FRAME_CLASSNAMEW; - else - pClassName = SAL_TMPSUBFRAME_CLASSNAMEW; - } - hWnd = CreateWindowExW( nExSysStyle, pClassName, L"", nSysStyle, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, - hWndParent, 0, pInst->mhInst, (void*)pFrame ); - if( !hWnd ) - ImplWriteLastError( GetLastError(), "CreateWindowEx" ); + pClassName = SAL_TMPSUBFRAME_CLASSNAMEW; // undecorated floaters will get shadow on XP + } + else + { + if ( nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE ) + pClassName = SAL_FRAME_CLASSNAMEW; + else + pClassName = SAL_TMPSUBFRAME_CLASSNAMEW; + } + hWnd = CreateWindowExW( nExSysStyle, pClassName, L"", nSysStyle, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, + hWndParent, 0, pInst->mhInst, (void*)pFrame ); + if( !hWnd ) + ImplWriteLastError( GetLastError(), "CreateWindowEx" ); #if OSL_DEBUG_LEVEL > 1 - // set transparency value - if( bLayeredAPI == 1 && GetWindowExStyle( hWnd ) & WS_EX_LAYERED ) - lpfnSetLayeredWindowAttributes( hWnd, 0, 230, 0x00000002 /*LWA_ALPHA*/ ); + // set transparency value + if( bLayeredAPI == 1 && GetWindowExStyle( hWnd ) & WS_EX_LAYERED ) + lpfnSetLayeredWindowAttributes( hWnd, 0, 230, 0x00000002 /*LWA_ALPHA*/ ); #endif - } if ( !hWnd ) { delete pFrame; @@ -595,8 +592,8 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, sal_Bool bAsChild ) { HINSTANCE hInstance = GetSalData()->mhInst; - ULONG nSysStyle = GetWindowLong( oldhWnd, GWL_STYLE ); - ULONG nExSysStyle = GetWindowLong( oldhWnd, GWL_EXSTYLE ); + sal_uLong nSysStyle = GetWindowLong( oldhWnd, GWL_STYLE ); + sal_uLong nExSysStyle = GetWindowLong( oldhWnd, GWL_EXSTYLE ); if( bAsChild ) { @@ -605,10 +602,9 @@ HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, sal_Bool bAsChild ) } LPCWSTR pClassName = SAL_SUBFRAME_CLASSNAMEW; - HWND hWnd = CreateWindowExW( nExSysStyle, pClassName, L"", nSysStyle, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, - hWndParent, 0, hInstance, (void*)GetWindowPtr( oldhWnd ) ); - return hWnd; + return CreateWindowExW( nExSysStyle, pClassName, L"", nSysStyle, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, + hWndParent, 0, hInstance, (void*)GetWindowPtr( oldhWnd ) ); } // ======================================================================= @@ -1326,37 +1322,7 @@ static void ImplSalShow( HWND hWnd, sal_Bool bVisible, sal_Bool bNoActivate ) } else { - // See also Bug #91813# and #68467# - if ( pFrame->mbFullScreen && - pFrame->mbPresentation && - (aSalShlData.mnVersion < 500) && - !::GetParent( hWnd ) ) - { - // Damit im Impress-Player in der Taskleiste nicht durch - // einen Windows-Fehler hin- und wieder mal ein leerer - // Button stehen bleibt, muessen wir hier die Taskleiste - // etwas austricksen. Denn wenn wir im FullScreenMode sind - // und das Fenster hiden kommt Windows anscheinend etwas aus - // dem tritt und somit minimieren wir das Fenster damit es - // nicht flackert - ANIMATIONINFO aInfo; - aInfo.cbSize = sizeof( aInfo ); - SystemParametersInfo( SPI_GETANIMATION, 0, &aInfo, 0 ); - if ( aInfo.iMinAnimate ) - { - int nOldAni = aInfo.iMinAnimate; - aInfo.iMinAnimate = 0; - SystemParametersInfo( SPI_SETANIMATION, 0, &aInfo, 0 ); - ShowWindow( pFrame->mhWnd, SW_SHOWMINNOACTIVE ); - aInfo.iMinAnimate = nOldAni; - SystemParametersInfo( SPI_SETANIMATION, 0, &aInfo, 0 ); - } - else - ShowWindow( hWnd, SW_SHOWMINNOACTIVE ); - ShowWindow( hWnd, SW_HIDE ); - } - else - ShowWindow( hWnd, SW_HIDE ); + ShowWindow( hWnd, SW_HIDE ); } } @@ -2020,6 +1986,10 @@ void WinSalFrame::SetScreenNumber( unsigned int nNewScreen ) } } +void WinSalFrame::SetApplicationID( const rtl::OUString &/*rApplicationID*/ ) +{ +} + // ----------------------------------------------------------------------- void WinSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay ) @@ -2324,17 +2294,15 @@ void WinSalFrame::SetPointer( PointerStyle ePointerStyle ) { 0, 0, SAL_RESID_POINTER_TEXT_VERTICAL }, // POINTER_TEXT_VERTICAL { 0, 0, SAL_RESID_POINTER_PIVOT_DELETE }, // POINTER_PIVOT_DELETE - // --> FME 2004-07-30 #i32329# Enhanced table selection + // #i32329# { 0, 0, SAL_RESID_POINTER_TAB_SELECT_S }, // POINTER_TAB_SELECT_S { 0, 0, SAL_RESID_POINTER_TAB_SELECT_E }, // POINTER_TAB_SELECT_E { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SE }, // POINTER_TAB_SELECT_SE { 0, 0, SAL_RESID_POINTER_TAB_SELECT_W }, // POINTER_TAB_SELECT_W { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SW }, // POINTER_TAB_SELECT_SW - // <-- - // --> FME 2004-08-16 #i20119# Paintbrush tool + // #i20119# { 0, 0, SAL_RESID_POINTER_PAINTBRUSH } // POINTER_PAINTBRUSH - // <-- }; @@ -2507,26 +2475,23 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf, int nKeyLen = 0; if ( lParam ) { - if ( true/*aSalShlData.mbWNT*/ ) + nKeyLen = GetKeyNameTextW( lParam, aKeyBuf, nMaxKeyLen ); + // #i12401# the current unicows.dll has a bug in CharUpperBuffW, which corrupts the stack + // fall back to the ANSI version instead + DBG_ASSERT( nKeyLen <= nMaxKeyLen, "Invalid key name length!" ); + if( nKeyLen > nMaxKeyLen ) + nKeyLen = 0; + else if( nKeyLen > 0 ) { - nKeyLen = GetKeyNameTextW( lParam, aKeyBuf, nMaxKeyLen ); - // #i12401# the current unicows.dll has a bug in CharUpperBuffW, which corrupts the stack - // fall back to the ANSI version instead - DBG_ASSERT( nKeyLen <= nMaxKeyLen, "Invalid key name length!" ); - if( nKeyLen > nMaxKeyLen ) - nKeyLen = 0; - else if( nKeyLen > 0 ) - { - // Capitalize just the first letter of key names - CharLowerBuffW( aKeyBuf, nKeyLen ); + // Capitalize just the first letter of key names + CharLowerBuffW( aKeyBuf, nKeyLen ); - bool bUpper = true; - for( WCHAR *pW=aKeyBuf, *pE=pW+nKeyLen; pW < pE; ++pW ) - { - if( bUpper ) - CharUpperBuffW( pW, 1 ); - bUpper = (*pW=='+') || (*pW=='-') || (*pW==' ') || (*pW=='.'); - } + bool bUpper = true; + for( WCHAR *pW=aKeyBuf, *pE=pW+nKeyLen; pW < pE; ++pW ) + { + if( bUpper ) + CharUpperBuffW( pW, 1 ); + bUpper = (*pW=='+') || (*pW=='-') || (*pW==' ') || (*pW=='.'); } } } @@ -2726,6 +2691,15 @@ XubString WinSalFrame::GetKeyName( sal_uInt16 nKeyCode ) case KEY_EQUAL: cSVCode = '='; break; + case KEY_SEMICOLON: + cSVCode = ';'; + break; + case KEY_BRACKETLEFT: + cSVCode = '['; + break; + case KEY_BRACKETRIGHT: + cSVCode = ']'; + break; } } @@ -2897,11 +2871,8 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetTitleHeight( GetSystemMetrics( SM_CYCAPTION ) ); aStyleSettings.SetActiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVEBORDER ) ) ); aStyleSettings.SetDeactiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVEBORDER ) ) ); - if ( aSalShlData.mnVersion >= 410 ) - { - aStyleSettings.SetActiveColor2( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTACTIVECAPTION ) ) ); - aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTINACTIVECAPTION ) ) ); - } + aStyleSettings.SetActiveColor2( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTACTIVECAPTION ) ) ); + aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTINACTIVECAPTION ) ) ); aStyleSettings.SetFaceColor( ImplWinColorToSal( GetSysColor( COLOR_3DFACE ) ) ); aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() ); aStyleSettings.SetLightColor( ImplWinColorToSal( GetSysColor( COLOR_3DHILIGHT ) ) ); @@ -2975,19 +2946,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) pSVData->maNWFData.maMenuBarHighlightTextColor = aStyleSettings.GetMenuTextColor(); GetSalData()->mbThemeMenuSupport = TRUE; } - // Bei hellgrau geben wir die Farbe vor, damit es besser aussieht - if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY ) - aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - // Checked-Color berechnen - Color aColor1 = aStyleSettings.GetFaceColor(); - Color aColor2 = aStyleSettings.GetLightColor(); - BYTE nRed = (BYTE)(((sal_uInt16)aColor1.GetRed() + (sal_uInt16)aColor2.GetRed())/2); - BYTE nGreen = (BYTE)(((sal_uInt16)aColor1.GetGreen() + (sal_uInt16)aColor2.GetGreen())/2); - BYTE nBlue = (BYTE)(((sal_uInt16)aColor1.GetBlue() + (sal_uInt16)aColor2.GetBlue())/2); - aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); - } + aStyleSettings.SetCheckedColorSpecialCase( ); // caret width DWORD nCaretWidth = 2; @@ -2997,11 +2956,14 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) // High contrast HIGHCONTRAST hc; hc.cbSize = sizeof( HIGHCONTRAST ); - if( SystemParametersInfo( SPI_GETHIGHCONTRAST, hc.cbSize, &hc, 0) && (hc.dwFlags & HCF_HIGHCONTRASTON) ) + if( SystemParametersInfo( SPI_GETHIGHCONTRAST, hc.cbSize, &hc, 0) + && (hc.dwFlags & HCF_HIGHCONTRASTON) + ) { aStyleSettings.SetHighContrastMode( 1 ); - else + aStyleSettings.SetSymbolsStyle( STYLE_SYMBOLS_HICONTRAST ); + } else { aStyleSettings.SetHighContrastMode( 0 ); - + } // Query Fonts Font aMenuFont = aStyleSettings.GetMenuFont(); @@ -3011,22 +2973,19 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) Font aAppFont = aStyleSettings.GetAppFont(); Font aIconFont = aStyleSettings.GetIconFont(); HDC hDC = GetDC( 0 ); - if( true/*aSalShlData.mbWNT*/ ) + NONCLIENTMETRICSW aNonClientMetrics; + aNonClientMetrics.cbSize = sizeof( aNonClientMetrics ); + if ( SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) ) { - NONCLIENTMETRICSW aNonClientMetrics; - aNonClientMetrics.cbSize = sizeof( aNonClientMetrics ); - if ( SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) ) - { - ImplSalUpdateStyleFontW( hDC, aNonClientMetrics.lfMenuFont, aMenuFont ); - ImplSalUpdateStyleFontW( hDC, aNonClientMetrics.lfCaptionFont, aTitleFont ); - ImplSalUpdateStyleFontW( hDC, aNonClientMetrics.lfSmCaptionFont, aFloatTitleFont ); - ImplSalUpdateStyleFontW( hDC, aNonClientMetrics.lfStatusFont, aHelpFont ); - ImplSalUpdateStyleFontW( hDC, aNonClientMetrics.lfMessageFont, aAppFont ); - - LOGFONTW aLogFont; - if ( SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &aLogFont, 0 ) ) - ImplSalUpdateStyleFontW( hDC, aLogFont, aIconFont ); - } + ImplSalUpdateStyleFontW( hDC, aNonClientMetrics.lfMenuFont, aMenuFont ); + ImplSalUpdateStyleFontW( hDC, aNonClientMetrics.lfCaptionFont, aTitleFont ); + ImplSalUpdateStyleFontW( hDC, aNonClientMetrics.lfSmCaptionFont, aFloatTitleFont ); + ImplSalUpdateStyleFontW( hDC, aNonClientMetrics.lfStatusFont, aHelpFont ); + ImplSalUpdateStyleFontW( hDC, aNonClientMetrics.lfMessageFont, aAppFont ); + + LOGFONTW aLogFont; + if ( SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &aLogFont, 0 ) ) + ImplSalUpdateStyleFontW( hDC, aLogFont, aIconFont ); } // get screen font resolution to calculate toolbox item size @@ -3194,6 +3153,41 @@ SalFrame::SalPointerState WinSalFrame::GetPointerState() // ----------------------------------------------------------------------- +SalFrame::SalIndicatorState WinSalFrame::GetIndicatorState() +{ + SalIndicatorState aState; + aState.mnState = 0; + if (::GetKeyState(VK_CAPITAL)) + aState.mnState |= INDICATOR_CAPSLOCK; + + if (::GetKeyState(VK_NUMLOCK)) + aState.mnState |= INDICATOR_NUMLOCK; + + if (::GetKeyState(VK_SCROLL)) + aState.mnState |= INDICATOR_SCROLLLOCK; + + return aState; +} + +void WinSalFrame::SimulateKeyPress( sal_uInt16 nKeyCode ) +{ + BYTE nVKey = 0; + switch (nKeyCode) + { + case KEY_CAPSLOCK: + nVKey = VK_CAPITAL; + break; + } + + if (nVKey > 0 && nVKey < 255) + { + ::keybd_event(nVKey, 0x45, KEYEVENTF_EXTENDEDKEY, 0); + ::keybd_event(nVKey, 0x45, KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP, 0); + } +} + +// ----------------------------------------------------------------------- + void WinSalFrame::SetBackgroundBitmap( SalBitmap* ) { } @@ -3540,6 +3534,10 @@ static long ImplHandleWheelMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar { aWheelEvt.mnScrollLines = aSalShlData.mnWheelScrollChars; aWheelEvt.mbHorz = TRUE; + + // fdo#36380 - seems horiz scrolling has swapped direction + aWheelEvt.mnDelta *= -1; + aWheelEvt.mnNotchDelta *= -1; } if ( nWinModCode & MK_SHIFT ) @@ -3613,9 +3611,9 @@ static void ImplUpdateInputLang( WinSalFrame* pFrame ) bLanguageChange = TRUE; } - // If we are on Windows NT we use Unicode FrameProcs and so we - // get Unicode charcodes directly from Windows - // no need to set up a code page + // We are on Windows NT so we use Unicode FrameProcs and get + // Unicode charcodes directly from Windows no need to set up a + // code page return; } @@ -3624,7 +3622,7 @@ static sal_Unicode ImplGetCharCode( WinSalFrame* pFrame, WPARAM nCharCode ) { ImplUpdateInputLang( pFrame ); - // If we are on Windows NT we use Unicode FrameProcs and so we + // We are on Windows NT so we use Unicode FrameProcs and we // get Unicode charcodes directly from Windows return (sal_Unicode)nCharCode; } @@ -4432,8 +4430,8 @@ static void ImplHandleSettingsChangeMsg( HWND hWnd, UINT nMsg, { if ( lParam ) { - if ( ImplSalWICompareAscii( (const wchar_t*)lParam, "devices" ) == 0 ) - nSalEvent = SALEVENT_PRINTERCHANGED; + if ( ImplSalWICompareAscii( (const wchar_t*)lParam, "devices" ) == 0 ) + nSalEvent = SALEVENT_PRINTERCHANGED; } } @@ -4747,14 +4745,12 @@ static int ImplHandleMinMax( HWND hWnd, LPARAM lParam ) // if bByPosition is FALSE then nPos denotes a menu id instead of a position static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, sal_Bool bByPosition=TRUE ) { - DWORD err=0; - MENUITEMINFOW mi; memset(&mi, 0, sizeof(mi)); mi.cbSize = sizeof( mi ); mi.fMask = MIIM_DATA; if( !GetMenuItemInfoW( hMenu, nPos, bByPosition, &mi) ) - err = GetLastError(); + ImplWriteLastError( GetLastError(), "ImplGetSalMenuItem" ); return (WinSalMenuItem *) mi.dwItemData; } @@ -4762,8 +4758,6 @@ static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, sal_Bool bByP // returns the index of the currently selected item if any or -1 static int ImplGetSelectedIndex( HMENU hMenu ) { - DWORD err=0; - MENUITEMINFOW mi; memset(&mi, 0, sizeof(mi)); mi.cbSize = sizeof( mi ); @@ -4774,7 +4768,7 @@ static int ImplGetSelectedIndex( HMENU hMenu ) for(int i=0; i<n; i++ ) { if( !GetMenuItemInfoW( hMenu, i, TRUE, &mi) ) - err = GetLastError(); + ImplWriteLastError( GetLastError(), "ImplGetSelectedIndex" ); else { if( mi.fState & MFS_HILITE ) @@ -4818,7 +4812,7 @@ static int ImplMenuChar( HWND, WPARAM wParam, LPARAM lParam ) if( nFound == 1 ) nRet = MAKELRESULT( idxFound, MNC_EXECUTE ); else - // duplicate mnemonics, just select the next occurence + // duplicate mnemonics, just select the next occurrence nRet = MAKELRESULT( idxFound, MNC_SELECT ); return nRet; @@ -4884,7 +4878,6 @@ static int ImplMeasureItem( HWND hWnd, WPARAM wParam, LPARAM lParam ) static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) { int nRet = 0; - DWORD err = 0; if( !wParam ) { // request was sent by a menu @@ -4924,7 +4917,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) // Fill background if(!PatBlt( pDI->hDC, aRect.left, aRect.top, aRect.right-aRect.left, aRect.bottom-aRect.top, PATCOPY )) - err = GetLastError(); + ImplWriteLastError(GetLastError(), "ImplDrawItem"); int lineHeight = aRect.bottom-aRect.top; @@ -5008,7 +5001,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) (LPARAM)(LPWSTR) aStr.GetBuffer(), (WPARAM)0, aRect.left, aRect.top + (lineHeight - strSize.cy)/2, 0, 0, DST_PREFIXTEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ) ) - err = GetLastError(); + ImplWriteLastError(GetLastError(), "ImplDrawItem"); if( pSalMenuItem->mAccelText.Len() ) { @@ -5025,7 +5018,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) (LPARAM)(LPWSTR) aStr.GetBuffer(), (WPARAM)0, aRect.right-strSizeA.cx-tm.tmMaxCharWidth, aRect.top + (lineHeight - strSizeA.cy)/2, 0, 0, DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ) ) - err = GetLastError(); + ImplWriteLastError(GetLastError(), "ImplDrawItem"); } // Restore the original font and colors. @@ -5088,7 +5081,7 @@ static int ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam ) long nRet = 0; if ( hMenu && !pFrame->mLastActivatedhMenu ) { - // we never activated a menu (ie, no WM_INITMENUPOPUP has occured yet) + // we never activated a menu (ie, no WM_INITMENUPOPUP has occurred yet) // which means this must be the menubar -> send activation/deactivation SalMenuEvent aMenuEvt; WinSalMenuItem *pSalMenuItem = ImplGetSalMenuItem( hMenu, nId, bByPosition ); @@ -6175,12 +6168,12 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP break; #if WINVER >= 0x0500 case WM_IME_REQUEST: - if ( PtrToInt( wParam ) == IMR_RECONVERTSTRING ) + if ( (sal_uIntPtr)( wParam ) == IMR_RECONVERTSTRING ) { nRet = ImplHandleIMEReconvertString( hWnd, lParam ); rDef = FALSE; } - else if( PtrToInt( wParam ) == IMR_CONFIRMRECONVERTSTRING ) + else if( (sal_uIntPtr)( wParam ) == IMR_CONFIRMRECONVERTSTRING ) { nRet = ImplHandleIMEConfirmReconvertString( hWnd, lParam ); rDef = FALSE; @@ -6386,3 +6379,4 @@ sal_Bool ImplWriteLastError( DWORD lastError, const char *szApiCall ) // ----------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/window/salmenu.cxx b/vcl/win/source/window/salmenu.cxx index ce7c6064f790..aa81ee4f44f9 100755..100644 --- a/vcl/win/source/window/salmenu.cxx +++ b/vcl/win/source/window/salmenu.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <tools/svwin.h> +#include <svsys.h> #include <vcl/menu.hxx> #include <vcl/sysdata.hxx> @@ -412,3 +413,4 @@ WinSalMenuItem::~WinSalMenuItem() // ------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/window/salobj.cxx b/vcl/win/source/window/salobj.cxx index 51712f07e709..f79ad89fff45 100755 --- a/vcl/win/source/window/salobj.cxx +++ b/vcl/win/source/window/salobj.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,8 +31,8 @@ #include <string.h> +#include <svsys.h> #include <tools/debug.hxx> -#include <tools/svwin.h> #include <vcl/svapp.hxx> @@ -535,65 +536,34 @@ SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent ) if ( !pSalData->mpFirstObject ) { pSalData->mhSalObjMsgHook = SetWindowsHookExW( WH_CALLWNDPROC, - SalSysMsgProc, - pSalData->mhInst, - pSalData->mnAppThreadId ); + SalSysMsgProc, + pSalData->mhInst, + pSalData->mnAppThreadId ); } if ( !pSalData->mbObjClassInit ) { - // #95301# shockwave plugin has bug; expects ASCII functions to be used - if ( false )//aSalShlData.mbWNT ) + WNDCLASSEXA aWndClassEx; + aWndClassEx.cbSize = sizeof( aWndClassEx ); + aWndClassEx.style = 0; + aWndClassEx.lpfnWndProc = SalSysObjWndProcA; + aWndClassEx.cbClsExtra = 0; + aWndClassEx.cbWndExtra = SAL_OBJECT_WNDEXTRA; + aWndClassEx.hInstance = pSalData->mhInst; + aWndClassEx.hIcon = 0; + aWndClassEx.hIconSm = 0; + aWndClassEx.hCursor = LoadCursor( 0, IDC_ARROW ); + aWndClassEx.hbrBackground = 0; + aWndClassEx.lpszMenuName = 0; + aWndClassEx.lpszClassName = SAL_OBJECT_CLASSNAMEA; + if ( RegisterClassExA( &aWndClassEx ) ) { - WNDCLASSEXW aWndClassEx; - aWndClassEx.cbSize = sizeof( aWndClassEx ); - aWndClassEx.style = 0; - aWndClassEx.lpfnWndProc = SalSysObjWndProcW; - aWndClassEx.cbClsExtra = 0; - aWndClassEx.cbWndExtra = SAL_OBJECT_WNDEXTRA; - aWndClassEx.hInstance = pSalData->mhInst; - aWndClassEx.hIcon = 0; - aWndClassEx.hIconSm = 0; - aWndClassEx.hCursor = LoadCursor( 0, IDC_ARROW ); - aWndClassEx.hbrBackground = 0; - aWndClassEx.lpszMenuName = 0; - aWndClassEx.lpszClassName = SAL_OBJECT_CLASSNAMEW; - if ( RegisterClassExW( &aWndClassEx ) ) - { - // Wegen PlugIn's loeschen wir erstmal den Hintergrund - aWndClassEx.cbWndExtra = 0; - aWndClassEx.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - aWndClassEx.lpfnWndProc = SalSysObjChildWndProcW; - aWndClassEx.lpszClassName = SAL_OBJECT_CHILDCLASSNAMEW; - if ( RegisterClassExW( &aWndClassEx ) ) - pSalData->mbObjClassInit = TRUE; - } - } - else - { - WNDCLASSEXA aWndClassEx; - aWndClassEx.cbSize = sizeof( aWndClassEx ); - aWndClassEx.style = 0; - aWndClassEx.lpfnWndProc = SalSysObjWndProcA; - aWndClassEx.cbClsExtra = 0; - aWndClassEx.cbWndExtra = SAL_OBJECT_WNDEXTRA; - aWndClassEx.hInstance = pSalData->mhInst; - aWndClassEx.hIcon = 0; - aWndClassEx.hIconSm = 0; - aWndClassEx.hCursor = LoadCursor( 0, IDC_ARROW ); - aWndClassEx.hbrBackground = 0; - aWndClassEx.lpszMenuName = 0; - aWndClassEx.lpszClassName = SAL_OBJECT_CLASSNAMEA; - if ( RegisterClassExA( &aWndClassEx ) ) - { - // Wegen PlugIn's loeschen wir erstmal den Hintergrund - aWndClassEx.cbWndExtra = 0; - aWndClassEx.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - aWndClassEx.lpfnWndProc = SalSysObjChildWndProcA; - aWndClassEx.lpszClassName = SAL_OBJECT_CHILDCLASSNAMEA; - if ( RegisterClassExA( &aWndClassEx ) ) - pSalData->mbObjClassInit = TRUE; - } + // Clean background first because of plugins. + aWndClassEx.cbWndExtra = 0; + aWndClassEx.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + aWndClassEx.lpfnWndProc = SalSysObjChildWndProcA; + aWndClassEx.lpszClassName = SAL_OBJECT_CHILDCLASSNAMEA; + pSalData->mbObjClassInit = TRUE; } } @@ -876,3 +846,4 @@ void WinSalObject::InterceptChildWindowKeyDown( sal_Bool bIntercept ) mbInterceptChildWindowKeyDown = bIntercept; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/workben/makefile.mk b/vcl/workben/makefile.mk index abd0c23a3607..d52737507a20 100644 --- a/vcl/workben/makefile.mk +++ b/vcl/workben/makefile.mk @@ -62,7 +62,6 @@ APP1STDLIBS= $(CPPULIB) \ $(COMPHELPERLIB) \ $(TOOLSLIB) \ $(SALLIB) \ - $(VOSLIB) \ $(SOTLIB) \ $(VCLLIB) @@ -94,7 +93,6 @@ APP3STDLIBS= $(CPPULIB) \ $(COMPHELPERLIB) \ $(TOOLSLIB) \ $(SALLIB) \ - $(VOSLIB) \ $(SOTLIB) \ $(VCLLIB) @@ -112,7 +110,6 @@ APP4STDLIBS= $(CPPULIB) \ $(VCLLIB) \ $(TOOLSLIB) \ $(SALLIB) \ - $(VOSLIB) \ $(SOTLIB) \ $(VCLLIB) @@ -127,7 +124,6 @@ APP5STDLIBS= $(CPPULIB) \ $(VCLLIB) \ $(TOOLSLIB) \ $(SALLIB) \ - $(VOSLIB) \ $(SOTLIB) \ $(VCLLIB) diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx index 53dd111c7694..e86db3ed7821 100755..100644 --- a/vcl/workben/outdevgrind.cxx +++ b/vcl/workben/outdevgrind.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,7 +74,7 @@ namespace class GrindApp : public Application { public: - virtual void Main(); + virtual int Main(); virtual sal_uInt16 Exception( sal_uInt16 nError ); }; @@ -82,7 +83,7 @@ class TestWindow : public Dialog public: TestWindow() : Dialog( (Window *) NULL ) { - SetText( rtl::OUString::createFromAscii( "OutDev grinding" ) ); + SetText( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutDev grinding")) ); SetSizePixel( Size( 1024, 1024 ) ); EnablePaint( true ); Show(); @@ -914,7 +915,7 @@ sal_uInt16 GrindApp::Exception( sal_uInt16 nError ) return 0; } -void GrindApp::Main() +int GrindApp::Main() { bool bHelp = false; @@ -922,15 +923,15 @@ void GrindApp::Main() { ::rtl::OUString aParam = GetCommandLineParam( i ); - if( aParam.equalsAscii( "--help" ) || - aParam.equalsAscii( "-h" ) ) + if( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--help" ) ) || + aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-h" ) ) ) bHelp = true; } if( bHelp ) { printf( "outdevgrind - Profile OutputDevice\n" ); - return; + return EXIT_SUCCESS; } //------------------------------------------------- @@ -958,8 +959,8 @@ void GrindApp::Main() // Create UCB. uno::Sequence< uno::Any > aArgs( 2 ); - aArgs[ 0 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL ); - aArgs[ 1 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE ); + aArgs[ 0 ] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( UCB_CONFIGURATION_KEY1_LOCAL )); + aArgs[ 1 ] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( UCB_CONFIGURATION_KEY2_OFFICE )); ::ucbhelper::ContentBroker::initialize( xFactory, aArgs ); TestWindow pWindow; @@ -967,8 +968,11 @@ void GrindApp::Main() // clean up UCB ::ucbhelper::ContentBroker::deinitialize(); + return EXIT_SUCCESS; } } // namespace GrindApp aGrindApp; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx index 297660d4b8df..4898aed1a995 100644 --- a/vcl/workben/svdem.cxx +++ b/vcl/workben/svdem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -146,3 +147,5 @@ void MyWin::Resize() { WorkWindow::Resize(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index f35946fb1129..47af3aaa8e30 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,11 +59,17 @@ #include <netinet/in.h> -using namespace rtl; using namespace cppu; using namespace comphelper; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; + +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OUStringToOString; +using ::rtl::OStringToOUString; +using ::rtl::OUStringBuffer; +using ::rtl::OStringBuffer; // ----------------------------------------------------------------------- // Forward declaration @@ -99,8 +106,8 @@ SAL_IMPLEMENT_MAIN() * Create UCB. */ Sequence< Any > aArgs( 2 ); - aArgs[ 0 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL ); - aArgs[ 1 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE ); + aArgs[ 0 ] <<= OUString(RTL_CONSTASCII_USTRINGPARAM( UCB_CONFIGURATION_KEY1_LOCAL )); + aArgs[ 1 ] <<= OUString(RTL_CONSTASCII_USTRINGPARAM( UCB_CONFIGURATION_KEY2_OFFICE )); #if OSL_DEBUG_LEVEL > 1 sal_Bool bSuccess = #endif @@ -344,3 +351,5 @@ void MyWin::Resize() { WorkWindow::Resize(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index aec1eb4ae63a..545c2aedf6ee 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,9 +47,11 @@ #include <cppuhelper/servicefactory.hxx> #include <cppuhelper/bootstrap.hxx> -using namespace rtl; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; + +using ::rtl::OUString; +using ::rtl::OUStringBuffer; // ----------------------------------------------------------------------- // Forward declaration @@ -266,16 +269,10 @@ void MyWin::Paint( const Rectangle& rRect ) const int nFontSamples = (nFontCount<15) ? nFontCount : 15; for( int i = 0; i < nFontSamples; ++i ) { -#if 0 - Font aFont( GetFont() ); - aFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Courier" ) ) ); - aFont.SetWeight( WEIGHT_NORMAL ); - aFont.SetItalic( ITALIC_NONE ); -#else + FontInfo aFont = GetDevFont( (i*nFontCount) / nFontSamples ); aFont.SetHeight( 400 + (i%7) * 100 ); aFont.SetOrientation( i * (3600 / nFontSamples) ); -#endif SetFont( aFont ); sal_uInt8 nRed = (i << 6) & 0xC0; @@ -377,3 +374,5 @@ void MyWin::Resize() { WorkWindow::Resize(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index dafd546b3d68..547660fa1e1e 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -185,3 +186,5 @@ void MyWin::Resize() { WorkWindow::Resize(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |