diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
commit | a233dac0653f3f3054f7ad2da114ed989747e89a (patch) | |
tree | bf1e11438321c06125a94308649c496648061ccb /vcl | |
parent | acb6133d89abe071108577f821d7eaa381378879 (diff) | |
parent | e5647de7dd26775e45af24f11ac4f82a5518bd9e (diff) |
resyncing to master
Diffstat (limited to 'vcl')
267 files changed, 6094 insertions, 5365 deletions
diff --git a/vcl/Library_desktop_detector.mk b/vcl/Library_desktop_detector.mk index 8d4654c4e0b6..3673218468aa 100644 --- a/vcl/Library_desktop_detector.mk +++ b/vcl/Library_desktop_detector.mk @@ -36,7 +36,6 @@ $(eval $(call gb_Library_set_include,desktop_detector,\ -I$(realpath $(SRCDIR)/vcl/inc) \ -I$(realpath $(SRCDIR)/vcl/inc/pch) \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) @@ -44,6 +43,11 @@ $(eval $(call gb_Library_add_defs,desktop_detector,\ -DDESKTOP_DETECTOR_IMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,desktop_detector,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_linked_libs,desktop_detector,\ vcl \ tl \ diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index fb7ab96aada3..7ca41baa4b62 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -31,6 +31,10 @@ ifeq ($(OS),MACOSX) $(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.macosx)) else ifeq ($(OS),WNT) $(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.windows)) +else ifeq ($(GUIBASE),android) +$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.android,vcl/vcl)) +else ifeq ($(OS),IOS) +$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.ios,vcl/vcl)) else $(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.unx)) endif @@ -38,18 +42,23 @@ endif $(eval $(call gb_Library_add_package_headers,vcl,vcl_inc)) $(eval $(call gb_Library_add_package_headers,vcl,vcl_afmhash)) +ifeq ($(OS)$(COM),WNTGCC) +WINEINCLUDE=-I$(OUTDIR)/inc/external/wine +endif + $(eval $(call gb_Library_set_include,vcl,\ $$(INCLUDE) \ -I$(realpath $(SRCDIR)/vcl/inc) \ -I$(realpath $(SRCDIR)/vcl/inc/pch) \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ + $(WINEINCLUDE) \ -I$(WORKDIR)/CustomTarget/vcl/unx/generic/fontmanager \ )) ifeq ($(GUIBASE),unx) $(eval $(call gb_Library_set_include,vcl,\ $$(INCLUDE) \ + $$(FONTCONFIG_CFLAGS) \ $$(FREETYPE_CFLAGS) \ )) endif @@ -60,6 +69,11 @@ $(eval $(call gb_Library_add_defs,vcl,\ -DDLLPOSTFIX=$(subst $(or $(gb_Library_DLLEXT),$(gb_Library_PLAINEXT)),,$(gb_Library_OOOEXT)) \ )) +$(eval $(call gb_Library_add_api,vcl,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_linked_libs,vcl,\ tl \ utl \ @@ -82,21 +96,10 @@ $(call gb_Library_use_externals,vcl,\ icuuc \ ) -ifeq ($(GUIBASE),unx) -$(eval $(call gb_Library_add_linked_libs,vcl,\ - freetype \ -)) -endif - ifeq ($(GUIBASE),aqua) $(eval $(call gb_Library_add_cxxflags,vcl,\ $(gb_OBJCXXFLAGS) \ )) -ifeq ($(ENABLE_CAIRO),TRUE) -$(eval $(call gb_Library_add_defs,vcl,\ - -DCAIRO \ -)) -endif $(eval $(call gb_Library_add_objcxxobjects,vcl,\ vcl/aqua/source/a11y/aqua11yactionwrapper \ vcl/aqua/source/a11y/aqua11ycomponentwrapper \ @@ -172,18 +175,12 @@ $(eval $(call gb_Library_add_defs,vcl,\ -DSAL_DLLPOSTFIX=\"$(gb_Library_OOOEXT)\" \ -D_XSALSET_LIBNAME=\"$(call gb_Library_get_runtime_filename,spa)\" \ )) -## handle fontconfig -ifneq ($(ENABLE_FONTCONFIG),) -$(eval $(call gb_Library_add_defs,vcl,\ - -DENABLE_FONTCONFIG \ -)) ## handle CUPS ifneq ($(ENABLE_CUPS),) $(eval $(call gb_Library_add_defs,vcl,\ -DENABLE_CUPS \ )) endif -endif $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/glyphs/gcach_ftyp \ vcl/source/glyphs/gcach_layout \ @@ -202,6 +199,19 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ )) endif +ifeq ($(GUIBASE),android) +$(eval $(call gb_Library_set_defs,vcl,\ + $$(DEFS) \ + -DSAL_DLLPREFIX=\"$(gb_Library_SYSPRE)\" \ + -DSAL_DLLPOSTFIX=\"$(gb_Library_OOOEXT)\" \ + -D_XSALSET_LIBNAME=\"$(call gb_Library_get_runtime_filename,spa)\" \ +)) +$(eval $(call gb_Library_add_exception_objects,vcl,\ + vcl/unx/generic/plugadapt/salplug \ + vcl/null/printerinfomanager \ +)) +endif + ifeq ($(OS),WNT) $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/win/source/app/saldata \ @@ -225,7 +235,23 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ )) $(eval $(call gb_Library_add_nativeres,vcl,src)) +endif +ifeq ($(GUIBASE),cocoatouch) +$(eval $(call gb_Library_set_cxxflags,vcl,\ + $$(CXXFLAGS) \ + $$(OBJCXXFLAGS) \ +)) +$(eval $(call gb_Library_add_objcxxobjects,vcl,\ + vcl/ios/source/app/salnstimer \ + vcl/ios/source/app/vcluiapp \ +)) +$(eval $(call gb_Library_add_exception_objects,vcl,\ + vcl/ios/source/app/saldata \ + vcl/ios/source/app/salinst \ + vcl/ios/source/app/salsys \ + vcl/ios/source/app/saltimer \ +)) endif $(eval $(call gb_Library_add_cobjects,vcl,\ @@ -256,7 +282,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/components/dtranscomp \ vcl/source/components/factory \ vcl/source/components/fontident \ - vcl/source/components/rasterizer_rsvg \ vcl/source/components/stringmirror \ vcl/source/control/button \ vcl/source/control/combobox \ @@ -362,7 +387,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/helper/strhelper \ vcl/source/helper/threadex \ vcl/source/helper/xconnection \ - vcl/source/salmain/salmain \ vcl/source/window/abstdlg \ vcl/source/window/accel \ vcl/source/window/accmgr \ @@ -411,7 +435,11 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/window/wpropset \ vcl/source/window/wrkwin \ )) - +ifneq ($(OS),IOS) +$(eval $(call gb_Library_add_exception_objects,vcl,\ + vcl/source/salmain/salmain \ +)) +endif ## handle Graphite ifneq ($(ENABLE_GRAPHITE),) # add defines, graphite sources for all platforms @@ -438,6 +466,62 @@ endif $(call gb_Library_use_external,vcl,graphite) endif +## handle Cairo +ifneq ($(ENABLE_LIBRSVG),NO) + +$(eval $(call gb_Library_add_exception_objects,vcl,\ + vcl/source/components/rasterizer_rsvg \ +)) + +$(eval $(call gb_Library_set_defs,vcl,\ + $$(DEFS) \ + -DENABLE_LIBRSVG \ +)) +ifeq ($(SYSTEM_CAIRO),YES) +$(eval $(call gb_Library_set_cxxflags,vcl,\ + $$(CXXFLAGS) \ + $$(CAIRO_CFLAGS) \ + -DSYSTEM_CAIRO \ +)) + +# CAIRO_LIBS contains both -L and -l options. Thes sets LDFLAGS which +# goes early into the linking command line before the object files. So +# on platforms where libraries are searched for symbols undefined at +# that point as they occur on the command line, it is pointless to +# search the cairo library at that point as no references to cairo +# entries have been read from object files yet. +$(eval $(call gb_Library_set_ldflags,vcl,\ + $$(LDFLAGS) \ + $$(CAIRO_LIBS) \ +)) + +# Thus we also need to add cairo to the list of linked libs. These go +# after the object files on the linking command line. +$(eval $(call gb_Library_add_linked_libs,vcl,\ + cairo \ +)) + +else +$(eval $(call gb_Library_add_linked_libs,vcl,\ + cairo \ +)) +ifeq ($(OS),LINUX) +$(eval $(call gb_Library_add_linked_libs,vcl,\ + freetype \ + fontconfig \ +)) +endif +endif +endif + +ifeq ($(GUIBASE),unx) +$(eval $(call gb_Library_set_ldflags,vcl,\ + $$(LDFLAGS) \ + $$(FONTCONFIG_LIBS) \ + $$(FREETYPE_LIBS) \ +)) +endif + ifeq ($(OS),LINUX) $(eval $(call gb_Library_add_linked_libs,vcl,\ dl \ @@ -471,9 +555,16 @@ $(eval $(call gb_Library_add_libs,vcl,\ endif ifeq ($(OS),WNT) +ifeq ($(COM),MSC) $(eval $(call gb_Library_add_ldflags,vcl,\ /ENTRY:LibMain@12 \ )) +endif +ifeq ($(COM),GCC) +$(eval $(call gb_Library_set_ldflags,vcl,\ + $$(LDFLAGS) \ +)) +endif $(eval $(call gb_Library_add_linked_libs,vcl,\ advapi32 \ gdi32 \ @@ -483,7 +574,7 @@ $(eval $(call gb_Library_add_linked_libs,vcl,\ mpr \ msimg32 \ msvcrt \ - oldnames \ + $(gb_Library_win32_OLDNAMES) \ ole32 \ shell32 \ user32 \ @@ -492,4 +583,14 @@ $(eval $(call gb_Library_add_linked_libs,vcl,\ winspool \ )) endif + +ifeq ($(GUIBASE),cocoatouch) +$(eval $(call gb_Library_set_ldflags,vcl,\ + $$(LDFLAGS) \ + -framework UIKit \ + -framework CoreFoundation \ +)) +endif + + # vim: set noet sw=4 ts=4: diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk index 95428ae53853..819d9ce8c301 100644 --- a/vcl/Library_vclplug_gen.mk +++ b/vcl/Library_vclplug_gen.mk @@ -32,10 +32,14 @@ $(eval $(call gb_Library_set_include,vclplug_gen,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_Library_add_api,vclplug_gen,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_linked_libs,vclplug_gen,\ vcl \ tl \ @@ -63,6 +67,22 @@ $(call gb_Library_use_externals,vclplug_gen,\ icuuc \ ) +)) +$(eval $(call gb_Library_set_ldflags,vclplug_gen,\ + $$(LDFLAGS) \ + $$(CAIRO_LIBS) \ +)) +else +$(eval $(call gb_Library_set_cxxflags,vclplug_gen,\ + $$(CXXFLAGS) \ + $$(FONTCONFIG_CFLAGS) \ + $$(FREETYPE_CFLAGS) \ +)) +$(eval $(call gb_Library_add_linked_libs,vclplug_gen,\ + cairo \ +)) +endif + $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\ vcl/unx/generic/app/i18n_cb \ vcl/unx/generic/app/i18n_ic \ @@ -117,7 +137,6 @@ $(eval $(call gb_Library_add_defs,vclplug_gen,\ -DVCLPLUG_GEN_IMPLEMENTATION \ )) - ## handle RandR ifneq ($(ENABLE_RANDR),) $(eval $(call gb_Library_add_defs,vclplug_gen,\ diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk index cf4ac762022c..d9674f03cb8e 100644 --- a/vcl/Library_vclplug_gtk.mk +++ b/vcl/Library_vclplug_gtk.mk @@ -32,7 +32,6 @@ $(eval $(call gb_Library_set_include,vclplug_gtk,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) @@ -59,6 +58,11 @@ $(eval $(call gb_Library_add_libs,vclplug_gtk,\ )) endif +$(eval $(call gb_Library_add_api,vclplug_gtk,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_libs,vclplug_gtk,\ $$(GTK_LIBS) \ $$(GTHREAD_LIBS) \ diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk index 83fb8306468d..587d69376500 100644 --- a/vcl/Library_vclplug_gtk3.mk +++ b/vcl/Library_vclplug_gtk3.mk @@ -32,7 +32,6 @@ $(eval $(call gb_Library_set_include,vclplug_gtk3,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) @@ -47,6 +46,11 @@ $(eval $(call gb_Library_set_defs,vclplug_gtk3,\ -DVERSION=\"$(UPD)$(LAST_MINOR)\" \ )) +$(eval $(call gb_Library_add_api,vclplug_gtk3,\ + offapi \ + udkapi \ +)) + ifneq ($(ENABLE_DBUS),) $(eval $(call gb_Library_set_include,vclplug_gtk3,\ $$(INCLUDE) \ diff --git a/vcl/Library_vclplug_kde.mk b/vcl/Library_vclplug_kde.mk index ddc429180528..e4586b8a108b 100644 --- a/vcl/Library_vclplug_kde.mk +++ b/vcl/Library_vclplug_kde.mk @@ -32,7 +32,6 @@ $(eval $(call gb_Library_set_include,vclplug_kde,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) @@ -45,6 +44,11 @@ $(eval $(call gb_Library_add_defs,vclplug_kde,\ -DVCLPLUG_KDE_IMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,vclplug_kde,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_libs,vclplug_kde,\ $$(KDE_LIBS) \ )) diff --git a/vcl/Library_vclplug_kde4.mk b/vcl/Library_vclplug_kde4.mk index 25695d9d5a33..bbc64aabcbdc 100644 --- a/vcl/Library_vclplug_kde4.mk +++ b/vcl/Library_vclplug_kde4.mk @@ -34,7 +34,6 @@ $(eval $(call gb_Library_set_include,vclplug_kde4,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ -I$(WORKDIR)/CustomTarget/vcl/unx/kde4 \ )) @@ -48,6 +47,11 @@ $(eval $(call gb_Library_add_defs,vclplug_kde4,\ -DVCLPLUG_KDE4_IMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,vclplug_kde4,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_libs,vclplug_kde4,\ $$(KDE4_LIBS) \ )) diff --git a/vcl/Library_vclplug_svp.mk b/vcl/Library_vclplug_svp.mk index 7df8f4790a17..7616e6c06025 100644 --- a/vcl/Library_vclplug_svp.mk +++ b/vcl/Library_vclplug_svp.mk @@ -32,7 +32,6 @@ $(eval $(call gb_Library_set_include,vclplug_svp,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) @@ -40,6 +39,11 @@ $(eval $(call gb_Library_add_defs,vclplug_svp,\ -DVCLPLUG_SVP_IMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,vclplug_svp,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_linked_libs,vclplug_svp,\ vcl \ vclplug_gen \ diff --git a/vcl/StaticLibrary_vclmain.mk b/vcl/StaticLibrary_vclmain.mk index 044ce10ca40c..4c313f88b082 100644 --- a/vcl/StaticLibrary_vclmain.mk +++ b/vcl/StaticLibrary_vclmain.mk @@ -27,15 +27,26 @@ $(eval $(call gb_StaticLibrary_StaticLibrary,vclmain)) +ifeq ($(OS),IOS) +$(eval $(call gb_StaticLibrary_set_cxxflags,vclmain,\ + $$(CXXFLAGS) \ + -x objective-c++ -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 \ +)) +endif + $(eval $(call gb_StaticLibrary_set_include,vclmain,\ $$(INCLUDE) \ -I$(realpath $(SRCDIR)/vcl/inc) \ -I$(realpath $(SRCDIR)/vcl/inc/pch) \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_StaticLibrary_add_api,vclmain,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_StaticLibrary_add_exception_objects,vclmain,\ vcl/source/salmain/salmain \ )) @@ -45,7 +56,7 @@ $(eval $(call gb_StaticLibrary_add_exception_objects,vclmain,\ # Instead of this evil linking of an object from $(OUTDIR) define StaticLibrary_salmain_hack $(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))) +$$(eval $$(call gb_Deliver_add_deliverable,$(OUTDIR)/lib/$(1),$(call gb_CxxObject_get_target,vcl/source/salmain/salmain),$(OUTDIR)/lib/$(1))) $(OUTDIR)/lib/$(1) : $(call gb_CxxObject_get_target,vcl/source/salmain/salmain) $$(call gb_Deliver_deliver,$$<,$$@) diff --git a/vcl/aqua/source/a11y/aqua11yactionwrapper.mm b/vcl/aqua/source/a11y/aqua11yactionwrapper.mm index e49ad251faad..d0f8ca91c73d 100644 --- a/vcl/aqua/source/a11y/aqua11yactionwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11yactionwrapper.mm @@ -1,3 +1,4 @@ +/* -*- 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,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm index c66e7c3d8515..0f50dad02c0e 100644 --- a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yfactory.mm b/vcl/aqua/source/a11y/aqua11yfactory.mm index 41b66d19e578..944a8e9ea90a 100644 --- a/vcl/aqua/source/a11y/aqua11yfactory.mm +++ b/vcl/aqua/source/a11y/aqua11yfactory.mm @@ -1,3 +1,4 @@ +/* -*- 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,3 +199,5 @@ static bool enabled = false; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yrolehelper.mm b/vcl/aqua/source/a11y/aqua11yrolehelper.mm index cfc052e96beb..e989f38f4a1b 100644 --- a/vcl/aqua/source/a11y/aqua11yrolehelper.mm +++ b/vcl/aqua/source/a11y/aqua11yrolehelper.mm @@ -1,3 +1,4 @@ +/* -*- 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,6 +43,10 @@ using namespace ::com::sun::star::uno; +(id)simpleMapNativeRoleFrom: (XAccessibleContext *) accessibleContext { id nativeRole = nil; + + if (accessibleContext == NULL) + return nativeRole; + switch( accessibleContext -> getAccessibleRole() ) { #define MAP(a,b) \ case a: nativeRole = b; break @@ -272,3 +277,5 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm index 5b8d604f3b1a..960afb384caa 100644 --- a/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm index 110cb42ffee7..47b766df2223 100644 --- a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -210,3 +211,5 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm index 2122f56e9565..5a4628edb76e 100644 --- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -254,3 +255,5 @@ using namespace ::rtl; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm index d956d2beb0b7..cb6fae77a7a9 100644 --- a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -299,3 +300,5 @@ using namespace ::rtl; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yutil.mm b/vcl/aqua/source/a11y/aqua11yutil.mm index 74de0a19aa41..b244f1f67855 100644 --- a/vcl/aqua/source/a11y/aqua11yutil.mm +++ b/vcl/aqua/source/a11y/aqua11yutil.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ using namespace ::com::sun::star::awt; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm b/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm index fb257921b13e..fc10d44058d8 100644 --- a/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm +++ b/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm index bf8de98c3318..2376111eb427 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1145,3 +1146,5 @@ Reference < XAccessibleContext > hitTestRunner ( com::sun::star::awt::Point poin } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperbutton.mm b/vcl/aqua/source/a11y/aqua11ywrapperbutton.mm index e51ceff14af9..dd9b95901d13 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperbutton.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperbutton.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm b/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm index 6bf2aa2f8340..1c70d774d0eb 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm b/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm index 6f8e9d05d112..1fd7468f8858 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappergroup.mm b/vcl/aqua/source/a11y/aqua11ywrappergroup.mm index 536cc9bba8eb..f3e1dcf769c5 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappergroup.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappergroup.mm @@ -1,3 +1,4 @@ +/* -*- 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,3 +56,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperlist.mm b/vcl/aqua/source/a11y/aqua11ywrapperlist.mm index d70679ed6966..9c7f5f6fe932 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperlist.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperlist.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ using namespace ::com::sun::star::accessibility; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm b/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm index 4c1e9047d65e..af4fda68a86e 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.mm b/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.mm index 52e71620ceed..47668005376a 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperrow.mm b/vcl/aqua/source/a11y/aqua11ywrapperrow.mm index 0fd65fd01365..8ecd37aafc1c 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperrow.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperrow.mm @@ -1,3 +1,4 @@ +/* -*- 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,3 +56,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.mm b/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.mm index 8a481b64926d..7c9c6f12fc63 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.mm b/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.mm index 42b67b739602..5087ae5e3f3e 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ using namespace ::com::sun::star::accessibility; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappersplitter.mm b/vcl/aqua/source/a11y/aqua11ywrappersplitter.mm index 37821f25e423..96f8c6413cc9 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappersplitter.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappersplitter.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ using namespace ::com::sun::star::accessibility; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperstatictext.mm b/vcl/aqua/source/a11y/aqua11ywrapperstatictext.mm index d5afe0962904..d280264a36bd 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperstatictext.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperstatictext.mm @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,3 +55,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappertabgroup.mm b/vcl/aqua/source/a11y/aqua11ywrappertabgroup.mm index fb4e66ad9b90..09fa3d2b6947 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappertabgroup.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappertabgroup.mm @@ -1,3 +1,4 @@ +/* -*- 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappertextarea.mm b/vcl/aqua/source/a11y/aqua11ywrappertextarea.mm index a90fe7ae28aa..074b6d84d427 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappertextarea.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappertextarea.mm @@ -1,3 +1,4 @@ +/* -*- 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 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappertoolbar.mm b/vcl/aqua/source/a11y/aqua11ywrappertoolbar.mm index 29ddaf540266..636be7b2fd32 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappertoolbar.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappertoolbar.mm @@ -1,3 +1,4 @@ +/* -*- 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/app/salnstimer.mm b/vcl/aqua/source/app/salnstimer.mm index f44c3d698f73..d78a3ae8462e 100755..100644 --- a/vcl/aqua/source/app/salnstimer.mm +++ b/vcl/aqua/source/app/salnstimer.mm @@ -1,3 +1,4 @@ +/* -*- 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,3 +56,4 @@ } @end +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index fc4945e1e184..2424d373b24e 100755..100644 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -1,3 +1,4 @@ +/* -*- 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,10 @@ } @end +// If you wonder how this VCL_NSApplication stuff works, one thing you +// might have missed is that the NSPrincipalClass property in +// desktop/macosx/Info.plist has the value VCL_NSApplication. + @implementation VCL_NSApplication -(void)sendEvent:(NSEvent*)pEvent { @@ -520,3 +525,4 @@ @end +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm index 2bb67dcc1940..abe314f27f8f 100644 --- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1389,3 +1390,5 @@ static void addEdit( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/aquaprintview.mm b/vcl/aqua/source/gdi/aquaprintview.mm index 692435fc00f0..a7a527a9289b 100755..100644 --- a/vcl/aqua/source/gdi/aquaprintview.mm +++ b/vcl/aqua/source/gdi/aquaprintview.mm @@ -1,3 +1,4 @@ +/* -*- 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,5 @@ mpController->printFilteredPage( nPage-1 ); } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 94022b763a03..1c193378b9cf 100644 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -1043,7 +1043,6 @@ bool ATSLayout::GetDeltaY() const if( mpDeltaY != NULL ) return true; -#if 1 if( !maATSULayout ) return false; @@ -1069,7 +1068,6 @@ bool ATSLayout::GetDeltaY() const mpDeltaY = NULL; return false; } -#endif return true; } diff --git a/vcl/aqua/source/gdi/salbmp.cxx b/vcl/aqua/source/gdi/salbmp.cxx index bfb15f0a8076..6afad341e5b0 100644 --- a/vcl/aqua/source/gdi/salbmp.cxx +++ b/vcl/aqua/source/gdi/salbmp.cxx @@ -871,7 +871,6 @@ bool AquaSalBitmap::GetSystemData( BitmapSystemData& rData ) { bRet = true; -#ifdef CAIRO if ((CGBitmapContextGetBitsPerPixel(mxGraphicContext) == 32) && (CGBitmapContextGetBitmapInfo(mxGraphicContext) & kCGBitmapByteOrderMask) != kCGBitmapByteOrder32Host) { /** @@ -904,7 +903,6 @@ bool AquaSalBitmap::GetSystemData( BitmapSystemData& rData ) CGImageRelease( xImage ); mxGraphicContext = mxGraphicContextNew; } -#endif rData.rImageContext = (void *) mxGraphicContext; rData.mnWidth = mnWidth; diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index ade5594ec667..54ebe8090f1c 100755..100644 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*n*********************************************************************** * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1728,3 +1729,4 @@ private: @end +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/window/salnsmenu.mm b/vcl/aqua/source/window/salnsmenu.mm index b86caa49d870..c2f182773ce6 100755..100644 --- a/vcl/aqua/source/window/salnsmenu.mm +++ b/vcl/aqua/source/window/salnsmenu.mm @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -213,3 +214,4 @@ @end +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/android/svsys.h b/vcl/inc/android/svsys.h new file mode 100644 index 000000000000..9dabc7187400 --- /dev/null +++ b/vcl/inc/android/svsys.h @@ -0,0 +1,36 @@ +/* -*- 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 or as specified alternatively below. 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 Tor Lillqvist <tml@iki.fi> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * For minor contributions see the git repository. + * + * 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 _VCL_ANDROID_SVSYS_H +#define _VCL_ANDROID_SVSYS_H + + +// ? + +#endif // _VCL_ANDROID_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index 6b6bce184770..592f6a73c050 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -144,8 +144,6 @@ private: sal_uLong ImplGetAnimationLoopCount() const; void ImplResetAnimationLoopCount(); - List* ImplGetAnimationInfoList() const; - private: GraphicReader* ImplGetContext(); diff --git a/vcl/inc/ios/iosvcltypes.h b/vcl/inc/ios/iosvcltypes.h new file mode 100644 index 000000000000..820547b6a013 --- /dev/null +++ b/vcl/inc/ios/iosvcltypes.h @@ -0,0 +1,37 @@ +/* -*- 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 or as specified alternatively below. 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 Tor Lillqvist <tml@iki.fi> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * For minor contributions see the git repository. + * + * 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 _IOSVCLTYPES_H +#define _IOSVCLTYPES_H + +#include "premac.h" +#import <UIKit/UIKit.h> +#include "postmac.h" + +#endif _IOSVCLTYPES_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salbmp.h b/vcl/inc/ios/salbmp.h new file mode 100644 index 000000000000..0c3e1468b154 --- /dev/null +++ b/vcl/inc/ios/salbmp.h @@ -0,0 +1,117 @@ +/* -*- 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 _SV_SALBMP_H +#define _SV_SALBMP_H + +#include "tools/gen.hxx" + +#include "basebmp/bitmapdevice.hxx" + +#include "vcl/salbtype.hxx" + +#include "ios/salgdi.h" + +#include "saldata.hxx" +#include "salinst.hxx" +#include "salvd.hxx" +#include "salbmp.hxx" + +#include "salcolorutils.hxx" + + +// -------------- +// - SalBitmap - +// -------------- + +struct BitmapBuffer; +class BitmapColor; +class BitmapPalette; +class IosSalVirtualDevice; +class IosSalGraphics; + +class IosSalBitmap : public SalBitmap +{ +public: + CGContextRef mxGraphicContext; + mutable CGImageRef mxCachedImage; + BitmapPalette maPalette; + basebmp::RawMemorySharedArray maUserBuffer; + basebmp::RawMemorySharedArray maContextBuffer; + sal_uInt16 mnBits; + int mnWidth; + int mnHeight; + sal_uInt32 mnBytesPerRow; + +public: + IosSalBitmap(); + virtual ~IosSalBitmap(); + +public: + + // SalBitmap methods + bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ); + 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(); + + Size GetSize() const; + sal_uInt16 GetBitCount() const; + + BitmapBuffer *AcquireBuffer( bool bReadOnly ); + void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); + + bool GetSystemData( BitmapSystemData& rData ); + +private: + // quartz helper + bool CreateContext(); + void DestroyContext(); + bool AllocateUserData(); + + void ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight, + sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow, const BitmapPalette& rDestPalette, sal_uInt8* pDestData, + sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData ); + +public: + bool Create( CGLayerRef xLayer, int nBitCount, int nX, int nY, int nWidth, int nHeight, bool bMirrorVert = true ); + +public: + CGImageRef CreateWithMask( const IosSalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const; + CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, SalColor nMaskColor ) const; + CGImageRef CreateCroppedImage( int nX, int nY, int nWidth, int nHeight ) const; +}; + +#endif // _SV_SALBMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salcolorutils.hxx b/vcl/inc/ios/salcolorutils.hxx new file mode 100644 index 000000000000..d6db5f839e04 --- /dev/null +++ b/vcl/inc/ios/salcolorutils.hxx @@ -0,0 +1,46 @@ +/* -*- 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 _SV_SALCOLORUTILS_HXX +#define _SV_SALCOLORUTILS_HXX + +#include "vcl/salbtype.hxx" +#include "vcl/salgtype.hxx" +#include "salmathutils.hxx" + +// ------------------------------------------------------------------ + +SalColor GetSalColor( const float* pQuartzColor ); + +void SetSalColor( const SalColor& rColor, float* pQuartzColor ); + +// ------------------------------------------------------------------ + +#endif // _SV_SALCOLORUTILS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/saldata.hxx b/vcl/inc/ios/saldata.hxx new file mode 100644 index 000000000000..764264e42462 --- /dev/null +++ b/vcl/inc/ios/saldata.hxx @@ -0,0 +1,126 @@ +/* -*- 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 _SV_SALDATA_HXX +#define _SV_SALDATA_HXX + +#include "premac.h" +#include <UIKit/UIKit.h> +#include "postmac.h" + +#include "com/sun/star/uno/Reference.hxx" + +#include "vcl/ptrstyle.hxx" + +#include "svdata.hxx" +#include "salwtype.hxx" + +#include <list> +#include <vector> +#include <map> +#include <boost/unordered_set.hpp> + +#include <cstdio> +#include <cstdarg> + +class IosSalInstance; +class SalObject; +class SalFrame; +class SalVirtualDevice; +class SalPrinter; +class SystemFontList; + +// ------------------ +// - Some constants - +// ------------------ + +#define SAL_CLIPRECT_COUNT 16 + +#define VER_TIGER 0x1040 +#define VER_LEOPARD 0x1050 + +// ----------- +// - SalData - +// ----------- + +class IosSalFrame; +struct FrameHash : public boost::hash<sal_IntPtr> +{ + size_t operator()(const IosSalFrame* frame) const + { return boost::hash<sal_IntPtr>::operator()( reinterpret_cast<const sal_IntPtr>(frame) ); } +}; + +struct SalData +{ + + SALTIMERPROC mpTimerProc; // timer callback proc + IosSalInstance *mpFirstInstance; // pointer of first instance + std::list<IosSalFrame*> maFrames; // pointer of first frame + boost::unordered_set<const IosSalFrame*,FrameHash> maFrameCheck; // for fast check of frame existance + SalObject *mpFirstObject; // pointer of first object window + SalVirtualDevice *mpFirstVD; // first VirDev + SalPrinter *mpFirstPrinter; // first printing printer + SystemFontList *mpFontList; + + CGColorSpaceRef mxRGBSpace; + CGColorSpaceRef mxGraySpace; + CGColorSpaceRef mxP50Space; + CGPatternRef mxP50Pattern; + + std::vector< UIMenuItem* > maFallbackMenu; + + static oslThreadKey s_aAutoReleaseKey; + + SInt32 mnSystemVersion; // Store System Version + + long mnDPIX; // #i100617# read DPI only once per office life + long mnDPIY; // #i100617# read DPI only once per office life + + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + mxClipboard; + + SalData(); + ~SalData(); + + static void ensureThreadAutoreleasePool(); + static void drainThreadAutoreleasePool(); +}; + +inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; } +inline SalData *GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; } +inline SalData *GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; } + +// --- Prototypes --- + +sal_Bool ImplSalYieldMutexTryToAcquire(); +void ImplSalYieldMutexAcquire(); +void ImplSalYieldMutexRelease(); + +#endif // _SV_SALDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salframe.h b/vcl/inc/ios/salframe.h new file mode 100644 index 000000000000..14761fe36ebd --- /dev/null +++ b/vcl/inc/ios/salframe.h @@ -0,0 +1,208 @@ +/* -*- 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 _SV_SALFRAME_H +#define _SV_SALFRAME_H + +#include "vcl/sysdata.hxx" + +#include "ios/salmenu.h" +#include "ios/saldata.hxx" +#include "ios/iosvcltypes.h" + +#include "salframe.hxx" + +#include <vector> +#include <utility> +#include <stdexcept> + +#include <boost/shared_ptr.hpp> + +class IosSalGraphics; +class IosSalFrame; +class IosSalTimer; +class IosSalInstance; +class IosSalMenu; +class IosBlinker; + +typedef struct SalFrame::SalPointerState SalPointerState; + +// ---------------- +// - IosSalFrame - +// ---------------- + +class IosSalFrame : public SalFrame +{ +public: + UIWindow* mpWindow; + UIView* mpView; + CGRect maScreenRect; // for mirroring purposes + IosSalGraphics* mpGraphics; + IosSalFrame* mpParent; + SystemEnvData maSysData; + int mnMinWidth; // min. client width in pixels + int mnMinHeight; // min. client height in pixels + int mnMaxWidth; // max. client width in pixels + int mnMaxHeight; // max. client height in pixels + CGRect maFullScreenRect; // old window size when in FullScreen + bool mbGraphics:1; // is Graphics used? + bool mbShown:1; + bool mbInitShow:1; + bool mbPresentation:1; + + sal_uLong mnStyle; + unsigned int mnStyleMask; // our style mask from UIWindow creation + + sal_uLong mnLastEventTime; + unsigned int mnLastModifierFlags; + IosSalMenu* mpMenu; + + SalExtStyle mnExtStyle; // currently document frames are marked this way + + PointerStyle mePointerStyle; // currently active pointer style + + CGMutablePathRef mrClippingPath; // used for "shaping" + std::vector< CGRect > maClippingRects; + + std::list<IosBlinker*> maBlinkers; + + Rectangle maInvalidRect; + + sal_uLong mnICOptions; + + boost::shared_ptr< Timer > mpActivityTimer; // Timer to prevent system sleep during presentation +public: + /** Constructor + + Creates a system window and connects this frame with it. + + @throws std::runtime_error in case window creation fails + */ + IosSalFrame( SalFrame* pParent, sal_uLong salFrameStyle ); + + virtual ~IosSalFrame(); + + virtual SalGraphics* GetGraphics(); + virtual void ReleaseGraphics( SalGraphics* pGraphics ); + virtual sal_Bool PostEvent( void* pData ); + virtual void SetTitle( const XubString& rTitle ); + virtual void SetIcon( sal_uInt16 nIcon ); + virtual void SetRepresentedURL( const rtl::OUString& ); + virtual void SetMenu( SalMenu* pSalMenu ); + virtual void DrawMenuBar(); + virtual void Show( sal_Bool bVisible, sal_Bool bNoActivate = sal_False ); + virtual void Enable( sal_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, sal_uInt16 nFlags ); + virtual void GetClientSize( long& rWidth, long& rHeight ); + virtual void GetWorkArea( Rectangle& rRect ); + virtual SalFrame* GetParent() const; + virtual void SetWindowState( const SalFrameState* pState ); + virtual sal_Bool GetWindowState( SalFrameState* pState ); + virtual void ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay ); + virtual void StartPresentation( sal_Bool bStart ); + virtual void SetAlwaysOnTop( sal_Bool bOnTop ); + virtual void ToTop( sal_uInt16 nFlags ); + virtual void SetPointer( PointerStyle ePointerStyle ); + virtual void CaptureMouse( sal_Bool bMouse ); + virtual void SetPointerPos( long nX, long nY ); + virtual void Flush( void ); + virtual void Flush( const Rectangle& ); + virtual void Sync(); + virtual void SetInputContext( SalInputContext* pContext ); + virtual void EndExtTextInput( sal_uInt16 nFlags ); + virtual String GetKeyName( sal_uInt16 nKeyCode ); + virtual String GetSymbolKeyName( const XubString& rFontName, sal_uInt16 nKeyCode ); + virtual sal_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 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) + virtual void ResetClipRegion(); + // start setting the clipregion consisting of nRects rectangles + virtual void BeginSetClipRegion( sal_uLong nRects ); + // add a rectangle to the clip region + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); + // done setting up the clipregion + virtual void EndSetClipRegion(); + + virtual void SetClientSize( long nWidth, long nHeight ); + + void UpdateFrameGeometry(); + + // trigger painting of the window + void SendPaintEvent( const Rectangle* pRect = NULL ); + + static bool isAlive( const IosSalFrame* pFrame ) + { return GetSalData()->maFrameCheck.find( pFrame ) != GetSalData()->maFrameCheck.end(); } + + static IosSalFrame* GetCaptureFrame() { return s_pCaptureFrame; } + + UIWindow* getWindow() const { return mpWindow; } + UIView* getView() const { return mpView; } + unsigned int getStyleMask() const { return mnStyleMask; } + + void getResolution( long& o_rDPIX, long& o_rDPIY ); + + CGMutablePathRef getClipPath() const { return mrClippingPath; } + + // called by VCL_UIApplication to indicate screen settings have changed + void screenParametersChanged(); + + private: // methods + /** do things on initial show (like centering on parent or on screen) + */ + void initShow(); + + void initWindowAndView(); + + private: // data + static IosSalFrame* s_pCaptureFrame; + + // make IosSalFrame non copyable + IosSalFrame( const IosSalFrame& ); + IosSalFrame& operator=(const IosSalFrame&); +}; + +#endif // _SV_SALFRAME_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salframeview.h b/vcl/inc/ios/salframeview.h new file mode 100644 index 000000000000..e631209c7b7f --- /dev/null +++ b/vcl/inc/ios/salframeview.h @@ -0,0 +1,144 @@ +/* -*- 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_SALFRAMEVIEW_H +#define _VCL_SALFRAMEVIEW_H + +@interface SalFrameWindow : UIWindow +{ + IosSalFrame* mpFrame; + id mDraggingDestinationHandler; +} +-(id)initWithSalFrame: (IosSalFrame*)pFrame; +-(BOOL)canBecomeKeyWindow; +-(void)displayIfNeeded; +-(void)becomeKeyWindow; +-(void)resignKeyWindow; +-(IosSalFrame*)getSalFrame; +@end + +@interface SalFrameView : UIView <UITextInput> +{ + IosSalFrame* mpFrame; + + // for UITextInput + UIEvent* mpLastEvent; + BOOL mbNeedSpecialKeyHandle; + BOOL mbInKeyInput; + BOOL mbKeyHandled; + NSRange mMarkedRange; + NSRange mSelectedRange; + id mDraggingDestinationHandler; + UIEvent* mpLastSuperEvent; + + NSTimeInterval mfLastMagnifyTime; + float mfMagnifyDeltaSum; +} +-(id)initWithSalFrame: (IosSalFrame*)pFrame; +-(IosSalFrame*)getSalFrame; +-(BOOL)acceptsFirstResponder; +-(BOOL)isOpaque; +-(void)drawRect: (CGRect)aRect; +-(void)magnifyWithEvent: (UIEvent*)pEvent; +-(void)rotateWithEvent: (UIEvent*)pEvent; +-(void)swipeWithEvent: (UIEvent*)pEvent; +-(void)keyDown: (UIEvent*)pEvent; +-(void)flagsChanged: (UIEvent*)pEvent; +-(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar; +-(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod; +-(BOOL)sendKeyToFrameDirect: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod; +-(BOOL)sendSingleCharacter:(UIEvent*)pEvent; +-(BOOL)handleKeyDownException:(UIEvent*)pEvent; +-(void)clearLastEvent; +/* + text action methods +*/ +-(void)insertText:(id)aString; +-(void)insertTab: (id)aSender; +-(void)insertBacktab: (id)aSender; +-(void)moveLeft: (id)aSender; +-(void)moveLeftAndModifySelection: (id)aSender; +-(void)moveBackwardAndModifySelection: (id)aSender; +-(void)moveRight: (id)aSender; +-(void)moveRightAndModifySelection: (id)aSender; +-(void)moveForwardAndModifySelection: (id)aSender; +-(void)moveUp: (id)aSender; +-(void)moveDown: (id)aSender; +-(void)moveWordBackward: (id)aSender; +-(void)moveWordBackwardAndModifySelection: (id)aSender; +-(void)moveWordLeftAndModifySelection: (id)aSender; +-(void)moveWordForward: (id)aSender; +-(void)moveWordForwardAndModifySelection: (id)aSender; +-(void)moveWordRightAndModifySelection: (id)aSender; +-(void)moveToEndOfLine: (id)aSender; +-(void)moveToRightEndOfLine: (id)aSender; +-(void)moveToLeftEndOfLine: (id)aSender; +-(void)moveToEndOfLineAndModifySelection: (id)aSender; +-(void)moveToRightEndOfLineAndModifySelection: (id)aSender; +-(void)moveToLeftEndOfLineAndModifySelection: (id)aSender; +-(void)moveToBeginningOfLine: (id)aSender; +-(void)moveToBeginningOfLineAndModifySelection: (id)aSender; +-(void)moveToEndOfParagraph: (id)aSender; +-(void)moveToEndOfParagraphAndModifySelection: (id)aSender; +-(void)moveToBeginningOfParagraph: (id)aSender; +-(void)moveToBeginningOfParagraphAndModifySelection: (id)aSender; +-(void)moveParagraphForward: (id)aSender; +-(void)moveParagraphForwardAndModifySelection: (id)aSender; +-(void)moveParagraphBackward: (id)aSender; +-(void)moveParagraphBackwardAndModifySelection: (id)aSender; +-(void)moveToEndOfDocument: (id)aSender; +-(void)scrollToEndOfDocument: (id)aSender; +-(void)moveToEndOfDocumentAndModifySelection: (id)aSender; +-(void)moveToBeginningOfDocument: (id)aSender; +-(void)scrollToBeginningOfDocument: (id)aSender; +-(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender; +-(void)insertNewline: (id)aSender; +-(void)deleteBackward: (id)aSender; +-(void)deleteForward: (id)aSender; +-(void)cancelOperation: (id)aSender; +-(void)deleteBackwardByDecomposingPreviousCharacter: (id)aSender; +-(void)deleteWordBackward: (id)aSender; +-(void)deleteWordForward: (id)aSender; +-(void)deleteToBeginningOfLine: (id)aSender; +-(void)deleteToEndOfLine: (id)aSender; +-(void)deleteToBeginningOfParagraph: (id)aSender; +-(void)deleteToEndOfParagraph: (id)aSender; +-(void)insertLineBreak: (id)aSender; +-(void)insertParagraphSeparator: (id)aSender; +-(void)selectWord: (id)aSender; +-(void)selectLine: (id)aSender; +-(void)selectParagraph: (id)aSender; +-(void)selectAll: (id)aSender; +-(void)noop: (id)aSender; +-(id)parentAttribute; +-(UIView *)viewElementForParent; +@end + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salgdi.h b/vcl/inc/ios/salgdi.h new file mode 100644 index 000000000000..51ef49219e9a --- /dev/null +++ b/vcl/inc/ios/salgdi.h @@ -0,0 +1,401 @@ +/* -*- 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 _SV_SALGDI_H +#define _SV_SALGDI_H + +#include "basegfx/polygon/b2dpolypolygon.hxx" + +#include "ios/iosvcltypes.h" +#include <vcl/fontcapabilities.hxx> + +#include "outfont.hxx" +#include "salgdi.hxx" + +#include <vector> + +class IosSalFrame; +class IosSalBitmap; +class ImplDevFontAttributes; + +class CGRect; + +// mac specific physically available font face +class ImplIosFontData : public ImplFontData +{ +public: + ImplIosFontData( const ImplDevFontAttributes&, NSString * ); + + virtual ~ImplIosFontData(); + + virtual ImplFontData* Clone() const; + virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; + virtual sal_IntPtr GetFontId() const; + + const ImplFontCharMap* GetImplFontCharMap() const; + bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; + bool HasChar( sal_uInt32 cChar ) const; + + void ReadOs2Table() const; + void ReadIosCmapEncoding() const; + bool HasCJKSupport() const; + +private: + 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 Ios 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 +class RGBAColor +{ +public: + RGBAColor( SalColor ); + RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ); //NOTUSEDYET + const float* AsArray() const { return &mfRed; } + bool IsVisible() const { return (mfAlpha > 0); } + void SetAlpha( float fAlpha ) { mfAlpha = fAlpha; } +private: + float mfRed, mfGreen, mfBlue, mfAlpha; +}; + +// ------------------- +// - IosSalGraphics - +// ------------------- +class IosSalGraphics : public SalGraphics +{ +protected: + IosSalFrame* mpFrame; + CGLayerRef mxLayer; // Quartz graphics layer + CGContextRef mrContext; // Quartz drawing context + class XorEmulation* mpXorEmulation; + int mnXorMode; // 0: off 1: on 2: invert only + int mnWidth; + int mnHeight; + int mnBitmapDepth; // zero unless bitmap + /// device resolution of this graphics + long mnRealDPIX; + long mnRealDPIY; + /// some graphics implementations (e.g. IosSalInfoPrinter) scale + /// everything down by a factor (see SetupPrinterGraphics for details) + /// so we have to compensate for it with the inverse factor + double mfFakeDPIScale; + + /// path representing current clip region + CGMutablePathRef mxClipPath; + + /// Drawing colors + /// pen color RGBA + RGBAColor maLineColor; + /// brush color RGBA + RGBAColor maFillColor; + + // Device Font settings + const ImplIosFontData* mpIosFontData; + /// <1.0: font is squeezed, >1.0 font is stretched, else 1.0 + float mfFontStretch; + /// allows text to be rendered without antialiasing + bool mbNonAntialiasedText; + + // Graphics types + + /// is this a printer graphics + bool mbPrinter; + /// is this a virtual device graphics + bool mbVirDev; + /// is this a window graphics + bool mbWindow; + +public: + IosSalGraphics(); + virtual ~IosSalGraphics(); + + bool IsPenVisible() const { return maLineColor.IsVisible(); } + bool IsBrushVisible() const { return maFillColor.IsVisible(); } + + void SetWindowGraphics( IosSalFrame* pFrame ); + void SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY, double fFakeScale ); + void SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 ); + + void initResolution( UIWindow* ); + void copyResolution( IosSalGraphics& ); + void updateResolution(); + + bool IsWindowGraphics() const { return mbWindow; } + bool IsPrinterGraphics() const { return mbPrinter; } + bool IsVirDevGraphics() const { return mbVirDev; } + IosSalFrame* getGraphicsFrame() const { return mpFrame; } + void setGraphicsFrame( IosSalFrame* pFrame ) { mpFrame = pFrame; } + + void ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels + + bool CheckContext(); + void UpdateWindow( CGRect& ); // delivered in NSView coordinates + void RefreshRect( const CGRect& ); + void RefreshRect(float lX, float lY, float lWidth, float lHeight); + + void SetState(); + void UnsetState(); + // InvalidateContext does an UnsetState and sets mrContext to 0 + void InvalidateContext(); + + virtual bool setClipRegion( const Region& ); + + // 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( sal_uLong nPoints, const SalPoint* pPtAry ); + virtual void drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ); + virtual void drawPolyPolygon( sal_uLong nPoly, const sal_uLong* pPoints, PCONSTSALPOINT* pPtAry ); + virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); + virtual sal_Bool drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); + virtual sal_Bool drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); + virtual sal_Bool drawPolyPolygonBezier( sal_uLong nPoly, const sal_uLong* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry ); + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, + long nSrcHeight, sal_uInt16 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( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags ); + + virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ); + + 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 ); + + CGPoint* makeCGptArray(sal_uLong nPoints, const SalPoint* pPtAry); + // native widget rendering methods that require mirroring + virtual sal_Bool hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + const Point& aPos, sal_Bool& rIsInside ); + virtual sal_Bool drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + ControlState nState, const ImplControlValue& aValue, + const rtl::OUString& aCaption ); + virtual sal_Bool drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + ControlState nState, const ImplControlValue& aValue, + const rtl::OUString& aCaption ); + virtual sal_Bool getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue, const rtl::OUString& aCaption, + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); + + // get device resolution + virtual void GetResolution( long& rDPIX, long& rDPIY ); + // get the depth of the device + virtual sal_uInt16 GetBitCount() const; + // get the width of the device + virtual long GetGraphicsWidth() const; + + // set the clip region to empty + virtual void ResetClipRegion(); + + // 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 bInvertOnly ); + // 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 sal_uInt16 SetFont( ImplFontSelectData*, int nFallbackLevel ); + // get the current font's etrics + virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); + // get kernign pairs of the current font + // return only PairCount if (pKernPairs == NULL) + 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 + // 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 sal_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*, + bool bVertical, + Int32Vector& rWidths, + Ucs2UIntMap& rUnicodeEnc ); + + 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; + + // Query the platform layer for control support + virtual sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart ); + + virtual SystemGraphicsData GetGraphicsData() const; + virtual SystemFontData GetSysFontData( int /* nFallbacklevel */ ) const; + +private: + // differences between VCL, Quartz and kHiThemeOrientation coordinate systems + // make some graphics seem to be vertically-mirrored from a VCL perspective + bool IsFlipped() const { return mbWindow; } + + void ApplyXorContext(); + void Pattern50Fill(); + UInt32 getState( ControlState nState ); + UInt32 getTrackState( ControlState nState ); +}; + +class XorEmulation +{ +public: + XorEmulation(); + /*final*/ ~XorEmulation(); + + void SetTarget( int nWidth, int nHeight, int nBitmapDepth, CGContextRef, CGLayerRef ); + bool UpdateTarget(); + void Enable() { mbIsEnabled = true; } + void Disable() { mbIsEnabled = false; } + bool IsEnabled() const { return mbIsEnabled; } + CGContextRef GetTargetContext() const { return mxTargetContext; } + CGContextRef GetMaskContext() const { return (mbIsEnabled ? mxMaskContext : NULL); } + +private: + CGLayerRef mxTargetLayer; + CGContextRef mxTargetContext; + CGContextRef mxMaskContext; + CGContextRef mxTempContext; + sal_uLong* mpMaskBuffer; + sal_uLong* mpTempBuffer; + int mnBufferLongs; + bool mbIsEnabled; +}; + + +// --- some trivial inlines + +inline void IosSalGraphics::RefreshRect( const CGRect& rRect ) +{ + RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height ); +} + +inline RGBAColor::RGBAColor( SalColor nSalColor ) +: mfRed( SALCOLOR_RED(nSalColor) * (1.0/255)) +, mfGreen( SALCOLOR_GREEN(nSalColor) * (1.0/255)) +, mfBlue( SALCOLOR_BLUE(nSalColor) * (1.0/255)) +, mfAlpha( 1.0 ) // opaque +{} + +inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ) +: mfRed( fRed ) +, mfGreen( fGreen ) +, mfBlue( fBlue ) +, mfAlpha( fAlpha ) +{} + +#endif // _SV_SALGDI_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salinst.h b/vcl/inc/ios/salinst.h new file mode 100644 index 000000000000..9983804bf665 --- /dev/null +++ b/vcl/inc/ios/salinst.h @@ -0,0 +1,199 @@ +/* -*- 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 _SV_SALINST_H +#define _SV_SALINST_H + +#include "osl/mutex.hxx" +#include "osl/thread.hxx" +#include "osl/conditn.h" +#include <vcl/solarmutex.hxx> + +#include "ios/iosvcltypes.h" + +#include "salinst.hxx" + +#include <list> + +class IosSalFrame; +class ApplicationEvent; +class Image; + +// ----------------- +// - SalYieldMutex - +// ----------------- + +class SalYieldMutex : public vcl::SolarMutexObject +{ + sal_uLong mnCount; + oslThreadIdentifier mnThreadId; + +public: + SalYieldMutex(); + virtual void acquire(); + virtual void release(); + virtual sal_Bool tryToAcquire(); + sal_uLong GetAcquireCount() const { return mnCount; } + oslThreadIdentifier GetThreadId() const { return mnThreadId; } +}; + +#define YIELD_GUARD osl::SolarGuard aGuard( GetSalData()->mpFirstInstance->GetYieldMutex() ) + + +// ------------------- +// - SalInstanceData - +// ------------------- + +//struct SalInstanceData +//{ +//public: +//}; + +// ------------------ +// - IosSalInstance - +// ------------------ + +class IosSalInstance : public SalInstance +{ + struct SalUserEvent + { + IosSalFrame* mpFrame; + void* mpData; + sal_uInt16 mnType; + + SalUserEvent( IosSalFrame* pFrame, void* pData, sal_uInt16 nType ) : + mpFrame( pFrame ), mpData( pData ), mnType( nType ) + {} + }; + +public: + SalYieldMutex* mpSalYieldMutex; + rtl::OUString maDefaultPrinter; + oslThreadIdentifier maMainThread; + bool mbWaitingYield; + int mnActivePrintJobs; + std::list< SalUserEvent > maUserEvents; + oslMutex maUserEventListMutex; + oslCondition maWaitingYieldCond; + + typedef std::list<const ApplicationEvent*> AppEventList; + static AppEventList aAppEventList; + +public: + IosSalInstance(); + virtual ~IosSalInstance(); + + virtual SalSystem* CreateSystem(); + virtual void DestroySystem(SalSystem*); + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ); + virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ); + virtual void DestroyFrame( SalFrame* pFrame ); + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ); + virtual void DestroyObject( SalObject* pObject ); + virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, + long nDX, long nDY, + sal_uInt16 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 osl::SolarMutex* GetYieldMutex(); + virtual sal_uLong ReleaseYieldMutex(); + virtual void AcquireYieldMutex( sal_uLong nCount ); + virtual bool CheckYieldMutex(); + virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); + virtual bool AnyInput( sal_uInt16 nType ); + virtual SalMenu* CreateMenu( sal_Bool bMenuBar, Menu* pVCLMenu ); + virtual void DestroyMenu( SalMenu* ); + virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); + virtual void DestroyMenuItem( SalMenuItem* ); + virtual SalSession* CreateSalSession(); + virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); + virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); + virtual void SetEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); + virtual void SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); + + // dtrans implementation + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments ); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource(); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); + + void wakeupYield(); + + public: + friend class IosSalFrame; + + void PostUserEvent( IosSalFrame* pFrame, sal_uInt16 nType, void* pData ); + void delayedSettingsChanged( bool bInvalidate ); + + bool isUIAppThread() const; + + void startedPrintJob() { mnActivePrintJobs++; } + void endedPrintJob() { mnActivePrintJobs--; } + + // event subtypes for NSApplicationDefined events + static const short AppExecuteSVMain = 0x7fff; + static const short AppEndLoopEvent = 1; + static const short AppStartTimerEvent = 10; + static const short AppleRemoteEvent = 15; + static const short YieldWakeupEvent = 20; +}; + +// helper class: inverted solar guard +class YieldMutexReleaser +{ + sal_uLong mnCount; + public: + YieldMutexReleaser(); + ~YieldMutexReleaser(); +}; + +// helper class +rtl::OUString GetOUString( CFStringRef ); +rtl::OUString GetOUString( NSString* ); +CFStringRef CreateCFString( const rtl::OUString& ); +NSString* CreateNSString( const rtl::OUString& ); + +CGImageRef CreateCGImage( const Image& ); +UIImage* CreateUIImage( const Image& ); + +#endif // _SV_SALINST_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salmathutils.hxx b/vcl/inc/ios/salmathutils.hxx new file mode 100644 index 000000000000..e81f68e46b0b --- /dev/null +++ b/vcl/inc/ios/salmathutils.hxx @@ -0,0 +1,90 @@ +/* -*- 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 _SV_SALMATHUTILS_HXX +#define _SV_SALMATHUTILS_HXX + +#ifdef __cplusplus +extern "C" { +#endif + +// ------------------------------------------------------------------ +// +// Structures +// +// ------------------------------------------------------------------ + +// LRectCoor is an abreviation for rectangular coordinates +// represented as long integers + +struct LRectCoor +{ + long x; + long y; + long z; +}; + +// ------------------------------------------------------------------ +// +// Type Definitions +// +// ------------------------------------------------------------------ + +// LRectCoorVec is an abreviation for vectors in rectangular +// coordinates represented as long integers + +typedef struct LRectCoor LRectCoor; +typedef LRectCoor *LRectCoorVector; +typedef LRectCoorVector *LRectCoorTensor; + +// ------------------------------------------------------------------ +// +// Function Headers +// +// ------------------------------------------------------------------ + +void CSwap ( char &rX, char &rY ); +void UCSwap ( unsigned char &rX, unsigned char &rY ); +void SSwap ( short &rX, short &rY ); +void USSwap ( unsigned short &rX, unsigned short &rY ); +void LSwap ( long &rX, long &rY ); +void ULSwap ( unsigned long &rX, unsigned long &rY ); + +// ------------------------------------------------------------------ + +unsigned long Euclidian2Norm ( const LRectCoorVector pVec ); + +// ------------------------------------------------------------------ + +#ifdef __cplusplus +} +#endif + +#endif // _SV_SALMATHUTILS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salmenu.h b/vcl/inc/ios/salmenu.h new file mode 100644 index 000000000000..3f143ac1d976 --- /dev/null +++ b/vcl/inc/ios/salmenu.h @@ -0,0 +1,122 @@ +/* -*- 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 _SV_SALMENU_H +#define _SV_SALMENU_H + +#include "premac.h" +#include <UIKit/UIKit.h> +#include "postmac.h" + +#include "salmenu.hxx" + +#include <vector> + +class IosSalFrame; +class IosSalMenuItem; + +class IosSalMenu : public SalMenu +{ + std::vector< IosSalMenuItem* > maItems; + +public: // for OOStatusView + struct MenuBarButtonEntry + { + SalMenuButtonItem maButton; + UIImage* mpUIImage; // cached image + NSString* mpToolTipString; + + MenuBarButtonEntry() : mpUIImage( nil ), mpToolTipString( nil ) {} + MenuBarButtonEntry( const SalMenuButtonItem& i_rItem ) + : maButton( i_rItem), mpUIImage( nil ), mpToolTipString( nil ) {} + }; +private: + std::vector< MenuBarButtonEntry > maButtons; + + MenuBarButtonEntry* findButtonItem( sal_uInt16 i_nItemId ); + void releaseButtonEntry( MenuBarButtonEntry& i_rEntry ); + static void statusLayout(); +public: + IosSalMenu( bool bMenuBar ); + virtual ~IosSalMenu(); + + virtual sal_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, sal_Bool bCheck ); + virtual void EnableItem( unsigned nPos, sal_Bool bEnable ); + virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText ); + virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage); + virtual void GetSystemMenuData( SystemMenuData* pData ); + virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, sal_uLong nFlags); + virtual bool AddMenuBarButton( const SalMenuButtonItem& ); + virtual void RemoveMenuBarButton( sal_uInt16 nId ); + virtual Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame ); + + int getItemIndexByPos( sal_uInt16 nPos ) const; + const IosSalFrame* getFrame() const; + + void setMainMenu(); + static void unsetMainMenu(); + static void setDefaultMenu(); + static void enableMainMenu( bool bEnable ); + static void addFallbackMenuItem( UIMenuItem* NewItem ); + static void removeFallbackMenuItem( UIMenuItem* pOldItem ); + + const std::vector< MenuBarButtonEntry >& getButtons() const { return maButtons; } + + bool mbMenuBar; // true - Menubar, false - Menu + UIMenuController* mpMenu; + Menu* mpVCLMenu; // the corresponding vcl Menu object + const IosSalFrame* mpFrame; // the frame to dispatch the menu events to + IosSalMenu* mpParentSalMenu; // the parent menu that contains us (and perhaps has a frame) + + static const IosSalMenu* pCurrentMenuBar; + +}; + +class IosSalMenuItem : public SalMenuItem +{ +public: + IosSalMenuItem( const SalItemParams* ); + virtual ~IosSalMenuItem(); + + sal_uInt16 mnId; // Item ID + Menu* mpVCLMenu; // VCL Menu into which this MenuItem is inserted + IosSalMenu* mpParentMenu; // The menu in which this menu item is inserted + IosSalMenu* mpSubMenu; // Sub menu of this item (if defined) + UIMenuItem* mpMenuItem; // The UIMenuItem +}; + +#endif // _SV_SALMENU_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salnstimer.h b/vcl/inc/ios/salnstimer.h new file mode 100644 index 000000000000..cf98276747ee --- /dev/null +++ b/vcl/inc/ios/salnstimer.h @@ -0,0 +1,43 @@ +/* -*- 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_SALNSTIMER_H +#define _VCL_SALNSTIMER_H + +#include "premac.h" +#include <Foundation/Foundation.h> +#include "postmac.h" + +@interface TimerCallbackCaller : NSObject +{ +} +-(void)timerElapsed:(NSTimer*)pTimer; +@end + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salobj.h b/vcl/inc/ios/salobj.h new file mode 100644 index 000000000000..3203a0d46e93 --- /dev/null +++ b/vcl/inc/ios/salobj.h @@ -0,0 +1,86 @@ +/* -*- 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 _SV_SALOBJ_H +#define _SV_SALOBJ_H + +#include "vcl/sysdata.hxx" +#include "salobj.hxx" + +class IosSalFrame; +class IosSalObject; + + +// ----------------- +// - SalObjectData - +// ----------------- + +struct SalObjectData +{ +}; + +class IosSalObject : public SalObject +{ +public: + IosSalFrame* mpFrame; // parent frame + SystemEnvData maSysData; + + long mnClipX; + long mnClipY; + long mnClipWidth; + long mnClipHeight; + bool mbClip; + + long mnX; + long mnY; + long mnWidth; + long mnHeight; + + void setClippedPosSize(); + + IosSalObject( IosSalFrame* pFrame ); + virtual ~IosSalObject(); + + virtual void ResetClipRegion(); + virtual sal_uInt16 GetClipRegionType(); + virtual void BeginSetClipRegion( sal_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( sal_Bool bVisible ); + virtual void Enable( sal_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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salprn.h b/vcl/inc/ios/salprn.h new file mode 100644 index 000000000000..cd90a0f881df --- /dev/null +++ b/vcl/inc/ios/salprn.h @@ -0,0 +1,173 @@ +/* -*- 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 _SV_SALPRN_H +#define _SV_SALPRN_H + +#include "ios/iosvcltypes.h" + +#include "salprn.hxx" + +#include <boost/shared_array.hpp> + + +// --------------------- +// - IosSalInfoPrinter - +// --------------------- + +class IosSalGraphics; + +class IosSalInfoPrinter : public SalInfoPrinter +{ + /// Printer graphics + IosSalGraphics* mpGraphics; + /// is Graphics used + bool mbGraphics; + /// job active ? + bool mbJob; + + UIPrintFormatter* mpPrinter; + /// cocoa print info object + UIPrintInfo* mpPrintInfo; + + /// FIXME: get real printer context for infoprinter if possible + /// fake context for info printer + /// graphics context for Quartz 2D + CGContextRef mrContext; + /// memory for graphics bitmap context for querying metrics + boost::shared_array< sal_uInt8 > maContextMemory; + + // since changes to UIPrintInfo during a job are ignored + // we have to care for some settings ourselves + // currently we do this for orientation; + // really needed however is a solution for paper formats + Orientation mePageOrientation; + + int mnStartPageOffsetX; + int mnStartPageOffsetY; + sal_Int32 mnCurPageRangeStart; + sal_Int32 mnCurPageRangeCount; + + public: + IosSalInfoPrinter( const SalPrinterQueueInfo& pInfo ); + virtual ~IosSalInfoPrinter(); + + void SetupPrinterGraphics( CGContextRef i_xContext ) const; + + virtual SalGraphics* GetGraphics(); + virtual void ReleaseGraphics( SalGraphics* i_pGraphics ); + virtual sal_Bool Setup( SalFrame* i_pFrame, ImplJobSetup* i_pSetupData ); + virtual sal_Bool SetPrinterData( ImplJobSetup* pSetupData ); + virtual sal_Bool SetData( sal_uLong i_nFlags, ImplJobSetup* i_pSetupData ); + virtual void GetPageInfo( const ImplJobSetup* i_pSetupData, + long& o_rOutWidth, long& o_rOutHeight, + long& o_rPageOffX, long& o_rPageOffY, + long& o_rPageWidth, long& o_rPageHeight ); + virtual sal_uLong GetCapabilities( const ImplJobSetup* i_pSetupData, sal_uInt16 i_nType ); + virtual sal_uLong GetPaperBinCount( const ImplJobSetup* i_pSetupData ); + virtual String GetPaperBinName( const ImplJobSetup* i_pSetupData, sal_uLong i_nPaperBin ); + virtual void InitPaperFormats( const ImplJobSetup* i_pSetupData ); + virtual int GetLandscapeAngle( const ImplJobSetup* i_pSetupData ); + + // the artificial separation between InfoPrinter and Printer + // is not really useful for us + // so let's make IosSalPrinter just a forwarder to IosSalInfoPrinter + // and concentrate the real work in one class + // implement pull model print system + sal_Bool StartJob( const String* i_pFileName, + const String& rJobName, + const String& i_rAppName, + ImplJobSetup* i_pSetupData, + vcl::PrinterController& i_rController ); + sal_Bool EndJob(); + sal_Bool AbortJob(); + SalGraphics* StartPage( ImplJobSetup* i_pSetupData, sal_Bool i_bNewJobData ); + sal_Bool EndPage(); + sal_uLong GetErrorCode() const; + + UIPrintInfo* getPrintInfo() const { return mpPrintInfo; } + void setStartPageOffset( int nOffsetX, int nOffsetY ) { mnStartPageOffsetX = nOffsetX; mnStartPageOffsetY = nOffsetY; } + sal_Int32 getCurPageRangeStart() const { return mnCurPageRangeStart; } + sal_Int32 getCurPageRangeCount() const { return mnCurPageRangeCount; } + + // match width/height against known paper formats, possibly switching orientation + const PaperInfo* matchPaper( long i_nWidth, long i_nHeight, Orientation& o_rOrientation ) const; + void setPaperSize( long i_nWidth, long i_nHeight, Orientation i_eSetOrientation ); + + private: + IosSalInfoPrinter( const IosSalInfoPrinter& ); + IosSalInfoPrinter& operator=(const IosSalInfoPrinter&); +}; + +// ----------------- +// - IosSalPrinter - +// ----------------- + +class IosSalPrinter : public SalPrinter +{ + IosSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter + public: + IosSalPrinter( IosSalInfoPrinter* i_pInfoPrinter ); + virtual ~IosSalPrinter(); + + virtual sal_Bool StartJob( const XubString* i_pFileName, + const XubString& i_rJobName, + const XubString& i_rAppName, + sal_uLong i_nCopies, + bool i_bCollate, + bool i_bDirect, + ImplJobSetup* i_pSetupData ); + // implement pull model print system + virtual sal_Bool StartJob( const String* i_pFileName, + const String& rJobName, + const String& i_rAppName, + ImplJobSetup* i_pSetupData, + vcl::PrinterController& i_rListener ); + + virtual sal_Bool EndJob(); + virtual sal_Bool AbortJob(); + virtual SalGraphics* StartPage( ImplJobSetup* i_pSetupData, sal_Bool i_bNewJobData ); + virtual sal_Bool EndPage(); + virtual sal_uLong GetErrorCode(); + + private: + IosSalPrinter( const IosSalPrinter& ); + IosSalPrinter& operator=(const IosSalPrinter&); +}; + +const double fPtTo100thMM = 35.27777778; + +inline int PtTo10Mu( double nPoints ) { return (int)(((nPoints)*fPtTo100thMM)+0.5); } + +inline double TenMuToPt( double nUnits ) { return floor(((nUnits)/fPtTo100thMM)+0.5); } + + + +#endif // _SV_SALPRN_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salsys.h b/vcl/inc/ios/salsys.h new file mode 100644 index 000000000000..e586c8dfb356 --- /dev/null +++ b/vcl/inc/ios/salsys.h @@ -0,0 +1,56 @@ +/* -*- 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 _SV_SALSYS_H +#define _SV_SALSYS_H + +#include "salsys.hxx" + +class VCL_DLLPUBLIC IosSalSystem : public SalSystem +{ +public: + IosSalSystem() {} + virtual ~IosSalSystem(); + + // get info about the display + virtual unsigned int GetDisplayScreenCount(); + virtual bool IsMultiDisplay(); + virtual unsigned int GetDefaultDisplayNumber(); + virtual Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ); + 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); +}; + +#endif // _SV_SALSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/saltimer.h b/vcl/inc/ios/saltimer.h new file mode 100644 index 000000000000..b5974219437d --- /dev/null +++ b/vcl/inc/ios/saltimer.h @@ -0,0 +1,54 @@ +/* -*- 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 _SV_SALTIMER_H +#define _SV_SALTIMER_H + +#include "premac.h" +#include <Foundation/Foundation.h> +#include "postmac.h" + +#include "saltimer.hxx" + +class IosSalTimer : public SalTimer +{ + public: + + IosSalTimer(); + virtual ~IosSalTimer(); + + void Start( sal_uLong nMS ); + void Stop(); + + static NSTimer* pRunningTimer; + static bool bDispatchTimer; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/saluimenu.h b/vcl/inc/ios/saluimenu.h new file mode 100644 index 000000000000..ef54daa2d631 --- /dev/null +++ b/vcl/inc/ios/saluimenu.h @@ -0,0 +1,62 @@ +/* -*- 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_SALUIMENU_H +#define _VCL_SALUIMENU_H + +class IosSalMenu; +class IosSalMenuItem; + +@interface SalUIMenu : UIMenuController +{ + /* Caution: SalNSMenu instances occasionally are binary copied + in IosSalMenu::ShowNativePopupMenu. If any members are added, + please take this into account ! + */ + IosSalMenu* mpMenu; +} +-(id)initWithMenu: (IosSalMenu*)pMenu; +-(void)menuNeedsUpdate: (UIMenuController*)pMenu; +-(void)setSalMenu: (IosSalMenu*)pMenu; +@end + +@interface SalUIMenuItem : UIMenuItem +{ + /* Caution: SalUIMenuItem instances occasionally are binary copied + in IosSalMenu::ShowNativePopupMenu. If any members are added, + please take this into account ! + */ + IosSalMenuItem* mpMenuItem; +} +-(id)initWithMenuItem: (IosSalMenuItem*)pMenuItem; +-(void)menuItemTriggered: (id)aSender; +@end + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salvd.h b/vcl/inc/ios/salvd.h new file mode 100644 index 000000000000..e116c5c45bab --- /dev/null +++ b/vcl/inc/ios/salvd.h @@ -0,0 +1,79 @@ +/* -*- 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 _SV_SALVD_H +#define _SV_SALVD_H + +#include "ios/salcolorutils.hxx" +#include "ios/salgdi.h" + +#include "salvd.hxx" + +#if PRAGMA_ONCE + #pragma once +#endif + +struct SalVirDevData +{ +}; + +typedef struct SalVirDevData SalVirDevData; +typedef SalVirDevData *SalVirDevDataPtr; +typedef SalVirDevDataPtr *SalVirDevDataHandle; + +// ======================================================================= + +class IosSalGraphics; + +class IosSalVirtualDevice : public SalVirtualDevice +{ +private: + bool mbGraphicsUsed; // is Graphics used + bool mbForeignContext; // is mxContext from outside VCL + CGContextRef mxBitmapContext; + int mnBitmapDepth; + CGLayerRef mxLayer; // Quartz layer + IosSalGraphics* mpGraphics; // current VirDev graphics + + void Destroy(); + +public: + IosSalVirtualDevice( IosSalGraphics* pGraphic, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ); + virtual ~IosSalVirtualDevice(); + + virtual SalGraphics* GetGraphics(); + virtual void ReleaseGraphics( SalGraphics* pGraphics ); + virtual sal_Bool SetSize( long nNewDX, long nNewDY ); + virtual void GetSize( long& rWidth, long& rHeight ); +}; + +// ======================================================================= + +#endif // _SV_SALVD_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/svsys.h b/vcl/inc/ios/svsys.h new file mode 100644 index 000000000000..a8edcab96eef --- /dev/null +++ b/vcl/inc/ios/svsys.h @@ -0,0 +1,36 @@ +/* -*- 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 or as specified alternatively below. 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 Tor Lillqvist <tml@iki.fi> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * For minor contributions see the git repository. + * + * 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 _VCL_IOS_SVSYS_H +#define _VCL_IOS_SVSYS_H + + +// ? + +#endif // _VCL_IOS_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/vcluiapp.h b/vcl/inc/ios/vcluiapp.h new file mode 100644 index 000000000000..df4a01ead0de --- /dev/null +++ b/vcl/inc/ios/vcluiapp.h @@ -0,0 +1,53 @@ +/* -*- 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_VCLUIAPP_H +#define _VCL_VCLUIAPP_H + +#include "premac.h" +#include "UIKit/UIKit.h" +#include "postmac.h" + +class IosSalFrame; + +// our very own application +@interface VCL_UIApplication : UIApplication +{ +} +-(void)sendEvent:(UIEvent*)pEvent; +-(void)sendSuperEvent:(UIEvent*)pEvent; +-(BOOL)application: (UIApplication*) app openFile: (NSString*)file; +-(void)application: (UIApplication*) app openFiles: (NSArray*)files; +-(void)applicationWillTerminate: (UIApplication *) app; +-(void)addFallbackMenuItem: (UIMenuItem*)pNewItem; +-(void)removeFallbackMenuItem: (UIMenuItem*)pOldItem; +@end + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/list.h b/vcl/inc/list.h index 78c7edce2839..34e9cee266b1 100644 --- a/vcl/inc/list.h +++ b/vcl/inc/list.h @@ -66,8 +66,6 @@ extern "C" int listAtLast(list); int listPosition(list); /* Expensive! */ #endif -/*- search */ - int listFind(list, void *); /* Returns true/false */ /*- positioning functions */ /*- return the number of elements by which the current position in the list changes */ @@ -75,7 +73,6 @@ extern "C" int listSkipForward(list, int n); int listToFirst(list); int listToLast(list); - int listPositionAt(list, int n); /* Expensive! */ /*- adding and removing elements */ list listAppend(list, void *); diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index b91185769b27..9c727a895581 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -149,7 +149,6 @@ sal_UCS4 GetVerticalChar( sal_UCS4 ); // #i80090# GetMirroredChar also needed outside vcl, moved to svapp.hxx // VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 ); sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType ); -VCL_PLUGIN_PUBLIC const char* GetAutofallback( sal_UCS4 ) ; // ------------- // - SalLayout - diff --git a/vcl/inc/saltimer.hxx b/vcl/inc/saltimer.hxx index 38dd20e69ff3..11a90dc24bf1 100644 --- a/vcl/inc/saltimer.hxx +++ b/vcl/inc/saltimer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -67,3 +68,5 @@ public: }; #endif // _SV_SALTIMER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/svsys.h b/vcl/inc/svsys.h index df0b58c548ca..0976282bc898 100644 --- a/vcl/inc/svsys.h +++ b/vcl/inc/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. @@ -34,9 +35,15 @@ #include "aqua/svsys.h" #elif defined OS2 #include "os2/svsys.h" +#elif defined IOS +#include "ios/svsys.h" +#elif defined ANDROID +#include "android/svsys.h" #else #include "unx/svsys.h" #endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/Xproto.h b/vcl/inc/unx/Xproto.h index 804b3ffa98cc..b6db98dbfe15 100644 --- a/vcl/inc/unx/Xproto.h +++ b/vcl/inc/unx/Xproto.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. @@ -47,3 +48,5 @@ #include <tools/postx.h> #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 307a3f2b3e01..24860b8f80df 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -93,9 +93,8 @@ class GtkSalDisplay : public SalDisplay GdkDisplay* m_pGdkDisplay; GdkCursor *m_aCursors[ POINTER_COUNT ]; bool m_bStartupCompleted; - std::vector< int > m_aXineramaScreenIndexMap; - GdkCursor* getFromXPM( const unsigned char *pBitmap, const unsigned char *pMask, + GdkCursor* getFromXBM( const unsigned char *pBitmap, const unsigned char *pMask, int nWidth, int nHeight, int nXHot, int nYHot ); public: GtkSalDisplay( GdkDisplay* pDisplay ); diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 6caf39dc9644..78aea06017a8 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -30,6 +30,7 @@ #define _VCL_GTKFRAME_HXX #include <tools/prex.h> +#include <cairo/cairo.h> #include <gdk/gdk.h> #include <gdk/gdkx.h> #include <gtk/gtk.h> diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index 41e500c49027..83d4aa827da9 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -39,6 +39,8 @@ #if GTK_CHECK_VERSION(3,0,0) +#include <unx/headless/svpgdi.hxx> + // Disabled for gtk3 - use legacy theming code #define GTK_GRAPHICS_DISABLED class GtkSalFrame; @@ -46,7 +48,6 @@ class GtkSalGraphics : public X11SalGraphics { public: GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ); }; - #else class GtkSalGraphics : public X11SalGraphics diff --git a/vcl/unx/headless/svpbmp.hxx b/vcl/inc/unx/headless/svpbmp.hxx index b3adb3b9951f..b3adb3b9951f 100644 --- a/vcl/unx/headless/svpbmp.hxx +++ b/vcl/inc/unx/headless/svpbmp.hxx diff --git a/vcl/unx/headless/svpdummies.hxx b/vcl/inc/unx/headless/svpdummies.hxx index bc46e9b22f70..bc46e9b22f70 100644 --- a/vcl/unx/headless/svpdummies.hxx +++ b/vcl/inc/unx/headless/svpdummies.hxx diff --git a/vcl/unx/headless/svpelement.hxx b/vcl/inc/unx/headless/svpelement.hxx index c7f647cf3a03..c7f647cf3a03 100644 --- a/vcl/unx/headless/svpelement.hxx +++ b/vcl/inc/unx/headless/svpelement.hxx diff --git a/vcl/unx/headless/svpframe.hxx b/vcl/inc/unx/headless/svpframe.hxx index e57381780f61..e57381780f61 100644 --- a/vcl/unx/headless/svpframe.hxx +++ b/vcl/inc/unx/headless/svpframe.hxx diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/inc/unx/headless/svpgdi.hxx index 8291a3c2f7bc..8291a3c2f7bc 100644 --- a/vcl/unx/headless/svpgdi.hxx +++ b/vcl/inc/unx/headless/svpgdi.hxx diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/inc/unx/headless/svpinst.hxx index 6fcafe0c7f66..6fcafe0c7f66 100644 --- a/vcl/unx/headless/svpinst.hxx +++ b/vcl/inc/unx/headless/svpinst.hxx diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/inc/unx/headless/svpprn.hxx index f7e6a671f4b3..f7e6a671f4b3 100644 --- a/vcl/unx/headless/svpprn.hxx +++ b/vcl/inc/unx/headless/svpprn.hxx diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/inc/unx/headless/svppspgraphics.hxx index 1ce9109918d5..1ce9109918d5 100644 --- a/vcl/unx/headless/svppspgraphics.hxx +++ b/vcl/inc/unx/headless/svppspgraphics.hxx diff --git a/vcl/unx/headless/svpvd.hxx b/vcl/inc/unx/headless/svpvd.hxx index 211cf36846f9..211cf36846f9 100644 --- a/vcl/unx/headless/svpvd.hxx +++ b/vcl/inc/unx/headless/svpvd.hxx diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h index a389195308d3..0fa69ae5a72f 100644 --- a/vcl/inc/unx/salbmp.h +++ b/vcl/inc/unx/salbmp.h @@ -36,6 +36,7 @@ #include <unx/saldisp.hxx> #include <salbmp.hxx> #include <vclpluginapi.h> +#include <list> struct BitmapBuffer; class BitmapPalette; @@ -51,80 +52,118 @@ class VCLPLUG_GEN_PUBLIC X11SalBitmap : public SalBitmap { private: - static BitmapBuffer* ImplCreateDIB( const Size& rSize, - sal_uInt16 nBitCount, - const BitmapPalette& rPal ); - static BitmapBuffer* ImplCreateDIB( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - long nX, long nY, - long nWidth, long nHeight, - bool bGrey ); + static BitmapBuffer* ImplCreateDIB( + const Size& rSize, + sal_uInt16 nBitCount, + const BitmapPalette& rPal + ); + + static BitmapBuffer* ImplCreateDIB( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight, + bool bGrey + ); public: static ImplSalBitmapCache* mpCache; - static sal_uIntPtr mnCacheInstCount; + static sal_uIntPtr mnCacheInstCount; static void ImplCreateCache(); static void ImplDestroyCache(); void ImplRemovedFromCache(); bool SnapShot (Display* pDisplay, XLIB_Window hWindow); - bool ImplCreateFromXImage( Display* pDisplay, - XLIB_Window hWindow, - int nScreen, - XImage* pImage); + bool ImplCreateFromXImage( + Display* pDisplay, + XLIB_Window hWindow, + int nScreen, + XImage* pImage + ); private: - BitmapBuffer* mpDIB; ImplSalDDB* mpDDB; bool mbGrey; public: - SAL_DLLPRIVATE bool ImplCreateFromDrawable( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - long nX, long nY, - long nWidth, long nHeight ); - - SAL_DLLPRIVATE XImage* ImplCreateXImage( SalDisplay* pSalDisp, - int nScreen, long nDepth, - const SalTwoRect& rTwoRect ) const; - - SAL_DLLPRIVATE ImplSalDDB* ImplGetDDB( Drawable, int nScreen, long nDrawableDepth, - const SalTwoRect& ) const; - void ImplDraw( Drawable aDrawable, int nScreen, long nDrawableDepth, - const SalTwoRect& rTwoRect, const GC& rGC ) const; + SAL_DLLPRIVATE bool ImplCreateFromDrawable( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight + ); + + SAL_DLLPRIVATE XImage* ImplCreateXImage( + SalDisplay* pSalDisp, + int nScreen, + long nDepth, + const SalTwoRect& rTwoRect + ) const; + + SAL_DLLPRIVATE ImplSalDDB* ImplGetDDB( + Drawable, + int nScreen, + long nDrawableDepth, + const SalTwoRect& + ) const; + + void ImplDraw( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + const SalTwoRect& rTwoRect, + const GC& rGC + ) const; public: - X11SalBitmap(); - virtual ~X11SalBitmap(); + X11SalBitmap(); + virtual ~X11SalBitmap(); // overload pure virtual methods - virtual bool Create( const Size& rSize, - sal_uInt16 nBitCount, - const BitmapPalette& rPal ); - virtual bool Create( const SalBitmap& rSalBmp ); - virtual bool Create( const SalBitmap& rSalBmp, - 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, + virtual bool Create( + const Size& rSize, + sal_uInt16 nBitCount, + const BitmapPalette& rPal + ); + + virtual bool Create( const SalBitmap& rSalBmp ); + virtual bool Create( + const SalBitmap& rSalBmp, + 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 ); + bool bMask = false + ); - virtual void Destroy(); + virtual void Destroy(); - virtual Size GetSize() const; + virtual Size GetSize() const; virtual sal_uInt16 GetBitCount() const; - virtual BitmapBuffer* AcquireBuffer( bool bReadOnly ); - virtual void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); - virtual bool GetSystemData( BitmapSystemData& rData ); + virtual BitmapBuffer* AcquireBuffer( bool bReadOnly ); + virtual void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); + virtual bool GetSystemData( BitmapSystemData& rData ); }; // -------------- @@ -142,49 +181,81 @@ private: ImplSalDDB() {} - static void ImplDraw( Drawable aSrcDrawable, long nSrcDrawableDepth, - Drawable aDstDrawable, long nDstDrawableDepth, - long nSrcX, long nSrcY, - long nDestWidth, long nDestHeight, - long nDestX, long nDestY, const GC& rGC ); + static void ImplDraw( + Drawable aSrcDrawable, + long nSrcDrawableDepth, + Drawable aDstDrawable, + long nDstDrawableDepth, + long nSrcX, + long nSrcY, + long nDestWidth, + long nDestHeight, + long nDestX, + long nDestY, + const GC& rGC + ); public: - ImplSalDDB( XImage* pImage, - Drawable aDrawable, int nScreen, - const SalTwoRect& rTwoRect ); - ImplSalDDB( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - long nX, long nY, long nWidth, long nHeight ); - ImplSalDDB( Display* pDisplay, - XLIB_Window hWindow, - int nScreen, - XImage* pImage); + ImplSalDDB( + XImage* pImage, + Drawable aDrawable, + int nScreen, + const SalTwoRect& rTwoRect + ); + + ImplSalDDB( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight + ); + + ImplSalDDB( + Display* pDisplay, + XLIB_Window hWindow, + int nScreen, + XImage* pImage + ); + ~ImplSalDDB(); Pixmap ImplGetPixmap() const { return maPixmap; } long ImplGetWidth() const { return maTwoRect.mnDestWidth; } long ImplGetHeight() const { return maTwoRect.mnDestHeight; } long ImplGetDepth() const { return mnDepth; } - sal_uIntPtr ImplGetMemSize() const { return( ( maTwoRect.mnDestWidth * maTwoRect.mnDestHeight * mnDepth ) >> 3 ); } + sal_uIntPtr ImplGetMemSize() const + { + return( ( maTwoRect.mnDestWidth * maTwoRect.mnDestHeight * mnDepth ) >> 3 ); + } int ImplGetScreen() const { return mnScreen; } bool ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const; - void ImplDraw( Drawable aDrawable, long nDrawableDepth, - const SalTwoRect& rTwoRect, const GC& rGC ) const; + + void ImplDraw( + Drawable aDrawable, + long nDrawableDepth, + const SalTwoRect& rTwoRect, + const GC& rGC + ) const; }; // ---------------------- // - ImplSalBitmapCache - // ---------------------- +struct ImplBmpObj; + class ImplSalBitmapCache { private: + typedef ::std::list< ImplBmpObj* > BmpList_impl; - List maBmpList; - sal_uIntPtr mnTotalSize; + BmpList_impl maBmpList; + sal_uIntPtr mnTotalSize; public: @@ -198,47 +269,4 @@ public: #endif // _SV_SALBMP_HXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx index 7bce61cc9ce7..825c148cfa1f 100644 --- a/vcl/inc/unx/saldata.hxx +++ b/vcl/inc/unx/saldata.hxx @@ -46,7 +46,8 @@ class SalPrinter; // -=-= typedefs -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #if defined LINUX || defined NETBSD || defined AIX || \ - defined FREEBSD || defined OPENBSD || defined DRAGONFLY + defined FREEBSD || defined OPENBSD || defined DRAGONFLY || \ + defined ANDROID #include <pthread.h> #else typedef unsigned int pthread_t; diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index 6687762c1e9d..194e050df2b0 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -372,7 +372,7 @@ protected: KeySym nShiftKeySym_; // first shift modifier KeySym nCtrlKeySym_; // first control modifier KeySym nMod1KeySym_; // first mod1 modifier - ByteString m_aKeyboardName; + rtl::OString m_aKeyboardName; vcl_sal::WMAdaptor* m_pWMAdaptor; DtIntegrator* m_pDtIntegrator; @@ -420,8 +420,9 @@ public: bool DispatchInternalEvent(); void PrintInfo() const; - void PrintEvent( const ByteString &rComment, - XEvent *pEvent ) const; +#ifdef DBG_UTIL + void DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) const; +#endif void Beep() const; diff --git a/vcl/inc/unx/x11_cursors/salcursors.h b/vcl/inc/unx/x11_cursors/salcursors.h index e0d34e122336..6af2c111fb57 100644 --- a/vcl/inc/unx/x11_cursors/salcursors.h +++ b/vcl/inc/unx/x11_cursors/salcursors.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. @@ -160,3 +161,5 @@ #include "unx/x11_cursors/tblselsw_mask.h" #include "unx/x11_cursors/paintbrush_curs.h" #include "unx/x11_cursors/paintbrush_mask.h" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/accel.hxx b/vcl/inc/vcl/accel.hxx index a7bf623cb20a..79109e08cd4c 100644 --- a/vcl/inc/vcl/accel.hxx +++ b/vcl/inc/vcl/accel.hxx @@ -83,9 +83,6 @@ public: void InsertItem( sal_uInt16 nItemId, const KeyCode& rKeyCode ); void InsertItem( const ResId& rResId ); - void RemoveItem( sal_uInt16 nItemId ); - void RemoveItem( const KeyCode rKeyCode ); - void Clear(); sal_uInt16 GetCurItemId() const { return mnCurId; } const KeyCode& GetCurKeyCode() const { return maCurKeyCode; } @@ -94,22 +91,9 @@ public: sal_uInt16 GetItemCount() const; sal_uInt16 GetItemId( sal_uInt16 nPos ) const; - KeyCode GetItemKeyCode( sal_uInt16 nPos ) const; - sal_uInt16 GetItemId( const KeyCode& rKeyCode ) const; KeyCode GetKeyCode( sal_uInt16 nItemId ) const; - sal_Bool IsIdValid( sal_uInt16 nItemId ) const; - sal_Bool IsKeyCodeValid( const KeyCode rKeyCode ) const; - sal_Bool Call( const KeyCode& rKeyCode, sal_uInt16 nRepeat = 0 ); - void SetAccel( sal_uInt16 nItemId, Accelerator* pAccel ); Accelerator* GetAccel( sal_uInt16 nItemId ) const; - void SetAccel( const KeyCode rKeyCode, Accelerator* pAccel ); - Accelerator* GetAccel( const KeyCode rKeyCode ) const; - - void EnableItem( sal_uInt16 nItemId, sal_Bool bEnable = sal_True ); - sal_Bool IsItemEnabled( sal_uInt16 nItemId ) const; - void EnableItem( const KeyCode rKeyCode, sal_Bool bEnable = sal_True ); - sal_Bool IsItemEnabled( const KeyCode rKeyCode ) const; void SetHelpText( const XubString& rHelpText ) { maHelpStr = rHelpText; } const XubString& GetHelpText() const { return maHelpStr; } diff --git a/vcl/inc/vcl/animate.hxx b/vcl/inc/vcl/animate.hxx index e53a51e0e932..956f63f330f8 100644 --- a/vcl/inc/vcl/animate.hxx +++ b/vcl/inc/vcl/animate.hxx @@ -71,20 +71,25 @@ struct VCL_DLLPUBLIC AnimationBitmap Size aSizePix; long nWait; Disposal eDisposal; - sal_Bool bUserInput; + sal_Bool bUserInput; AnimationBitmap() {} - AnimationBitmap( const BitmapEx& rBmpEx, const Point& rPosPix, - const Size& rSizePix, long _nWait = 0L, - Disposal _eDisposal = DISPOSE_NOT ) : - aBmpEx ( rBmpEx ), - aPosPix ( rPosPix ), - aSizePix ( rSizePix ), - nWait ( _nWait ), - eDisposal ( _eDisposal ), - bUserInput ( sal_False ) {} - - sal_Bool operator==( const AnimationBitmap& rAnimBmp ) const + AnimationBitmap( + const BitmapEx& rBmpEx, + const Point& rPosPix, + const Size& rSizePix, + long _nWait = 0L, + Disposal _eDisposal = DISPOSE_NOT + ) : + aBmpEx ( rBmpEx ), + aPosPix ( rPosPix ), + aSizePix ( rSizePix ), + nWait ( _nWait ), + eDisposal ( _eDisposal ), + bUserInput ( sal_False ) + {} + + sal_Bool operator==( const AnimationBitmap& rAnimBmp ) const { return( rAnimBmp.aBmpEx == aBmpEx && rAnimBmp.aPosPix == aPosPix && @@ -94,9 +99,10 @@ struct VCL_DLLPUBLIC AnimationBitmap rAnimBmp.bUserInput == bUserInput ); } - sal_Bool operator!=( const AnimationBitmap& rAnimBmp ) const { return !( *this == rAnimBmp ); } + sal_Bool operator!=( const AnimationBitmap& rAnimBmp ) const + { return !( *this == rAnimBmp ); } - sal_Bool IsEqual( const AnimationBitmap& rAnimBmp ) const + sal_Bool IsEqual( const AnimationBitmap& rAnimBmp ) const { return( rAnimBmp.aPosPix == aPosPix && rAnimBmp.aSizePix == aSizePix && @@ -106,7 +112,7 @@ struct VCL_DLLPUBLIC AnimationBitmap rAnimBmp.aBmpEx.IsEqual( aBmpEx ) ); } - sal_uLong GetChecksum() const; + sal_uLong GetChecksum() const; }; // ------------------- @@ -125,8 +131,8 @@ struct AInfo OutputDevice* pOutDev; void* pViewData; long nExtraData; - sal_Bool bWithSize; - sal_Bool bPause; + sal_Bool bWithSize; + sal_Bool bPause; AInfo() : pOutDev( NULL ), pViewData( NULL ), @@ -139,28 +145,31 @@ struct AInfo // - AnimationBitmap - // ------------------- +class ImplAnimView; +typedef ::std::vector< AnimationBitmap* > AnimationBitmapList_impl; +typedef ::std::vector< ImplAnimView* > AnimViewList_impl; + class VCL_DLLPUBLIC Animation { - SAL_DLLPRIVATE static sal_uLong mnAnimCount; + SAL_DLLPRIVATE static sal_uLong mnAnimCount; - List maList; - List maAInfoList; + AnimationBitmapList_impl maList; + AnimViewList_impl maViewList; Link maNotifyLink; BitmapEx maBitmapEx; Timer maTimer; Size maGlobalSize; - List* mpViewList; void* mpExtraData; long mnLoopCount; long mnLoops; - long mnPos; + size_t mnPos; Disposal meLastDisposal; CycleMode meCycleMode; - sal_Bool mbFirst; - sal_Bool mbIsInAnimation; - sal_Bool mbWithSize; - sal_Bool mbLoopTerminated; - sal_Bool mbIsWaiting; + sal_Bool mbFirst; + sal_Bool mbIsInAnimation; + sal_Bool mbWithSize; + sal_Bool mbLoopTerminated; + sal_Bool mbIsWaiting; SAL_DLLPRIVATE void ImplRestartTimer( sal_uLong nTimeout ); @@ -170,7 +179,7 @@ public: SAL_DLLPRIVATE static void ImplIncAnimCount() { mnAnimCount++; } SAL_DLLPRIVATE static void ImplDecAnimCount() { mnAnimCount--; } - SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnPos; } + SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnPos; } public: @@ -179,28 +188,36 @@ public: ~Animation(); Animation& operator=( const Animation& rAnimation ); - sal_Bool operator==( const Animation& rAnimation ) const; - sal_Bool operator!=( const Animation& rAnimation ) const { return !(*this==rAnimation); } - - sal_Bool IsEqual( const Animation& rAnimation ) const; + sal_Bool operator==( const Animation& rAnimation ) const; + sal_Bool operator!=( const Animation& rAnimation ) const + { return !(*this==rAnimation); } - sal_Bool IsEmpty() const; + sal_Bool IsEmpty() const; void SetEmpty(); void Clear(); - sal_Bool Start( OutputDevice* pOutDev, const Point& rDestPt, long nExtraData = 0, - OutputDevice* pFirstFrameOutDev = NULL ); - sal_Bool Start( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz, long nExtraData = 0, - OutputDevice* pFirstFrameOutDev = NULL ); + sal_Bool Start( + OutputDevice* pOutDev, + const Point& rDestPt, + long nExtraData = 0, + OutputDevice* pFirstFrameOutDev = NULL + ); + sal_Bool Start( + OutputDevice* pOutDev, + const Point& rDestPt, + const Size& rDestSz, + long nExtraData = 0, + OutputDevice* pFirstFrameOutDev = NULL + ); void Stop( OutputDevice* pOutDev = NULL, long nExtraData = 0 ); void Draw( OutputDevice* pOutDev, const Point& rDestPt ) const; void Draw( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz ) const; - sal_Bool IsInAnimation() const { return mbIsInAnimation; } - sal_Bool IsTransparent() const; - sal_Bool IsTerminated() const { return mbLoopTerminated; } + sal_Bool IsInAnimation() const { return mbIsInAnimation; } + sal_Bool IsTransparent() const; + sal_Bool IsTerminated() const { return mbLoopTerminated; } const Size& GetDisplaySizePixel() const { return maGlobalSize; } void SetDisplaySizePixel( const Size& rSize ) { maGlobalSize = rSize; } @@ -208,7 +225,7 @@ public: const BitmapEx& GetBitmapEx() const { return maBitmapEx; } void SetBitmapEx( const BitmapEx& rBmpEx ) { maBitmapEx = rBmpEx; } - sal_uLong GetLoopCount() const { return mnLoopCount; } + sal_uLong GetLoopCount() const { return mnLoopCount; } void SetLoopCount( const sal_uLong nLoopCount ); void ResetLoopCount(); @@ -218,36 +235,40 @@ public: void SetNotifyHdl( const Link& rLink ) { maNotifyLink = rLink; } const Link& GetNotifyHdl() const { return maNotifyLink; } - sal_uInt16 Count() const { return (sal_uInt16) maList.Count(); } - sal_Bool Insert( const AnimationBitmap& rAnimationBitmap ); + size_t Count() const { return maList.size(); } + sal_Bool Insert( const AnimationBitmap& rAnimationBitmap ); const AnimationBitmap& Get( sal_uInt16 nAnimation ) const; void Replace( const AnimationBitmap& rNewAnimationBmp, sal_uInt16 nAnimation ); - List* GetAInfoList() { return &maAInfoList; } - sal_uLong GetSizeBytes() const; - sal_uLong GetChecksum() const; + sal_uLong GetSizeBytes() const; + sal_uLong GetChecksum() const; public: - sal_Bool Convert( BmpConversion eConversion ); - sal_Bool ReduceColors( sal_uInt16 nNewColorCount, - BmpReduce eReduce = BMP_REDUCE_SIMPLE ); - sal_Bool Invert(); - sal_Bool Mirror( sal_uLong nMirrorFlags ); - sal_Bool Dither( sal_uLong nDitherFlags = BMP_DITHER_MATRIX ); - sal_Bool 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 ); - sal_Bool Filter( BmpFilter eFilter, - const BmpFilterParam* pFilterParam = NULL, - const Link* pProgress = NULL ); - - friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, Animation& rAnimation ); - friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const Animation& rAnimation ); + sal_Bool Convert( BmpConversion eConversion ); + sal_Bool ReduceColors( + sal_uInt16 nNewColorCount, + BmpReduce eReduce = BMP_REDUCE_SIMPLE + ); + sal_Bool Invert(); + sal_Bool Mirror( sal_uLong nMirrorFlags ); + sal_Bool 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 + ); + sal_Bool Filter( + BmpFilter eFilter, + const BmpFilterParam* pFilterParam = NULL, + const Link* pProgress = NULL + ); + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, Animation& rAnimation ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const Animation& rAnimation ); }; #endif // _SV_ANIMATE_HXX diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx index e25bb482f53c..a6ff3129fada 100644 --- a/vcl/inc/vcl/bitmap.hxx +++ b/vcl/inc/vcl/bitmap.hxx @@ -234,7 +234,7 @@ struct BitmapSystemData #if defined( WNT ) void* pDIB; // device independent byte buffer void* pDDB; // if not NULL then this is actually an HBITMAP - #elif defined( QUARTZ ) + #elif defined( QUARTZ ) || defined( IOS ) void* rImageContext; //Image context (CGContextRef) #else void* aPixmap; diff --git a/vcl/inc/vcl/canvastools.hxx b/vcl/inc/vcl/canvastools.hxx index e82d397a92f0..ce6c7bcafe68 100644 --- a/vcl/inc/vcl/canvastools.hxx +++ b/vcl/inc/vcl/canvastools.hxx @@ -144,11 +144,6 @@ namespace vcl ::BitmapEx VCL_DLLPUBLIC bitmapExFromXBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerReadOnlyBitmap >& xInputBitmap ); - /** get a unique identifier for identification in XUnoTunnel interface - */ - enum TunnelIdentifierType { Id_BitmapEx = 0 }; - const com::sun::star::uno::Sequence< sal_Int8 > VCL_DLLPUBLIC getTunnelIdentifier( TunnelIdentifierType eType ); - // Color conversions (vcl/tools Color <-> canvas standard color space) // =================================================================== diff --git a/vcl/inc/vcl/displayconnectiondispatch.hxx b/vcl/inc/vcl/displayconnectiondispatch.hxx index fea1d0b7cba9..0804c9111153 100644 --- a/vcl/inc/vcl/displayconnectiondispatch.hxx +++ b/vcl/inc/vcl/displayconnectiondispatch.hxx @@ -1,3 +1,4 @@ +/* -*- 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 @@ protected: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/field.hxx b/vcl/inc/vcl/field.hxx index fd0ce90cb0d7..4af5e1a6128b 100644 --- a/vcl/inc/vcl/field.hxx +++ b/vcl/inc/vcl/field.hxx @@ -111,7 +111,7 @@ public: class VCL_DLLPUBLIC PatternFormatter : public FormatterBase { private: - ByteString maEditMask; + rtl::OString m_aEditMask; XubString maFieldString; XubString maLiteralMask; sal_uInt16 mnFormatFlags; @@ -122,7 +122,8 @@ protected: PatternFormatter(); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); - SAL_DLLPRIVATE void ImplSetMask( const ByteString& rEditMask, const XubString& rLiteralMask ); + SAL_DLLPRIVATE void ImplSetMask(const rtl::OString& rEditMask, + const XubString& rLiteralMask); SAL_DLLPRIVATE sal_Bool ImplIsSameMask() const { return mbSameMask; } SAL_DLLPRIVATE sal_Bool& ImplGetInPattKeyInput() { return mbInPattKeyInput; } @@ -131,9 +132,8 @@ public: virtual void Reformat(); - void SetMask( const ByteString& rEditMask, - const XubString& rLiteralMask ); - const ByteString& GetEditMask() const { return maEditMask; } + void SetMask(const rtl::OString& rEditMask, const XubString& rLiteralMask ); + const rtl::OString& GetEditMask() const { return m_aEditMask; } const XubString& GetLiteralMask() const { return maLiteralMask; } void SetFormatFlags( sal_uInt16 nFlags ) { mnFormatFlags = nFlags; } @@ -475,8 +475,6 @@ public: void SetTime( const Time& rNewTime ); void SetUserTime( const Time& rNewTime ); Time GetTime() const; - Time GetRealTime() const; - sal_Bool IsTimeModified() const; void SetEmptyTime() { FormatterBase::SetEmptyFieldValue(); } sal_Bool IsEmptyTime() const { return FormatterBase::IsEmptyFieldValue(); } Time GetCorrectedTime() const { return maCorrectedTime; } @@ -866,7 +864,6 @@ class VCL_DLLPUBLIC TimeBox : public ComboBox, public TimeFormatter { public: TimeBox( Window* pParent, WinBits nWinStyle ); - TimeBox( Window* pParent, const ResId& rResId ); ~TimeBox(); virtual long PreNotify( NotifyEvent& rNEvt ); @@ -876,12 +873,6 @@ public: virtual void Modify(); virtual void ReformatAll(); - - void InsertTime( const Time& rTime, sal_uInt16 nPos = COMBOBOX_APPEND ); - void RemoveTime( const Time& rTime ); - using TimeFormatter::GetTime; - Time GetTime( sal_uInt16 nPos ) const; - sal_uInt16 GetTimePos( const Time& rTime ) const; }; #endif // _SV_FIELD_HXX diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx index 145c4d0a2169..467297668b5a 100644 --- a/vcl/inc/vcl/fontmanager.hxx +++ b/vcl/inc/vcl/fontmanager.hxx @@ -333,7 +333,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager void getFontAttributesFromXLFD( PrintFont* pFont, const std::list< rtl::OString >& rXLFDs ) const; - bool analyzeFontFile( int nDirID, const rtl::OString& rFileName, const std::list< rtl::OString >& rXLFDs, std::list< PrintFont* >& rNewFonts ) const; + bool analyzeFontFile( int nDirID, const rtl::OString& rFileName, const std::list< rtl::OString >& rXLFDs, std::list< PrintFont* >& rNewFonts, const char *pFormat=NULL ) const; rtl::OUString convertTrueTypeName( void* pNameRecord ) const; // actually a NameRecord* formt font subsetting code void analyzeTrueTypeFamilyName( void* pTTFont, std::list< rtl::OUString >& rnames ) const; // actually a TrueTypeFont* from font subsetting code bool analyzeTrueTypeFile( PrintFont* pFont ) const; diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx index 86f8dc5cbc77..e15a536ced0f 100644 --- a/vcl/inc/vcl/gdimtf.hxx +++ b/vcl/inc/vcl/gdimtf.hxx @@ -291,4 +291,4 @@ MetaCommentAction* makePluggableRendererAction( const rtl::OUString& rRendererSe #endif // _SV_GDIMTF_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/graph.hxx b/vcl/inc/vcl/graph.hxx index 61da922acce6..2ca801cfb97b 100644 --- a/vcl/inc/vcl/graph.hxx +++ b/vcl/inc/vcl/graph.hxx @@ -178,8 +178,6 @@ public: sal_uLong GetAnimationLoopCount() const; void ResetAnimationLoopCount(); - List* GetAnimationInfoList() const; - sal_uLong GetChecksum() const; public: @@ -222,4 +220,4 @@ public: #endif // _SV_GRAPH_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/graphictools.hxx b/vcl/inc/vcl/graphictools.hxx index edd29ab9db01..333c9163d57a 100644 --- a/vcl/inc/vcl/graphictools.hxx +++ b/vcl/inc/vcl/graphictools.hxx @@ -424,18 +424,6 @@ public: void setHatchType ( HatchType aHatchType ); /// Set color used for drawing the hatch void setHatchColor ( Color aHatchColor ); - /// Set type of gradient used - void setGradientType ( GradientType aGradType ); - /// Set start color of the gradient - void setGradient1stColor ( Color aColor ); - /// Set end color of the gradient - void setGradient2ndColor ( Color aColor ); - /** Set the numbers of steps to render the gradient. - - @param aCount - The step count. gradientStepsInfinite means use infinitely many. - */ - void setGradientStepCount( int aCount ); /// Set the texture graphic used void setGraphic ( const Graphic& rGraphic ); diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx index ce7d1baf4fd6..54cdea8ccb25 100644 --- a/vcl/inc/vcl/help.hxx +++ b/vcl/inc/vcl/help.hxx @@ -86,14 +86,12 @@ public: static void EnableContextHelp(); static void DisableContextHelp(); static sal_Bool IsContextHelpEnabled(); - static sal_Bool StartContextHelp(); static void EnableExtHelp(); static void DisableExtHelp(); static sal_Bool IsExtHelpEnabled(); static sal_Bool StartExtHelp(); static sal_Bool EndExtHelp(); - static sal_Bool IsExtHelpActive(); static void EnableBalloonHelp(); static void DisableBalloonHelp(); diff --git a/vcl/inc/vcl/image.hxx b/vcl/inc/vcl/image.hxx index d536d6bd03d7..301af44bead9 100644 --- a/vcl/inc/vcl/image.hxx +++ b/vcl/inc/vcl/image.hxx @@ -87,9 +87,6 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > GetXGraphic() const; Image GetColorTransformedImage( ImageColorTransform eColorTransform ) const; - static void GetColorTransformArrays( ImageColorTransform eColorTransform, Color*& rpSrcColor, Color*& rpDstColor, sal_uLong& rColorCount ); - - void Invert(); sal_Bool operator!() const { return( !mpImplData ? true : false ); } Image& operator=( const Image& rImage ); diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index b0d694c5e75e..78c7ad938d1a 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -282,6 +282,9 @@ class VirtualDevice; class Printer; class ImplFontSelectData; class ImplFontMetricData; +class VCLXGraphics; + +typedef ::std::vector< VCLXGraphics* > VCLXGraphicsList_impl; const char* ImplDbgCheckOutputDevice( const void* pObj ); @@ -305,17 +308,17 @@ private: mutable SalGraphics* mpGraphics; mutable OutputDevice* mpPrevGraphics; mutable OutputDevice* mpNextGraphics; - GDIMetaFile* mpMetaFile; + GDIMetaFile* mpMetaFile; mutable ImplFontEntry* mpFontEntry; mutable ImplFontCache* mpFontCache; mutable ImplDevFontList* mpFontList; mutable ImplGetDevFontList* mpGetDevFontList; mutable ImplGetDevSizeList* mpGetDevSizeList; - ImplObjStack* mpObjStack; - ImplOutDevData* mpOutDevData; - List* mpUnoGraphicsList; - vcl::PDFWriterImpl* mpPDFWriter; - vcl::ExtOutDevData* mpExtOutDevData; + ImplObjStack* mpObjStack; + ImplOutDevData* mpOutDevData; + VCLXGraphicsList_impl* mpUnoGraphicsList; + vcl::PDFWriterImpl* mpPDFWriter; + vcl::ExtOutDevData* mpExtOutDevData; // TEMP TEMP TEMP VirtualDevice* mpAlphaVDev; @@ -1141,8 +1144,12 @@ public: ::com::sun::star::rendering::XCanvas > GetCanvas() const; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > CreateUnoGraphics(); - List* GetUnoGraphicsList() const { return mpUnoGraphicsList; } - List* CreateUnoGraphicsList() { mpUnoGraphicsList = new List; return mpUnoGraphicsList; } + VCLXGraphicsList_impl* GetUnoGraphicsList() const { return mpUnoGraphicsList; } + VCLXGraphicsList_impl* CreateUnoGraphicsList() + { + mpUnoGraphicsList = new VCLXGraphicsList_impl(); + return mpUnoGraphicsList; + } static void BeginFontSubstitution(); static void EndFontSubstitution(); diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx index 7082c020c7a2..474d847e2607 100644 --- a/vcl/inc/vcl/ppdparser.hxx +++ b/vcl/inc/vcl/ppdparser.hxx @@ -186,12 +186,12 @@ private: PPDParser( const String& rFile ); ~PPDParser(); - void parseOrderDependency( const ByteString& rLine ); - void parseOpenUI( const ByteString& rLine ); - void parseConstraint( const ByteString& rLine ); - void parse( std::list< ByteString >& rLines ); + void parseOrderDependency(const rtl::OString& rLine); + void parseOpenUI(const rtl::OString& rLine); + void parseConstraint(const rtl::OString& rLine); + void parse( std::list< rtl::OString >& rLines ); - String handleTranslation( const ByteString& i_rString, bool i_bIsGlobalized ); + String handleTranslation(const rtl::OString& i_rString, bool i_bIsGlobalized); static void scanPPDDir( const String& rDir ); static void initPPDFiles(); diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index 182258aeb3c1..120198328e49 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -265,14 +265,12 @@ private: SAL_DLLPRIVATE void ImplUpdatePageData(); SAL_DLLPRIVATE void ImplUpdateFontList(); SAL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup&, bool bMatchNearest ); - DECL_DLLPRIVATE_LINK( ImplDestroyPrinterAsync, void* ); SAL_DLLPRIVATE bool StartJob( const rtl::OUString& rJobName, boost::shared_ptr<vcl::PrinterController>& ); static SAL_DLLPRIVATE sal_uLong ImplSalPrinterErrorCodeToVCL( sal_uLong nError ); private: - SAL_DLLPRIVATE void ImplEndPrint(); SAL_DLLPRIVATE sal_Bool EndJob(); SAL_DLLPRIVATE Printer( const Printer& rPrinter ); SAL_DLLPRIVATE Printer& operator =( const Printer& rPrinter ); @@ -281,7 +279,6 @@ public: SAL_DLLPRIVATE void ImplEndPage(); public: void DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const Gradient& rGradient ); - void DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, const Gradient& rGradient ); protected: @@ -290,7 +287,6 @@ protected: public: Printer(); - Printer( const Window* pWindow ); Printer( const JobSetup& rJobSetup ); Printer( const QueueInfo& rQueueInfo ); Printer( const XubString& rPrinterName ); @@ -329,7 +325,6 @@ public: sal_Bool SetOrientation( Orientation eOrient ); Orientation GetOrientation() const; - DuplexMode GetDuplexMode() const; sal_Bool SetDuplexMode( DuplexMode ); // returns the angle that a landscape page will be turned counterclockwise // wrt to portrait. The return value may be only valid for @@ -363,7 +358,6 @@ public: sal_Bool IsPrinting() const { return mbPrinting; } - sal_Bool AbortJob(); const XubString& GetCurJobName() const { return maJobName; } sal_uInt16 GetCurPage() const { return mnCurPage; } sal_Bool IsJobActive() const { return mbJobActive; } diff --git a/vcl/inc/vcl/quickselectionengine.hxx b/vcl/inc/vcl/quickselectionengine.hxx index f70736428010..d3dc157d2c6c 100644 --- a/vcl/inc/vcl/quickselectionengine.hxx +++ b/vcl/inc/vcl/quickselectionengine.hxx @@ -1,3 +1,4 @@ +/* -*- 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 @@ namespace vcl //........................................................................ #endif // VCL_QUICKSELECTIONENGINE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/rendergraphic.hxx b/vcl/inc/vcl/rendergraphic.hxx index 0a0f475decd6..bee2abf4f6f1 100644 --- a/vcl/inc/vcl/rendergraphic.hxx +++ b/vcl/inc/vcl/rendergraphic.hxx @@ -1,3 +1,4 @@ +/* -*- 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 @@ namespace vcl } #endif // _SV_RENDERHRAPHIC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/rendergraphicrasterizer.hxx b/vcl/inc/vcl/rendergraphicrasterizer.hxx index f2166b03ffb3..0f564a635beb 100644 --- a/vcl/inc/vcl/rendergraphicrasterizer.hxx +++ b/vcl/inc/vcl/rendergraphicrasterizer.hxx @@ -1,3 +1,4 @@ +/* -*- 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,3 +110,5 @@ namespace vcl } #endif // _SV_RENDERGRAPHICRASTERIZER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index 0ade4c63f295..2494f4fa5d08 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -713,7 +713,6 @@ public: { CopyData(); mpData->mnHighContrast = bHighContrast; } sal_Bool GetHighContrastMode() const { return (sal_Bool) mpData->mnHighContrast; } - sal_Bool IsHighContrastBlackAndWhite() const; void SetUseSystemUIFonts( sal_Bool bUseSystemUIFonts ) { CopyData(); mpData->mnUseSystemUIFonts = bUseSystemUIFonts; } sal_Bool GetUseSystemUIFonts() const diff --git a/vcl/inc/vcl/strhelper.hxx b/vcl/inc/vcl/strhelper.hxx index 450139b0ba14..62e4fc072bdd 100644 --- a/vcl/inc/vcl/strhelper.hxx +++ b/vcl/inc/vcl/strhelper.hxx @@ -38,17 +38,17 @@ namespace psp { String VCL_DLLPUBLIC GetCommandLineToken( int, const String& ); -ByteString VCL_DLLPUBLIC GetCommandLineToken( int, const ByteString& ); +rtl::OString VCL_DLLPUBLIC GetCommandLineToken(int, const rtl::OString&); // gets one token of a unix command line style string // doublequote, singlequote and singleleftquote protect their respective // contents int VCL_DLLPUBLIC GetCommandLineTokenCount( const String& ); -int VCL_DLLPUBLIC GetCommandLineTokenCount( const ByteString& ); +int VCL_DLLPUBLIC GetCommandLineTokenCount(const rtl::OString&); // returns number of tokens (zero if empty or whitespace only) String VCL_DLLPUBLIC WhitespaceToSpace( const String&, sal_Bool bProtect = sal_True ); -ByteString VCL_DLLPUBLIC WhitespaceToSpace( const ByteString&, sal_Bool bProtect = sal_True ); +rtl::OString VCL_DLLPUBLIC WhitespaceToSpace(const rtl::OString&, sal_Bool bProtect = sal_True); // 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 @@ -58,14 +58,12 @@ ByteString VCL_DLLPUBLIC WhitespaceToSpace( const ByteString&, sal_Bool bProtect // parses the first double in the string; decimal is '.' only inline double VCL_DLLPUBLIC StringToDouble( const String& rStr ) { - rtl_math_ConversionStatus eStatus; - return rtl::math::stringToDouble( rStr, sal_Unicode('.'), sal_Unicode(0), &eStatus, NULL); + return rtl::math::stringToDouble(rStr, sal_Unicode('.'), sal_Unicode(0)); } -inline double VCL_DLLPUBLIC StringToDouble( const ByteString& rStr ) +inline double VCL_DLLPUBLIC StringToDouble(const rtl::OString& rStr) { - rtl_math_ConversionStatus eStatus; - return rtl::math::stringToDouble( rtl::OStringToOUString( rStr, osl_getThreadTextEncoding() ), sal_Unicode('.'), sal_Unicode(0), &eStatus, NULL); + return rtl::math::stringToDouble(rStr, '.', static_cast<sal_Char>(0)); } // fills a character buffer with the string representation of a double diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx index 85e902161a48..b233a3c07c03 100644 --- a/vcl/inc/vcl/svapp.hxx +++ b/vcl/inc/vcl/svapp.hxx @@ -161,14 +161,12 @@ inline sal_Bool ApplicationAddress::IsConnectToSame( const ApplicationAddress& r #define APPEVENT_OPEN_STRING "Open" #define APPEVENT_PRINT_STRING "Print" -#define APPEVENT_DISKINSERT_STRING "DiskInsert" -#define APPEVENT_SAVEDOCUMENTS_STRING "SaveDocuments" class VCL_DLLPUBLIC ApplicationEvent { private: UniString aSenderAppName; // Absender Applikationsname - ByteString aEvent; // Event + rtl::OString m_aEvent; // Event UniString aData; // Uebertragene Daten ApplicationAddress aAppAddr; // Absender Addresse @@ -176,57 +174,29 @@ public: ApplicationEvent() {} ApplicationEvent( const UniString& rSenderAppName, const ApplicationAddress& rAppAddr, - const ByteString& rEvent, + const rtl::OString& rEvent, const UniString& rData ); const UniString& GetSenderAppName() const { return aSenderAppName; } - const ByteString& GetEvent() const { return aEvent; } + const rtl::OString& GetEvent() const { return m_aEvent; } const UniString& GetData() const { return aData; } const ApplicationAddress& GetAppAddress() const { return aAppAddr; } - sal_Bool IsOpenEvent() const; - sal_Bool IsPrintEvent() const; - sal_Bool IsDiskInsertEvent() const; - sal_uInt16 GetParamCount() const { return aData.GetTokenCount( APPEVENT_PARAM_DELIMITER ); } UniString GetParam( sal_uInt16 nParam ) const { return aData.GetToken( nParam, APPEVENT_PARAM_DELIMITER ); } }; inline ApplicationEvent::ApplicationEvent( const UniString& rSenderAppName, const ApplicationAddress& rAppAddr, - const ByteString& rEvent, + const rtl::OString& rEvent, const UniString& rData ) : aSenderAppName( rSenderAppName ), - aEvent( rEvent ), + m_aEvent( rEvent ), aData( rData ), aAppAddr( rAppAddr ) { } -inline sal_Bool ApplicationEvent::IsOpenEvent() const -{ - if ( aEvent.Equals( APPEVENT_OPEN_STRING )) - return sal_True; - else - return sal_False; -} - -inline sal_Bool ApplicationEvent::IsPrintEvent() const -{ - if ( aEvent.Equals( APPEVENT_PRINT_STRING )) - return sal_True; - else - return sal_False; -} - -inline sal_Bool ApplicationEvent::IsDiskInsertEvent() const -{ - if ( aEvent.Equals( APPEVENT_DISKINSERT_STRING )) - return sal_True; - else - return sal_False; -} - class VCL_DLLPUBLIC PropertyHandler { public: @@ -262,8 +232,6 @@ public: virtual void InitFinished(); virtual void DeInit(); - static void InitAppRes( const ResId& rResId ); - static sal_uInt16 GetCommandLineParamCount(); static XubString GetCommandLineParam( sal_uInt16 nParam ); static const XubString& GetAppFileName(); @@ -286,7 +254,6 @@ public: static sal_Bool IsInMain(); static sal_Bool IsInExecute(); - static sal_Bool IsShutDown(); static sal_Bool IsInModalMode(); static sal_uInt16 GetModalModeCount(); @@ -294,7 +261,6 @@ public: static sal_Bool AnyInput( sal_uInt16 nType = INPUT_ANY ); static sal_uLong GetLastInputInterval(); static sal_Bool IsUICaptured(); - static sal_Bool IsUserActive( sal_uInt16 nTest = USERACTIVE_ALL ); virtual void SystemSettingsChanging( AllSettings& rSettings, Window* pFrame ); @@ -387,16 +353,11 @@ public: static sal_Bool InsertAccel( Accelerator* pAccel ); static void RemoveAccel( Accelerator* pAccel ); - static void FlushAccel(); static sal_Bool CallAccel( const KeyCode& rKeyCode, sal_uInt16 nRepeat = 0 ); - static sal_uLong AddHotKey( const KeyCode& rKeyCode, const Link& rLink, void* pData = NULL ); - static void RemoveHotKey( sal_uLong nId ); static sal_uLong AddEventHook( VCLEventHookProc pProc, void* pData = NULL ); static void RemoveEventHook( sal_uLong nId ); static long CallEventHooks( NotifyEvent& rEvt ); - static long CallPreNotify( NotifyEvent& rEvt ); - static long CallEvent( NotifyEvent& rEvt ); static void SetHelp( Help* pHelp = NULL ); static Help* GetHelp(); @@ -409,7 +370,6 @@ public: static sal_uLong GetReservedKeyCodeCount(); static const KeyCode* GetReservedKeyCode( sal_uLong i ); - static String GetReservedKeyCodeDescription( sal_uLong i ); static void SetDefDialogParent( Window* pWindow ); static Window* GetDefDialogParent(); @@ -421,9 +381,7 @@ public: static sal_uInt16 GetSystemWindowMode(); static void SetDialogScaleX( short nScale ); - static short GetDialogScaleX(); - static void SetFontPath( const String& rPath ); static const String& GetFontPath(); static UniqueItemId CreateUniqueId(); @@ -438,8 +396,6 @@ public: static void SetFilterHdl( const Link& rLink ); static const Link& GetFilterHdl(); - static sal_Bool IsAccessibilityEnabled(); - static void EnableHeadlessMode( sal_Bool bEnable = sal_True ); static sal_Bool IsHeadlessModeEnabled(); diff --git a/vcl/inc/vcl/svgread.hxx b/vcl/inc/vcl/svgread.hxx index 4427198eeb5a..cf4f8008c7ef 100644 --- a/vcl/inc/vcl/svgread.hxx +++ b/vcl/inc/vcl/svgread.hxx @@ -80,4 +80,4 @@ namespace vcl #endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/syschild.hxx b/vcl/inc/vcl/syschild.hxx index 275e41312f17..3a55d0b45a2c 100644 --- a/vcl/inc/vcl/syschild.hxx +++ b/vcl/inc/vcl/syschild.hxx @@ -63,7 +63,6 @@ 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(); 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 diff --git a/vcl/inc/vcl/sysdata.hxx b/vcl/inc/vcl/sysdata.hxx index cab614841e1d..b5daf28e579d 100644 --- a/vcl/inc/vcl/sysdata.hxx +++ b/vcl/inc/vcl/sysdata.hxx @@ -41,6 +41,18 @@ typedef struct CGLayer *CGLayerRef; class NSView; #endif #endif + +#ifdef IOS +typedef struct CGFont *CGFontRef; +typedef struct CGContext *CGContextRef; +typedef struct CGLayer *CGLayerRef; +#ifdef __OBJC__ +@class UIView; +#else +class UIView; +#endif +#endif + #if defined( WNT ) #include <windef.h> #endif @@ -56,6 +68,8 @@ struct SystemEnvData HWND hWnd; // the window hwnd #elif defined( QUARTZ ) NSView* pView; // the cocoa (NSView *) implementing this object +#elif defined( IOS ) + UIView* pView; // the CocoaTouch (UIView *) implementing this object #elif defined( UNX ) void* pDisplay; // the relevant display connection long aWindow; // the window of the object @@ -84,6 +98,8 @@ struct SystemParentData HWND hWnd; // the window hwnd #elif defined( QUARTZ ) NSView* pView; // the cocoa (NSView *) implementing this object +#elif defined( IOS ) + UIView* pView; // the CocoaTouch (UIView *) implementing this object #elif defined( UNX ) long aWindow; // the window of the object bool bXEmbedSupport:1; // decides whether the object in question @@ -116,8 +132,8 @@ struct SystemGraphicsData unsigned long nSize; // size in bytes of this structure #if defined( WNT ) HDC hDC; // handle to a device context -#elif defined( QUARTZ ) - CGContextRef rCGContext; // QUARTZ graphic context +#elif defined( QUARTZ ) || defined( IOS ) + CGContextRef rCGContext; // CoreGraphics graphic context #elif defined( UNX ) void* pDisplay; // the relevant display connection long hDrawable; // a drawable @@ -139,6 +155,7 @@ struct SystemWindowData unsigned long nSize; // size in bytes of this structure #if defined( WNT ) // meaningless on Windows #elif defined( QUARTZ ) // meaningless on Mac OS X / Quartz +#elif defined( IOS ) // and maybe on iOS, too, then #elif defined( UNX ) void* pVisual; // the visual to be used #endif @@ -169,6 +186,8 @@ struct SystemFontData HFONT hFont; // native font object #elif defined( QUARTZ ) void* aATSUFontID; // native font object +#elif defined( IOS ) + CGFontRef rFont; // native font object #elif defined( UNX ) void* nFontId; // native font id int nFontFlags; // native font flags diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx index 0fd2fd8d1512..19cce93d44dd 100644 --- a/vcl/inc/vcl/syswin.hxx +++ b/vcl/inc/vcl/syswin.hxx @@ -204,10 +204,6 @@ public: // for systems like MacOSX which can display the URL a document is loaded from // separately from the window title void SetRepresentedURL( const rtl::OUString& ); - const rtl::OUString& GetRepresentedURL() const; - - void SetZLevel( sal_uInt8 nLevel ); - sal_uInt8 GetZLevel() const; void EnableSaveBackground( sal_Bool bSave = sal_True ); sal_Bool IsSaveBackgroundEnabled() const; @@ -231,8 +227,8 @@ public: const Size& GetMaxOutputSizePixel() const; Size GetResizeOutputSizePixel() const; - void SetWindowState( const ByteString& rStr ); - ByteString GetWindowState( sal_uLong nMask = WINDOWSTATE_MASK_ALL ) const; + void SetWindowState(const rtl::OString& rStr); + rtl::OString GetWindowState(sal_uLong nMask = WINDOWSTATE_MASK_ALL) const; void SetMenuBar( MenuBar* pMenuBar ); MenuBar* GetMenuBar() const { return mpMenuBar; } diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index c6525138f73b..380fb2e70883 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -158,7 +158,6 @@ public: void SetTabPage( sal_uInt16 nPageId, TabPage* pPage ); TabPage* GetTabPage( sal_uInt16 nPageId ) const; - sal_uInt16 GetTabPageResId( sal_uInt16 nPageId ) const; void SetPageText( sal_uInt16 nPageId, const XubString& rText ); XubString GetPageText( sal_uInt16 nPageId ) const; @@ -166,11 +165,9 @@ public: void SetHelpText( sal_uInt16 nPageId, const XubString& rText ); const XubString& GetHelpText( sal_uInt16 nPageId ) const; - void SetHelpId( sal_uInt16 nPageId, const rtl::OString& rHelpId ); rtl::OString GetHelpId( sal_uInt16 nPageId ) const; void SetPageImage( sal_uInt16 nPageId, const Image& rImage ); - const Image* GetPageImage( sal_uInt16 nPageId ) const; void SetHelpText( const XubString& rText ) { Control::SetHelpText( rText ); } diff --git a/vcl/inc/vcl/taskpanelist.hxx b/vcl/inc/vcl/taskpanelist.hxx index 102f755554f2..9042169e9898 100644 --- a/vcl/inc/vcl/taskpanelist.hxx +++ b/vcl/inc/vcl/taskpanelist.hxx @@ -37,7 +37,6 @@ class VCL_DLLPUBLIC TaskPaneList { ::std::vector<Window *> mTaskPanes; - Window *FindNextPane( Window *pWindow, sal_Bool bForward = sal_True ); Window *FindNextFloat( Window *pWindow, sal_Bool bForward = sal_True ); Window *FindNextSplitter( Window *pWindow, sal_Bool bForward = sal_True ); diff --git a/vcl/inc/vcl/threadex.hxx b/vcl/inc/vcl/threadex.hxx index 429b43e6ac7c..c5333d847fa1 100644 --- a/vcl/inc/vcl/threadex.hxx +++ b/vcl/inc/vcl/threadex.hxx @@ -39,24 +39,6 @@ namespace vcl { - class VCL_DLLPUBLIC ThreadExecutor - { - oslThread m_aThread; - oslCondition m_aFinish; - long m_nReturn; - - #ifdef THREADEX_IMPLEMENTATION - public: - SAL_DLLPRIVATE static void SAL_CALL worker( void* ); - #endif - public: - ThreadExecutor(); - virtual ~ThreadExecutor(); - - virtual long doIt() = 0; - long execute(); - }; - class VCL_DLLPUBLIC SolarThreadExecutor { oslCondition m_aStart; diff --git a/vcl/inc/vcl/throbber.hxx b/vcl/inc/vcl/throbber.hxx index ce45631d2fda..4cbd6dcdbce2 100644 --- a/vcl/inc/vcl/throbber.hxx +++ b/vcl/inc/vcl/throbber.hxx @@ -1,3 +1,4 @@ +/* -*- 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 @@ private: #endif // VCL_THROBBER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx index 5badbc2d13bd..dd482c610d95 100644 --- a/vcl/inc/vcl/toolbox.hxx +++ b/vcl/inc/vcl/toolbox.hxx @@ -265,8 +265,6 @@ private: 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 ); - SAL_DLLPRIVATE void ImplStartCustomizeMode(); - SAL_DLLPRIVATE void ImplEndCustomizeMode(); SAL_DLLPRIVATE const XubString& ImplConvertMenuString( const XubString& rStr ); SAL_DLLPRIVATE sal_Bool ImplHandleMouseMove( const MouseEvent& rMEvt, sal_Bool bRepeat = sal_False ); SAL_DLLPRIVATE sal_Bool ImplHandleMouseButtonUp( const MouseEvent& rMEvt, sal_Bool bCancel = sal_False ); @@ -274,7 +272,6 @@ private: SAL_DLLPRIVATE sal_Bool ImplChangeHighlightUpDn( sal_Bool bUp, sal_Bool bNoCycle = sal_False ); SAL_DLLPRIVATE sal_uInt16 ImplGetItemLine( ImplToolItem* pCurrentItem ); SAL_DLLPRIVATE ImplToolItem* ImplGetFirstValidItem( sal_uInt16 nLine ); - SAL_DLLPRIVATE ImplToolItem* ImplGetLastValidItem( sal_uInt16 nLine ); SAL_DLLPRIVATE sal_Bool ImplOpenItem( KeyCode aKeyCode ); SAL_DLLPRIVATE sal_Bool ImplActivateItem( KeyCode aKeyCode ); SAL_DLLPRIVATE void ImplShowFocus(); @@ -332,9 +329,6 @@ public: static SAL_DLLPRIVATE void ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, sal_Bool bBlack, sal_Bool bColTransform, sal_Bool bLeft = sal_False, sal_Bool bTop = sal_False, long nSize = 6 ); - static SAL_DLLPRIVATE void SetToolArrowClipregion( ToolBox* pBox, long nX, long nY, - sal_Bool bLeft = sal_False, sal_Bool bTop = sal_False, - long nSize = 6 ); 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; } @@ -401,12 +395,9 @@ public: sal_uInt16 nPixSize = 0 ); void InsertBreak( sal_uInt16 nPos = TOOLBOX_APPEND ); void RemoveItem( sal_uInt16 nPos ); - void MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos = TOOLBOX_APPEND ); void CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, sal_uInt16 nNewPos = TOOLBOX_APPEND ); - void CopyItems( const ToolBox& rToolBox ); void Clear(); - void RecalcItems(); const ImageList& GetImageList() const { return maImageList; } void SetImageList( const ImageList& rImageList ); @@ -429,7 +420,6 @@ public: // Used to enable/disable scrolling one page at a time for toolbar void SetPageScroll( sal_Bool b ); - sal_Bool GetPageScroll(); void SetNextToolBox( const XubString& rStr ); const XubString& GetNextToolBox() const { return maNextToolBoxStr; } @@ -442,14 +432,12 @@ public: sal_uInt16 GetItemId( const Point& rPos ) const; Rectangle GetItemRect( sal_uInt16 nItemId ) const; Rectangle GetItemPosRect( sal_uInt16 nPos ) const; - Rectangle GetItemDropDownRect( sal_uInt16 nItemId ) const; Rectangle GetItemPosDropDownRect( sal_uInt16 nPos ) const; // retrieves the optimal position to place a popup window for this item (subtoolbar or dropdown) Point GetItemPopupPosition( sal_uInt16 nItemId, const Size& rSize ) const; Rectangle GetScrollRect() const; - Rectangle GetMenubuttonRect() const; sal_uInt16 GetCurItemId() const { return mnCurItemId; } sal_uInt16 GetDownItemId() const { return mnDownItemId; } sal_uInt16 GetClicks() const { return mnMouseClicks; } @@ -464,11 +452,7 @@ public: void SetItemImage( sal_uInt16 nItemId, const Image& rImage ); Image GetItemImage( sal_uInt16 nItemId ) const; void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 ); - long GetItemImageAngle( sal_uInt16 nItemId ) const; void SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror ); - sal_Bool GetItemImageMirrorMode( sal_uInt16 ) const; - void SetItemHighImage( sal_uInt16 nItemId, const Image& rImage ); - Image GetItemHighImage( sal_uInt16 nItemId ) const; void SetItemText( sal_uInt16 nItemId, const XubString& rText ); const XubString& GetItemText( sal_uInt16 nItemId ) const; void SetItemWindow( sal_uInt16 nItemId, Window* pNewWindow ); @@ -479,7 +463,6 @@ public: void EndSelection(); void SetItemDown( sal_uInt16 nItemId, sal_Bool bDown, sal_Bool bRelease = sal_True ); - sal_Bool IsItemDown( sal_uInt16 nItemId ) const; void SetItemState( sal_uInt16 nItemId, TriState eState ); TriState GetItemState( sal_uInt16 nItemId ) const; @@ -552,14 +535,8 @@ public: void EnableCustomize( sal_Bool bEnable = sal_True ); sal_Bool IsCustomize() { return mbCustomize; } - void StartCustomize( const Rectangle& rRect, void* pData = NULL ); - void SetCustomizeMode( sal_Bool ); sal_Bool IsInCustomizeMode() const { return mbCustomizeMode; } - static void StartCustomizeMode(); - static void EndCustomizeMode(); - static sal_Bool IsCustomizeMode(); - void SetHelpText( const XubString& rText ) { DockingWindow::SetHelpText( rText ); } const XubString& GetHelpText() const @@ -600,7 +577,6 @@ public: PopupMenu* GetMenu() const; void UpdateCustomMenu(); void SetMenuButtonHdl( const Link& rLink ); - const Link& GetMenuButtonHdl() const; // open custommenu void ExecuteCustomMenu(); @@ -625,13 +601,6 @@ public: // -1 is returned if no character is at that point // if an index is found the corresponding item id is filled in (else 0) long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const; - // returns the number of portions in the result of GetDisplayText() - long GetTextCount() const; - // returns the interval [start,end] of text portion nText - // returns [-1,-1] for an invalid text number - Pair GetTextStartEnd( long nText ) const; - // returns the item id for text portion nText or 0 if nText is invalid - sal_uInt16 GetDisplayItemId( long nText ) const; const Size& GetDefaultImageSize() const; void ChangeHighlight( sal_uInt16 nPos ); diff --git a/vcl/inc/vcl/wall.hxx b/vcl/inc/vcl/wall.hxx index 66a2a11038ed..f85d58c1200f 100644 --- a/vcl/inc/vcl/wall.hxx +++ b/vcl/inc/vcl/wall.hxx @@ -112,17 +112,14 @@ public: WallpaperStyle GetStyle() const; void SetBitmap( const BitmapEx& rBitmap ); - void SetBitmap(); BitmapEx GetBitmap() const; sal_Bool IsBitmap() const; void SetGradient( const Gradient& rGradient ); - void SetGradient(); Gradient GetGradient() const; sal_Bool IsGradient() const; void SetRect( const Rectangle& rRect ); - void SetRect(); Rectangle GetRect() const; sal_Bool IsRect() const; diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index df82b7870854..8cc7bfd0894f 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -914,7 +914,6 @@ public: void SetFakeFocus( bool bFocus ); sal_Bool IsCompoundControl() const; - sal_Bool HasCompoundControlFocus() const; static sal_uIntPtr SaveFocus(); static sal_Bool EndSaveFocus( sal_uIntPtr nSaveId, sal_Bool bRestore = sal_True ); diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h index 5cf92bcf3591..5cf92bcf3591 100755..100644 --- a/vcl/inc/win/salbmp.h +++ b/vcl/inc/win/salbmp.h diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx index ca0a19f4361a..ba9068628c8c 100644 --- a/vcl/inc/win/saldata.hxx +++ b/vcl/inc/win/saldata.hxx @@ -162,8 +162,6 @@ struct SalShlData UINT mnWheelScrollChars; // WheelScrollChars UINT mnWheelMsgId; // Wheel-Message-Id fuer W95 BOOL mbWXP; // Windows XP - BOOL mbWPrinter; // true: use unicode printer functions - // false: use anis compat printer functions OSVERSIONINFO maVersionInfo; }; diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h index e62d60196a1e..e62d60196a1e 100755..100644 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h diff --git a/vcl/inc/win/salmenu.h b/vcl/inc/win/salmenu.h index 99239d7b8191..99239d7b8191 100755..100644 --- a/vcl/inc/win/salmenu.h +++ b/vcl/inc/win/salmenu.h diff --git a/vcl/inc/win/salnativewidgets.h b/vcl/inc/win/salnativewidgets.h index 33ba8de4ba87..33ba8de4ba87 100755..100644 --- a/vcl/inc/win/salnativewidgets.h +++ b/vcl/inc/win/salnativewidgets.h diff --git a/vcl/inc/win/salobj.h b/vcl/inc/win/salobj.h index 068d65a611f2..068d65a611f2 100755..100644 --- a/vcl/inc/win/salobj.h +++ b/vcl/inc/win/salobj.h diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h index 6b399f99f971..80399d5eb3e9 100755..100644 --- a/vcl/inc/win/salprn.h +++ b/vcl/inc/win/salprn.h @@ -37,15 +37,12 @@ // WNT3 #define SAL_DRIVERDATA_SYSSIGN ((sal_uIntPtr)0x574E5433) -#define SAL_DRIVERDATA_VERSION_A 1 -#define SAL_DRIVERDATA_VERSION_W 2 #pragma pack( 1 ) struct SalDriverData { sal_uIntPtr mnSysSignature; - sal_uInt16 mnVersion; sal_uInt16 mnDriverOffset; BYTE maDriverData[1]; }; diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h index 6f133b57d15f..6f133b57d15f 100755..100644 --- a/vcl/inc/win/salsys.h +++ b/vcl/inc/win/salsys.h diff --git a/vcl/inc/win/saltimer.h b/vcl/inc/win/saltimer.h index d408e099eaaf..d408e099eaaf 100755..100644 --- a/vcl/inc/win/saltimer.h +++ b/vcl/inc/win/saltimer.h diff --git a/vcl/inc/win/salvd.h b/vcl/inc/win/salvd.h index 0f213ed5a6f3..0f213ed5a6f3 100755..100644 --- a/vcl/inc/win/salvd.h +++ b/vcl/inc/win/salvd.h diff --git a/vcl/inc/win/wincomp.hxx b/vcl/inc/win/wincomp.hxx index 6e20eb8e16e5..6e20eb8e16e5 100755..100644 --- a/vcl/inc/win/wincomp.hxx +++ b/vcl/inc/win/wincomp.hxx diff --git a/vcl/ios/source/app/saldata.cxx b/vcl/ios/source/app/saldata.cxx new file mode 100644 index 000000000000..f292b6fae585 --- /dev/null +++ b/vcl/ios/source/app/saldata.cxx @@ -0,0 +1,128 @@ +/* -*- 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 "ios/saldata.hxx" +#include "ios/saluimenu.h" +#include "ios/salinst.h" + +oslThreadKey SalData::s_aAutoReleaseKey = 0; + +static void SAL_CALL releasePool( void* pPool ) +{ + if( pPool ) + [(NSAutoreleasePool*)pPool release]; +} + +SalData::SalData() +: + mpTimerProc( NULL ), + mpFirstInstance( NULL ), + mpFirstObject( NULL ), + mpFirstVD( NULL ), + mpFirstPrinter( NULL ), + mpFontList( NULL ), + mxRGBSpace( CGColorSpaceCreateDeviceRGB( ) ), + mxGraySpace( CGColorSpaceCreateDeviceGray( ) ), + mxP50Space( NULL ), + mxP50Pattern( NULL ), + mnSystemVersion( VER_TIGER ), + mnDPIX( 0 ), + mnDPIY( 0 ) +{ + if( s_aAutoReleaseKey == 0 ) + s_aAutoReleaseKey = osl_createThreadKey( releasePool ); +} + +SalData::~SalData() +{ + CGPatternRelease( mxP50Pattern ); + CGColorSpaceRelease( mxP50Space ); + CGColorSpaceRelease( mxRGBSpace ); + CGColorSpaceRelease( mxGraySpace ); + if( s_aAutoReleaseKey ) + { + // release the last pool + NSAutoreleasePool* pPool = nil; + pPool = reinterpret_cast<NSAutoreleasePool*>( osl_getThreadKeyData( s_aAutoReleaseKey ) ); + if( pPool ) + { + osl_setThreadKeyData( s_aAutoReleaseKey, NULL ); + [pPool release]; + } + + osl_destroyThreadKey( s_aAutoReleaseKey ); + s_aAutoReleaseKey = 0; + } +} + +void SalData::ensureThreadAutoreleasePool() +{ + NSAutoreleasePool* pPool = nil; + if( s_aAutoReleaseKey ) + { + pPool = reinterpret_cast<NSAutoreleasePool*>( osl_getThreadKeyData( s_aAutoReleaseKey ) ); + if( ! pPool ) + { + pPool = [[NSAutoreleasePool alloc] init]; + osl_setThreadKeyData( s_aAutoReleaseKey, pPool ); + } + } + else + { + OSL_FAIL( "no autorelease key" ); + } +} + +void SalData::drainThreadAutoreleasePool() +{ + NSAutoreleasePool* pPool = nil; + if( s_aAutoReleaseKey ) + { + pPool = reinterpret_cast<NSAutoreleasePool*>( osl_getThreadKeyData( s_aAutoReleaseKey ) ); + if( pPool ) + { + // osl_setThreadKeyData( s_aAutoReleaseKey, NULL ); + // [pPool release]; + [pPool drain]; + } + else + { + pPool = [[NSAutoreleasePool alloc] init]; + osl_setThreadKeyData( s_aAutoReleaseKey, pPool ); + } + } + else + { + OSL_FAIL( "no autorelease key" ); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/ios/source/app/salinst.cxx b/vcl/ios/source/app/salinst.cxx new file mode 100644 index 000000000000..b4c944cd31a4 --- /dev/null +++ b/vcl/ios/source/app/salinst.cxx @@ -0,0 +1,828 @@ +/* -*- 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 <stdio.h> + +#include "tools/fsys.hxx" +#include "tools/getprocessworkingdir.hxx" +#include <tools/solarmutex.hxx> + +#include "osl/process.h" + +#include "rtl/ustrbuf.hxx" + +#include "vcl/svapp.hxx" +#include "vcl/window.hxx" +#include "vcl/timer.hxx" +#include "vcl/solarmutex.hxx" + +#include "ios/saldata.hxx" +#include "ios/salinst.h" +#include "ios/salframe.h" +#include "ios/salobj.h" +#include "ios/salsys.h" +#include "ios/salvd.h" +#include "ios/salbmp.h" +#include "ios/salprn.h" +#include "ios/saltimer.h" +#include "ios/vcluiapp.h" + +#include "print.h" +#include "impbmp.hxx" +#include "salimestatus.hxx" + +#include <comphelper/processfactory.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp> +#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +using namespace std; +using namespace ::com::sun::star; + +extern sal_Bool ImplSVMain(); + +static int* gpnInit = 0; +static bool bNoSVMain = true; +static bool bLeftMain = false; +// ----------------------------------------------------------------------- + +class IosDelayedSettingsChanged : public Timer +{ + bool mbInvalidate; + public: + IosDelayedSettingsChanged( bool bInvalidate ) : + mbInvalidate( bInvalidate ) + { + } + + virtual void Timeout() + { + SalData* pSalData = GetSalData(); + if( ! pSalData->maFrames.empty() ) + pSalData->maFrames.front()->CallCallback( SALEVENT_SETTINGSCHANGED, NULL ); + + if( mbInvalidate ) + { + for( std::list< IosSalFrame* >::iterator it = pSalData->maFrames.begin(); + it != pSalData->maFrames.end(); ++it ) + { + if( (*it)->mbShown ) + (*it)->SendPaintEvent( NULL ); + } + } + Stop(); + delete this; + } +}; + +void IosSalInstance::delayedSettingsChanged( bool bInvalidate ) +{ + osl::SolarGuard aGuard( *mpSalYieldMutex ); + IosDelayedSettingsChanged* pTimer = new IosDelayedSettingsChanged( bInvalidate ); + pTimer->SetTimeout( 50 ); + pTimer->Start(); +} + + +// the AppEventList must be available before any SalData/SalInst/etc. objects are ready +typedef std::list<const ApplicationEvent*> AppEventList; +AppEventList IosSalInstance::aAppEventList; + +// initialize the VCL_UIApplication object +static void initUIApp() +{ + [VCL_UIApplication sharedApplication]; + + SalData::ensureThreadAutoreleasePool(); +} + +sal_Bool ImplSVMainHook( int * pnInit ) +{ + gpnInit = pnInit; + + bNoSVMain = false; + initUIApp(); + + char* pArgv[] = { "main", NULL }; + UIApplicationMain( 1, pArgv, NULL, NULL ); + + return TRUE; // indicate that ImplSVMainHook is implemented +} + +// ======================================================================= + +void SalAbort( const XubString& rErrorText ) +{ + if( !rErrorText.Len() ) + fprintf( stderr, "Application Error " ); + else + fprintf( stderr, "%s ", + ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() ); + abort(); +} + +// ----------------------------------------------------------------------- + +void InitSalData() +{ + SalData *pSalData = new SalData; + SetSalData( pSalData ); +} + +// ----------------------------------------------------------------------- + +const ::rtl::OUString& SalGetDesktopEnvironment() +{ + static OUString aDesktopEnvironment(RTL_CONSTASCII_USTRINGPARAM( "CocoaTouch" )); + return aDesktopEnvironment; +} + +// ----------------------------------------------------------------------- + +void DeInitSalData() +{ + SalData *pSalData = GetSalData(); + delete pSalData; + SetSalData( NULL ); +} + +// ----------------------------------------------------------------------- + +void InitSalMain() +{ + rtl::OUString urlWorkDir; + rtl_uString *sysWorkDir = NULL; + if (tools::getProcessWorkingDir(urlWorkDir)) + { + oslFileError err2 = osl_getSystemPathFromFileURL(urlWorkDir.pData, &sysWorkDir); + if (err2 == osl_File_E_None) + { + ByteString aPath( getenv( "PATH" ) ); + ByteString aResPath( getenv( "STAR_RESOURCEPATH" ) ); + ByteString aCmdPath( OUStringToOString(OUString(sysWorkDir), RTL_TEXTENCODING_UTF8).getStr() ); + ByteString aTmpPath; + // Get absolute path of command's directory + if ( aCmdPath.Len() ) { + DirEntry aCmdDirEntry( aCmdPath ); + aCmdDirEntry.ToAbs(); + aCmdPath = ByteString( aCmdDirEntry.GetPath().GetFull(), RTL_TEXTENCODING_ASCII_US ); + } + // Assign to PATH environment variable + if ( aCmdPath.Len() ) + { + aTmpPath = ByteString( "PATH=" ); + aTmpPath += aCmdPath; + if ( aPath.Len() ) + aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); + aTmpPath += aPath; + putenv( (char*)aTmpPath.GetBuffer() ); + } + // Assign to STAR_RESOURCEPATH environment variable + if ( aCmdPath.Len() ) + { + aTmpPath = ByteString( "STAR_RESOURCEPATH=" ); + aTmpPath += aCmdPath; + if ( aResPath.Len() ) + aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); + aTmpPath += aResPath; + putenv( (char*)aTmpPath.GetBuffer() ); + } + } + } +} + +// ----------------------------------------------------------------------- + +void DeInitSalMain() +{ +} + +// ======================================================================= + +SalYieldMutex::SalYieldMutex() +{ + mnCount = 0; + mnThreadId = 0; +} + +void SalYieldMutex::acquire() +{ + SolarMutexObject::acquire(); + mnThreadId = osl::Thread::getCurrentIdentifier(); + mnCount++; +} + +void SalYieldMutex::release() +{ + if ( mnThreadId == osl::Thread::getCurrentIdentifier() ) + { + if ( mnCount == 1 ) + mnThreadId = 0; + mnCount--; + } + SolarMutexObject::release(); +} + +sal_Bool SalYieldMutex::tryToAcquire() +{ + if ( SolarMutexObject::tryToAcquire() ) + { + mnThreadId = osl::Thread::getCurrentIdentifier(); + mnCount++; + return sal_True; + } + else + return sal_False; +} + +// ----------------------------------------------------------------------- + +// some convenience functions regarding the yield mutex, aka solar mutex + +sal_Bool ImplSalYieldMutexTryToAcquire() +{ + IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + return pInst->mpSalYieldMutex->tryToAcquire(); + else + return FALSE; +} + +void ImplSalYieldMutexAcquire() +{ + IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + pInst->mpSalYieldMutex->acquire(); +} + +void ImplSalYieldMutexRelease() +{ + IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + pInst->mpSalYieldMutex->release(); +} + +// ======================================================================= + +SalInstance* CreateSalInstance() +{ + // this is the case for not using SVMain + // not so good + if( bNoSVMain ) + initUIApp(); + + SalData* pSalData = GetSalData(); + DBG_ASSERT( pSalData->mpFirstInstance == NULL, "more than one instance created" ); + IosSalInstance* pInst = new IosSalInstance; + + // init instance (only one instance in this version !!!) + pSalData->mpFirstInstance = pInst; + // this one is for outside IosSalInstance::Yield + SalData::ensureThreadAutoreleasePool(); + // no focus rects on NWF ios + ImplGetSVData()->maNWFData.mbNoFocusRects = true; + ImplGetSVData()->maNWFData.mbNoBoldTabFocus = true; + ImplGetSVData()->maNWFData.mbNoActiveTabTextRaise = true; + ImplGetSVData()->maNWFData.mbCenteredTabs = true; + ImplGetSVData()->maNWFData.mbProgressNeedsErase = true; + ImplGetSVData()->maNWFData.mbCheckBoxNeedsErase = true; + ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset = 10; + ImplGetSVData()->maGDIData.mbNoXORClipping = true; + ImplGetSVData()->maWinData.mbNoSaveBackground = true; + + return pInst; +} + +// ----------------------------------------------------------------------- + +void DestroySalInstance( SalInstance* pInst ) +{ + delete pInst; +} + +// ----------------------------------------------------------------------- + +IosSalInstance::IosSalInstance() +{ + mpSalYieldMutex = new SalYieldMutex; + mpSalYieldMutex->acquire(); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); + maMainThread = osl::Thread::getCurrentIdentifier(); + mbWaitingYield = false; + maUserEventListMutex = osl_createMutex(); + mnActivePrintJobs = 0; + maWaitingYieldCond = osl_createCondition(); +} + +// ----------------------------------------------------------------------- + +IosSalInstance::~IosSalInstance() +{ + ::tools::SolarMutex::SetSolarMutex( 0 ); + mpSalYieldMutex->release(); + delete mpSalYieldMutex; + osl_destroyMutex( maUserEventListMutex ); + osl_destroyCondition( maWaitingYieldCond ); +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::wakeupYield() +{ +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::PostUserEvent( IosSalFrame* pFrame, sal_uInt16 nType, void* pData ) +{ + osl_acquireMutex( maUserEventListMutex ); + maUserEvents.push_back( SalUserEvent( pFrame, pData, nType ) ); + osl_releaseMutex( maUserEventListMutex ); + + // notify main loop that an event has arrived + wakeupYield(); +} + +// ----------------------------------------------------------------------- + +osl::SolarMutex* IosSalInstance::GetYieldMutex() +{ + return mpSalYieldMutex; +} + +// ----------------------------------------------------------------------- + +sal_uLong IosSalInstance::ReleaseYieldMutex() +{ + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() == + osl::Thread::getCurrentIdentifier() ) + { + sal_uLong nCount = pYieldMutex->GetAcquireCount(); + sal_uLong n = nCount; + while ( n ) + { + pYieldMutex->release(); + n--; + } + + return nCount; + } + else + return 0; +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::AcquireYieldMutex( sal_uLong nCount ) +{ + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + while ( nCount ) + { + pYieldMutex->acquire(); + nCount--; + } +} + +// ----------------------------------------------------------------------- + +bool IosSalInstance::CheckYieldMutex() +{ + bool bRet = true; + + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() != osl::Thread::getCurrentIdentifier()) + { + bRet = false; + } + + return bRet; +} + +// ----------------------------------------------------------------------- + +bool IosSalInstance::isUIAppThread() const +{ + return osl::Thread::getCurrentIdentifier() == maMainThread; +} + +// ----------------------------------------------------------------------- + +class ReleasePoolHolder +{ + NSAutoreleasePool* mpPool; + public: + ReleasePoolHolder() : mpPool( [[NSAutoreleasePool alloc] init] ) {} + ~ReleasePoolHolder() { [mpPool release]; } +}; + +void IosSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) +{ + // ensure that the per thread autorelease pool is top level and + // will therefore not be destroyed by cocoa implicitly + SalData::ensureThreadAutoreleasePool(); + + // NSAutoreleasePool documentation suggests we should have + // an own pool for each yield level + ReleasePoolHolder aReleasePool; + + // Release all locks so that we don't deadlock when we pull pending + // events from the event queue + bool bDispatchUser = true; + while( bDispatchUser ) + { + sal_uLong nCount = ReleaseYieldMutex(); + + // get one user event + osl_acquireMutex( maUserEventListMutex ); + SalUserEvent aEvent( NULL, NULL, 0 ); + if( ! maUserEvents.empty() ) + { + aEvent = maUserEvents.front(); + maUserEvents.pop_front(); + } + else + bDispatchUser = false; + osl_releaseMutex( maUserEventListMutex ); + + AcquireYieldMutex( nCount ); + + // dispatch it + if( aEvent.mpFrame && IosSalFrame::isAlive( aEvent.mpFrame ) ) + { + aEvent.mpFrame->CallCallback( aEvent.mnType, aEvent.mpData ); + osl_setCondition( maWaitingYieldCond ); + // return if only one event is asked for + if( ! bHandleAllCurrentEvents ) + return; + } + } + + // handle event queue + // events mye be only handled in the thread the app was created + if( mnActivePrintJobs == 0 ) + { + // we need to be woken up by a cocoa-event + // if a user event should be posted by the event handling below + bool bOldWaitingYield = mbWaitingYield; + mbWaitingYield = bWait; + + mbWaitingYield = bOldWaitingYield; + + // collect update rectangles + const std::list< IosSalFrame* > rFrames( GetSalData()->maFrames ); + for( std::list< IosSalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it ) + { + if( (*it)->mbShown && ! (*it)->maInvalidRect.IsEmpty() ) + { + (*it)->Flush( (*it)->maInvalidRect ); + (*it)->maInvalidRect.SetEmpty(); + } + } + osl_setCondition( maWaitingYieldCond ); + } +} + +// ----------------------------------------------------------------------- + +bool IosSalInstance::AnyInput( sal_uInt16 nType ) +{ + if( nType & INPUT_APPEVENT ) + { + if( ! aAppEventList.empty() ) + return true; + if( nType == INPUT_APPEVENT ) + return false; + } + + if( nType & INPUT_TIMER ) + { + if( IosSalTimer::pRunningTimer ) + { + NSDate* pDt = [IosSalTimer::pRunningTimer fireDate]; + if( pDt && [pDt timeIntervalSinceNow] < 0 ) + { + return true; + } + } + } + return false; +} + +// ----------------------------------------------------------------------- + +SalFrame* IosSalInstance::CreateChildFrame( SystemParentData*, sal_uLong /*nSalFrameStyle*/ ) +{ + return NULL; +} + +// ----------------------------------------------------------------------- + +SalFrame* IosSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nSalFrameStyle ) +{ + SalData::ensureThreadAutoreleasePool(); + + SalFrame* pFrame = new IosSalFrame( pParent, nSalFrameStyle ); + return pFrame; +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::DestroyFrame( SalFrame* pFrame ) +{ + delete pFrame; +} + +// ----------------------------------------------------------------------- + +SalObject* IosSalInstance::CreateObject( SalFrame* pParent, SystemWindowData* /* pWindowData */, sal_Bool /* bShow */ ) +{ + // SystemWindowData is meaningless on Mac OS X + IosSalObject *pObject = NULL; + + if ( pParent ) + pObject = new IosSalObject( static_cast<IosSalFrame*>(pParent) ); + + return pObject; +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::DestroyObject( SalObject* pObject ) +{ + delete ( pObject ); +} + +SalSystem* IosSalInstance::CreateSystem() +{ + return new IosSalSystem(); +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::DestroySystem( SalSystem* pSystem ) +{ + delete pSystem; +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::SetEventCallback( void*, bool(*)(void*,void*,int) ) +{ +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::SetErrorEventCallback( void*, bool(*)(void*,void*,int) ) +{ +} + +// ----------------------------------------------------------------------- + +void* IosSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) +{ + rReturnedBytes = 1; + rReturnedType = AsciiCString; + return (void*)""; +} + +// We need to re-encode file urls because osl_getFileURLFromSystemPath converts +// to UTF-8 before encoding non ascii characters, which is not what other apps expect. +static rtl::OUString translateToExternalUrl(const rtl::OUString& internalUrl) +{ + rtl::OUString extUrl; + + uno::Reference< lang::XMultiServiceFactory > sm = comphelper::getProcessServiceFactory(); + if (sm.is()) + { + uno::Reference< beans::XPropertySet > pset; + sm->queryInterface( getCppuType( &pset )) >>= pset; + if (pset.is()) + { + uno::Reference< uno::XComponentContext > context; + static const rtl::OUString DEFAULT_CONTEXT( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ); + pset->getPropertyValue(DEFAULT_CONTEXT) >>= context; + if (context.is()) + extUrl = uri::ExternalUriReferenceTranslator::create(context)->translateToExternal(internalUrl); + } + } + return extUrl; +} + +// #i104525# many versions of OSX have problems with some URLs: +// when an app requests OSX to add one of these URLs to the "Recent Items" list +// then this app gets killed (TextEdit, Preview, etc. and also OOo) +static bool isDangerousUrl( const rtl::OUString& rUrl ) +{ + // use a heuristic that detects all known cases since there is no official comment + // on the exact impact and root cause of the OSX bug + const int nLen = rUrl.getLength(); + const sal_Unicode* p = rUrl.getStr(); + for( int i = 0; i < nLen-3; ++i, ++p ) { + if( p[0] != '%' ) + continue; + // escaped percent? + if( (p[1] == '2') && (p[2] == '5') ) + return true; + // escapes are considered to be UTF-8 encoded + // => check for invalid UTF-8 leading byte + if( (p[1] != 'f') && (p[1] != 'F') ) + continue; + int cLowNibble = p[2]; + if( (cLowNibble >= '0' ) && (cLowNibble <= '9')) + return false; + if( cLowNibble >= 'a' ) + cLowNibble -= 'a' - 'A'; + if( (cLowNibble < 'A') || (cLowNibble >= 'C')) + return true; + } + + return false; +} + +void IosSalInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& /*rMimeType*/) +{ +} + +// ----------------------------------------------------------------------- + +SalTimer* IosSalInstance::CreateSalTimer() +{ + return new IosSalTimer(); +} + +// ----------------------------------------------------------------------- + +SalSystem* IosSalInstance::CreateSalSystem() +{ + return new IosSalSystem(); +} + +// ----------------------------------------------------------------------- + +SalBitmap* IosSalInstance::CreateSalBitmap() +{ + return new IosSalBitmap(); +} + +// ----------------------------------------------------------------------- + +SalSession* IosSalInstance::CreateSalSession() +{ + return NULL; +} + +// ----------------------------------------------------------------------- + +// YieldMutexReleaser +YieldMutexReleaser::YieldMutexReleaser() : mnCount( 0 ) +{ + SalData* pSalData = GetSalData(); + if( ! pSalData->mpFirstInstance->isUIAppThread() ) + { + SalData::ensureThreadAutoreleasePool(); + mnCount = pSalData->mpFirstInstance->ReleaseYieldMutex(); + } +} + +YieldMutexReleaser::~YieldMutexReleaser() +{ + if( mnCount != 0 ) + GetSalData()->mpFirstInstance->AcquireYieldMutex( mnCount ); +} + +////////////////////////////////////////////////////////////// +rtl::OUString GetOUString( CFStringRef rStr ) +{ + if( rStr == 0 ) + return rtl::OUString(); + CFIndex nLength = CFStringGetLength( rStr ); + if( nLength == 0 ) + return rtl::OUString(); + const UniChar* pConstStr = CFStringGetCharactersPtr( rStr ); + if( pConstStr ) + return rtl::OUString( pConstStr, nLength ); + UniChar* pStr = reinterpret_cast<UniChar*>( rtl_allocateMemory( sizeof(UniChar)*nLength ) ); + CFRange aRange = { 0, nLength }; + CFStringGetCharacters( rStr, aRange, pStr ); + rtl::OUString aRet( pStr, nLength ); + rtl_freeMemory( pStr ); + return aRet; +} + +rtl::OUString GetOUString( NSString* pStr ) +{ + if( ! pStr ) + return rtl::OUString(); + int nLen = [pStr length]; + if( nLen == 0 ) + return rtl::OUString(); + + rtl::OUStringBuffer aBuf( nLen+1 ); + aBuf.setLength( nLen ); + [pStr getCharacters: const_cast<sal_Unicode*>(aBuf.getStr())]; + return aBuf.makeStringAndClear(); +} + +CFStringRef CreateCFString( const rtl::OUString& rStr ) +{ + return CFStringCreateWithCharacters(kCFAllocatorDefault, rStr.getStr(), rStr.getLength() ); +} + +NSString* CreateNSString( const rtl::OUString& rStr ) +{ + return [[NSString alloc] initWithCharacters: rStr.getStr() length: rStr.getLength()]; +} + +CGImageRef CreateCGImage( const Image& rImage ) +{ + BitmapEx aBmpEx( rImage.GetBitmapEx() ); + Bitmap aBmp( aBmpEx.GetBitmap() ); + + if( ! aBmp || ! aBmp.ImplGetImpBitmap() ) + return NULL; + + // simple case, no transparency + IosSalBitmap* pSalBmp = static_cast<IosSalBitmap*>(aBmp.ImplGetImpBitmap()->ImplGetSalBitmap()); + + if( ! pSalBmp ) + return NULL; + + CGImageRef xImage = NULL; + if( ! (aBmpEx.IsAlpha() || aBmpEx.IsTransparent() ) ) + xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight ); + else if( aBmpEx.IsAlpha() ) + { + AlphaMask aAlphaMask( aBmpEx.GetAlpha() ); + Bitmap aMask( aAlphaMask.GetBitmap() ); + IosSalBitmap* pMaskBmp = static_cast<IosSalBitmap*>(aMask.ImplGetImpBitmap()->ImplGetSalBitmap()); + if( pMaskBmp ) + xImage = pSalBmp->CreateWithMask( *pMaskBmp, 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight ); + else + xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight ); + } + else if( aBmpEx.GetTransparentType() == TRANSPARENT_BITMAP ) + { + Bitmap aMask( aBmpEx.GetMask() ); + IosSalBitmap* pMaskBmp = static_cast<IosSalBitmap*>(aMask.ImplGetImpBitmap()->ImplGetSalBitmap()); + if( pMaskBmp ) + xImage = pSalBmp->CreateWithMask( *pMaskBmp, 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight ); + else + xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight ); + } + else if( aBmpEx.GetTransparentType() == TRANSPARENT_COLOR ) + { + Color aTransColor( aBmpEx.GetTransparentColor() ); + SalColor nTransColor = MAKE_SALCOLOR( aTransColor.GetRed(), aTransColor.GetGreen(), aTransColor.GetBlue() ); + xImage = pSalBmp->CreateColorMask( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight, nTransColor ); + } + + return xImage; +} + +UIImage* CreateNSImage( const Image& rImage ) +{ + CGImageRef xImage = CreateCGImage( rImage ); + + if( ! xImage ) + return nil; + + Size aSize( rImage.GetSizePixel() ); + UIImage* pImage = [[UIImage alloc] initWithCGImage: xImage]; + CGImageRelease( xImage ); + + return pImage; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/ios/source/app/salnstimer.mm b/vcl/ios/source/app/salnstimer.mm new file mode 100644 index 000000000000..05445110d8ba --- /dev/null +++ b/vcl/ios/source/app/salnstimer.mm @@ -0,0 +1,59 @@ +/* -*- 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 "ios/saltimer.h" +#include "ios/salnstimer.h" +#include "ios/salinst.h" +#include "ios/saldata.hxx" + +#include "svdata.hxx" + +@implementation TimerCallbackCaller +-(void)timerElapsed:(NSTimer*)pTimer +{ + (void)pTimer; + ImplSVData* pSVData = ImplGetSVData(); + if( IosSalTimer::bDispatchTimer ) + { + if( pSVData->mpSalTimer ) + { + YIELD_GUARD; + pSVData->mpSalTimer->CallCallback(); + + // NSTimer does not end nextEventMatchingMask of NSApplication + // so we need to wakeup a waiting Yield to inform it something happened + GetSalData()->mpFirstInstance->wakeupYield(); + } + } +} +@end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/ios/source/app/salsys.cxx b/vcl/ios/source/app/salsys.cxx new file mode 100644 index 000000000000..1baf357d85a9 --- /dev/null +++ b/vcl/ios/source/app/salsys.cxx @@ -0,0 +1,253 @@ +/* -*- 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 "tools/rc.hxx" + +#include "rtl/ustrbuf.hxx" + +#include "vcl/button.hxx" + +#include "ios/salsys.h" +#include "ios/saldata.hxx" +#include "ios/salinst.h" + +#include "svids.hrc" + +using ::rtl::OUString; + +// ======================================================================= + +IosSalSystem::~IosSalSystem() +{ +} + +unsigned int IosSalSystem::GetDisplayScreenCount() +{ + NSArray* pScreens = [UIScreen screens]; + return pScreens ? [pScreens count] : 1; +} + +bool IosSalSystem::IsMultiDisplay() +{ + return false; +} + +unsigned int IosSalSystem::GetDefaultDisplayNumber() +{ + return 0; +} + +Rectangle IosSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) +{ + NSArray* pScreens = [UIScreen screens]; + Rectangle aRet; + UIScreen* pScreen = nil; + if( pScreens && nScreen < [pScreens count] ) + pScreen = [pScreens objectAtIndex: nScreen]; + else + pScreen = [UIScreen mainScreen]; + + if( pScreen ) + { + CGRect aFrame = pScreen.bounds; + aRet = Rectangle( Point( static_cast<long int>(aFrame.origin.x), static_cast<long int>(aFrame.origin.y) ), + Size( static_cast<long int>(aFrame.size.width), static_cast<long int>(aFrame.size.height) ) ); + } + return aRet; +} + +Rectangle IosSalSystem::GetDisplayWorkAreaPosSizePixel( unsigned int nScreen ) +{ + NSArray* pScreens = [UIScreen screens]; + Rectangle aRet; + UIScreen* pScreen = nil; + if( pScreens && nScreen < [pScreens count] ) + pScreen = [pScreens objectAtIndex: nScreen]; + else + pScreen = [UIScreen mainScreen]; + + if( pScreen ) + { + CGRect aFrame = pScreen.applicationFrame; + aRet = Rectangle( Point( static_cast<long int>(aFrame.origin.x), static_cast<long int>(aFrame.origin.y) ), + Size( static_cast<long int>(aFrame.size.width), static_cast<long int>(aFrame.size.height) ) ); + } + return aRet; +} + +rtl::OUString IosSalSystem::GetScreenName( unsigned int nScreen ) +{ + NSArray* pScreens = [UIScreen screens]; + OUString aRet; + if( nScreen < [pScreens count] ) + { + ResMgr* pMgr = ImplGetResMgr(); + if( pMgr ) + { + String aScreenName( ResId( SV_MAC_SCREENNNAME, *pMgr ) ); + aScreenName.SearchAndReplaceAllAscii( "%d", String::CreateFromInt32( nScreen ) ); + aRet = aScreenName; + } + } + return aRet; +} + +static NSString* getStandardString( int nButtonId ) +{ + rtl::OUString aText( Button::GetStandardText( nButtonId ) ); + if( ! aText.getLength() ) // this is for bad cases, we might be missing the vcl resource + { + switch( nButtonId ) + { + case BUTTON_OK: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OK" ) );break; + case BUTTON_ABORT: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) );break; + case BUTTON_CANCEL: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cancel" ) );break; + case BUTTON_RETRY: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Retry" ) );break; + case BUTTON_YES: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Yes" ) );break; + case BUTTON_NO : aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No" ) );break; + } + } + return aText.getLength() ? CreateNSString( aText) : nil; +} + +@interface MessageboxDelegate : NSObject <UIAlertViewDelegate> +{ + int *_resultPtr; +} +- (id)initWithResultPtr:(int *)resultPtr; +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; +@end + +@implementation MessageboxDelegate +- (id)initWithResultPtr:(int *)resultPtr +{ + _resultPtr = resultPtr; + return [super init]; +} + +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex +{ + *_resultPtr = buttonIndex; +} +@end + +int IosSalSystem::ShowNativeMessageBox( const String& rTitle, + const String& rMessage, + int nButtonCombination, + int nDefaultButton) +{ + NSString* pTitle = CreateNSString( rTitle ); + NSString* pMessage = CreateNSString( rMessage ); + + struct id_entry + { + int nCombination; + int nDefaultButton; + int nTextIds[3]; + } aButtonIds[] = + { + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, -1, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, BUTTON_CANCEL, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_OK, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT, { BUTTON_ABORT, BUTTON_IGNORE, BUTTON_RETRY } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_IGNORE, BUTTON_ABORT } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE, { BUTTON_IGNORE, BUTTON_IGNORE, BUTTON_ABORT } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, BUTTON_CANCEL } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, BUTTON_CANCEL } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_YES, BUTTON_NO } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_CANCEL, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_RETRY, -1 } } + }; + + NSString* pDefText = nil; + NSString* pAltText = nil; + NSString* pOthText = nil; + + unsigned int nC; + for( nC = 0; nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]); nC++ ) + { + if( aButtonIds[nC].nCombination == nButtonCombination ) + { + if( aButtonIds[nC].nDefaultButton == nDefaultButton ) + { + if( aButtonIds[nC].nTextIds[0] != -1 ) + pDefText = getStandardString( aButtonIds[nC].nTextIds[0] ); + if( aButtonIds[nC].nTextIds[1] != -1 ) + pAltText = getStandardString( aButtonIds[nC].nTextIds[1] ); + if( aButtonIds[nC].nTextIds[2] != -1 ) + pOthText = getStandardString( aButtonIds[nC].nTextIds[2] ); + break; + } + } + } + + int nResult = 1; // ??? + // How to do the delegate when this is C++? + MessageboxDelegate *delegate = [[MessageboxDelegate alloc] initWithResultPtr: &nResult]; + UIAlertView *view = [[UIAlertView alloc] initWithTitle: pTitle message: pMessage delegate: delegate + cancelButtonTitle: @"Cancel" otherButtonTitles: nil]; + [view show]; + [view dealloc]; + [delegate dealloc]; + + if( pTitle ) + [pTitle release]; + if( pMessage ) + [pMessage release]; + if( pDefText ) + [pDefText release]; + if( pAltText ) + [pAltText release]; + if( pOthText ) + [pOthText release]; + + int nRet = 0; + if( nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]) && nResult >= 1 && nResult <= 3 ) + { + int nPressed = aButtonIds[nC].nTextIds[nResult-1]; + switch( nPressed ) + { + case BUTTON_NO: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO; break; + case BUTTON_YES: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES; break; + case BUTTON_OK: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK; break; + case BUTTON_CANCEL: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL; break; + case BUTTON_ABORT: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT; break; + case BUTTON_RETRY: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; break; + case BUTTON_IGNORE: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE; break; + } + } + + return nRet; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/ios/source/app/saltimer.cxx b/vcl/ios/source/app/saltimer.cxx new file mode 100644 index 000000000000..69401ea502d7 --- /dev/null +++ b/vcl/ios/source/app/saltimer.cxx @@ -0,0 +1,104 @@ +/* -*- 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 "ios/saltimer.h" +#include "ios/salnstimer.h" +#include "ios/saldata.hxx" +#include "ios/salframe.h" +#include "ios/salinst.h" + +// ======================================================================= + +NSTimer* IosSalTimer::pRunningTimer = nil; +bool IosSalTimer::bDispatchTimer = false; + + +void ImplSalStartTimer( sal_uLong nMS ) +{ + SalData* pSalData = GetSalData(); + if( pSalData->mpFirstInstance->isUIAppThread() ) + { + IosSalTimer::bDispatchTimer = true; + NSTimeInterval aTI = double(nMS)/1000.0; + if( IosSalTimer::pRunningTimer != nil ) + { + if( [IosSalTimer::pRunningTimer timeInterval] == aTI ) + // set new fire date + [IosSalTimer::pRunningTimer setFireDate: [NSDate dateWithTimeIntervalSinceNow: aTI]]; + else + { + [IosSalTimer::pRunningTimer invalidate]; + IosSalTimer::pRunningTimer = nil; + } + } + if( IosSalTimer::pRunningTimer == nil ) + { + IosSalTimer::pRunningTimer = [NSTimer scheduledTimerWithTimeInterval: aTI + target: [[[TimerCallbackCaller alloc] init] autorelease] + selector: @selector(timerElapsed:) + userInfo: nil + repeats: YES]; + } + } + else + { + SalData::ensureThreadAutoreleasePool(); + // post an event so we can get into the main thread + // ??? + } +} + +void ImplSalStopTimer() +{ + IosSalTimer::bDispatchTimer = false; +} + +IosSalTimer::IosSalTimer( ) +{ +} + +IosSalTimer::~IosSalTimer() +{ + ImplSalStopTimer(); +} + +void IosSalTimer::Start( sal_uLong nMS ) +{ + ImplSalStartTimer( nMS ); +} + +void IosSalTimer::Stop() +{ + ImplSalStopTimer(); +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/ios/source/app/vcluiapp.mm b/vcl/ios/source/app/vcluiapp.mm new file mode 100644 index 000000000000..e40d8a7eb792 --- /dev/null +++ b/vcl/ios/source/app/vcluiapp.mm @@ -0,0 +1,101 @@ +/* -*- 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 "rtl/ustrbuf.hxx" + +#include "vcl/window.hxx" +#include "vcl/svapp.hxx" +#include "vcl/cmdevt.hxx" + +#include "ios/vcluiapp.h" +#include "ios/salinst.h" +#include "ios/saldata.hxx" +#include "ios/salframe.h" +#include "ios/salframeview.h" + +#include "impimagetree.hxx" + +@implementation VCL_UIApplication +-(void)sendEvent:(UIEvent*)pEvent +{ + UIEventType eType = [pEvent type]; + [super sendEvent: pEvent]; +} + +-(void)sendSuperEvent:(UIEvent*)pEvent +{ + [super sendEvent: pEvent]; +} + +-(BOOL)application: (UIApplication*)app openFile: (NSString*)pFile +{ + (void)app; + const rtl::OUString aFile( GetOUString( pFile ) ); + return YES; +} + +-(void)application: (UIApplication*) app openFiles: (NSArray*)files +{ + (void)app; + rtl::OUStringBuffer aFileList( 256 ); + + NSEnumerator* it = [files objectEnumerator]; + NSString* pFile = nil; + + while( (pFile = [it nextObject]) != nil ) + { + const rtl::OUString aFile( GetOUString( pFile ) ); + } + + if( aFileList.getLength() ) + { + // we have no back channel here, we have to assume success, in which case + // replyToOpenOrPrint does not need to be called according to documentation + // [app replyToOpenOrPrint: NSApplicationDelegateReplySuccess]; + const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(), + APPEVENT_OPEN_STRING, aFileList.makeStringAndClear() ); + IosSalInstance::aAppEventList.push_back( pAppEvent ); + } +} + +-(void)addFallbackMenuItem: (UIMenuItem*)pNewItem +{ + IosSalMenu::addFallbackMenuItem( pNewItem ); +} + +-(void)removeFallbackMenuItem: (UIMenuItem*)pItem +{ + IosSalMenu::removeFallbackMenuItem( pItem ); +} + +@end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/null/printerinfomanager.cxx b/vcl/null/printerinfomanager.cxx new file mode 100644 index 000000000000..7361606c35b3 --- /dev/null +++ b/vcl/null/printerinfomanager.cxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "vcl/printerinfomanager.hxx" + +#include "unx/saldata.hxx" + +using namespace psp; +using namespace osl; + +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OStringToOUString; +using ::rtl::OUStringHash; + +void PrinterInfoManager::release() +{ + SalData* pSalData = GetSalData(); + delete pSalData->m_pPIManager; + pSalData->m_pPIManager = NULL; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index 9e0ccdba440b..29b3a4031e86 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -1,4 +1,4 @@ -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 : TRANSLATIONS:translations apple_remote BOOST:boost DESKTOP:rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offapi basegfx basebmp tools DESKTOP:l10ntools icc DESKTOP:cpputools svl LIBXSLT:libxslt CAIRO:cairo NULL vc vcl usr1 - all vc_mkout NULL vc vcl\prj nmake - all vc_prj NULL diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 75bab1a29694..3db6bcc841bf 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -112,27 +112,6 @@ sal_Bool Help::IsContextHelpEnabled() // ----------------------------------------------------------------------- -sal_Bool Help::StartContextHelp() -{ - ImplSVData* pSVData = ImplGetSVData(); - - if ( pSVData->maHelpData.mbContextHelp ) - { - Window* pWindow = pSVData->maWinData.mpFocusWin; - if ( pWindow ) - { - Point aMousePos = pWindow->OutputToScreenPixel( pWindow->GetPointerPosPixel() ); - HelpEvent aHelpEvent( aMousePos, HELPMODE_CONTEXT ); - pWindow->RequestHelp( aHelpEvent ); - return sal_True; - } - } - - return sal_False; -} - -// ----------------------------------------------------------------------- - void Help::EnableExtHelp() { ImplGetSVData()->maHelpData.mbExtHelp = sal_True; @@ -191,13 +170,6 @@ sal_Bool Help::EndExtHelp() // ----------------------------------------------------------------------- -sal_Bool Help::IsExtHelpActive() -{ - return ImplGetSVData()->maHelpData.mbExtHelpMode; -} - -// ----------------------------------------------------------------------- - void Help::EnableBalloonHelp() { ImplGetSVData()->maHelpData.mbBalloonHelp = sal_True; diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 9ffb8bc373da..1683faf1613a 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -964,46 +964,6 @@ inline sal_Bool ImplIsBackOrWhite( const Color& rColor ) return ( nLuminance < 8 ) || ( nLuminance > 250 ); } -sal_Bool StyleSettings::IsHighContrastBlackAndWhite() const -{ - sal_Bool bBWOnly = sal_True; - - // Only use B&W if fully B&W, like on GNOME. - // Some colors like CheckedColor and HighlightColor are not B&W in Windows Standard HC Black, - // and we don't want to be B&W then, so check these color first, very probably not B&W. - - // Unfortunately, GNOME uses a very very dark color (0x000033) instead of BLACK (0x000000) - - if ( !ImplIsBackOrWhite( GetFaceColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetHighlightTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetWindowColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetWindowTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetButtonTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetButtonTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetGroupTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetLabelTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetDialogColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetFieldColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetMenuColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetMenuBarColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetMenuHighlightColor() ) ) - bBWOnly = sal_False; - - return bBWOnly; -} - // ----------------------------------------------------------------------- sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index fe536addac98..9d54803f7f3b 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -241,12 +241,6 @@ Application::~Application() // ----------------------------------------------------------------------- -void Application::InitAppRes( const ResId& ) -{ -} - -// ----------------------------------------------------------------------- - sal_Bool Application::QueryExit() { WorkWindow* pAppWin = ImplGetSVData()->maWinData.mpAppWin; @@ -417,18 +411,6 @@ const KeyCode* Application::GetReservedKeyCode( sal_uLong i ) return &ImplReservedKeys::get()->first[i].mKeyCode; } -String Application::GetReservedKeyCodeDescription( sal_uLong i ) -{ - ResMgr* pResMgr = ImplGetResMgr(); - if( ! pResMgr ) - return String(); - ImplReservedKey *pImplReservedKeys = ImplReservedKeys::get()->first; - if( i >= GetReservedKeyCodeCount() || ! pImplReservedKeys[i].mnResId ) - return String(); - else - return String( ResId( pImplReservedKeys[i].mnResId, *pResMgr ) ); -} - // ----------------------------------------------------------------------- void Application::Execute() @@ -561,13 +543,6 @@ sal_Bool Application::IsInExecute() // ----------------------------------------------------------------------- -sal_Bool Application::IsShutDown() -{ - return ImplGetSVData()->maAppData.mbAppQuit; -} - -// ----------------------------------------------------------------------- - sal_Bool Application::IsInModalMode() { return (ImplGetSVData()->maAppData.mnModalMode != 0); @@ -621,34 +596,6 @@ sal_Bool Application::IsUICaptured() // ----------------------------------------------------------------------- -sal_Bool Application::IsUserActive( sal_uInt16 nTest ) -{ - if ( nTest & (USERACTIVE_MOUSEDRAG | USERACTIVE_INPUT) ) - { - if ( IsUICaptured() ) - return sal_True; - } - - if ( nTest & USERACTIVE_INPUT ) - { - if ( GetLastInputInterval() < 500 ) - return sal_True; - - if ( AnyInput( INPUT_KEYBOARD ) ) - return sal_True; - } - - if ( nTest & USERACTIVE_MODALDIALOG ) - { - if ( ImplGetSVData()->maAppData.mnModalDialog ) - return sal_True; - } - - return sal_False; -} - -// ----------------------------------------------------------------------- - void Application::SystemSettingsChanging( AllSettings& /*rSettings*/, Window* /*pFrame*/ ) { @@ -1465,16 +1412,6 @@ void Application::RemoveAccel( Accelerator* pAccel ) // ----------------------------------------------------------------------- -void Application::FlushAccel() -{ - ImplSVData* pSVData = ImplGetSVData(); - - if ( pSVData->maAppData.mpAccelMgr ) - pSVData->maAppData.mpAccelMgr->FlushAccel(); -} - -// ----------------------------------------------------------------------- - sal_Bool Application::CallAccel( const KeyCode& rKeyCode, sal_uInt16 nRepeat ) { ImplSVData* pSVData = ImplGetSVData(); @@ -1547,13 +1484,6 @@ void Application::SetDialogScaleX( short nScale ) // ----------------------------------------------------------------------- -short Application::GetDialogScaleX() -{ - return ImplGetSVData()->maAppData.mnDialogScaleX; -} - -// ----------------------------------------------------------------------- - void Application::SetDefDialogParent( Window* pWindow ) { ImplGetSVData()->maWinData.mpDefDialogParent = pWindow; @@ -1675,19 +1605,6 @@ const String& Application::GetFontPath() // ----------------------------------------------------------------------- -void Application::SetFontPath( const String& rPath ) -{ - ImplSVData* pSVData = ImplGetSVData(); - - // if it doesn't exist create a new one - if( !pSVData->maAppData.mpFontPath ) - pSVData->maAppData.mpFontPath = new String( rPath ); - else - *(pSVData->maAppData.mpFontPath) = rPath; -} - -// ----------------------------------------------------------------------- - UniqueItemId Application::CreateUniqueId() { ImplSVData* pSVData = ImplGetSVData(); @@ -1813,47 +1730,6 @@ void ImplFreeHotKeyData() // ----------------------------------------------------------------------- -sal_uIntPtr Application::AddHotKey( const KeyCode& rKeyCode, const Link& rLink, void* pData ) -{ - ImplSVData* pSVData = ImplGetSVData(); - ImplHotKey* pHotKeyData = new ImplHotKey; - pHotKeyData->mpUserData = pData; - pHotKeyData->maKeyCode = rKeyCode; - pHotKeyData->maLink = rLink; - pHotKeyData->mpNext = pSVData->maAppData.mpFirstHotKey; - pSVData->maAppData.mpFirstHotKey = pHotKeyData; - return (sal_uIntPtr)pHotKeyData; -} - -// ----------------------------------------------------------------------- - -void Application::RemoveHotKey( sal_uIntPtr nId ) -{ - ImplSVData* pSVData = ImplGetSVData(); - ImplHotKey* pFindHotKeyData = (ImplHotKey*)nId; - ImplHotKey* pPrevHotKeyData = NULL; - ImplHotKey* pHotKeyData = pSVData->maAppData.mpFirstHotKey; - while ( pHotKeyData ) - { - if ( pHotKeyData == pFindHotKeyData ) - { - if ( pPrevHotKeyData ) - pPrevHotKeyData->mpNext = pFindHotKeyData->mpNext; - else - pSVData->maAppData.mpFirstHotKey = pFindHotKeyData->mpNext; - delete pFindHotKeyData; - break; - } - - pPrevHotKeyData = pHotKeyData; - pHotKeyData = pHotKeyData->mpNext; - } - - DBG_ASSERT( pHotKeyData, "Application::RemoveHotKey() - HotKey is not added" ); -} - -// ----------------------------------------------------------------------- - void ImplFreeEventHookData() { ImplSVData* pSVData = ImplGetSVData(); @@ -1931,20 +1807,6 @@ long Application::CallEventHooks( NotifyEvent& rEvt ) // ----------------------------------------------------------------------- -long Application::CallPreNotify( NotifyEvent& rEvt ) -{ - return ImplCallPreNotify( rEvt ); -} - -// ----------------------------------------------------------------------- - -long Application::CallEvent( NotifyEvent& rEvt ) -{ - return ImplCallEvent( rEvt ); -} - -// ----------------------------------------------------------------------- - const LocaleDataWrapper& Application::GetAppLocaleDataWrapper() { return GetSettings().GetLocaleDataWrapper(); @@ -2020,11 +1882,6 @@ void Application::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const r pSVData->mpDefInst->AddToRecentDocumentList(rFileUrl, rMimeType); } -sal_Bool Application::IsAccessibilityEnabled() -{ - return sal_False; -} - sal_Bool InitAccessBridge( sal_Bool bShowCancel, sal_Bool &rCancelled ) { sal_Bool bRet = true; @@ -2067,13 +1924,9 @@ void Application::Property( ApplicationProperty& rProp ) void Application::SetPropertyHandler( PropertyHandler* p ) { - if ( pHandler ) - delete pHandler; pHandler = p; } - - void Application::AppEvent( const ApplicationEvent& /*rAppEvent*/ ) { } diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 7648dbbae75c..10f7e50d9aad 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -410,8 +410,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return bSuccess; } - - catch(::com::sun::star::java::JavaNotConfiguredException e) + catch (const ::com::sun::star::java::JavaNotConfiguredException&) { ResMgr *pResMgr = ImplGetResMgr(); if( bErrorMessage && bAllowCancel && pResMgr ) @@ -435,8 +434,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return false; } - - catch(::com::sun::star::java::JavaVMCreationFailureException e) + catch (const ::com::sun::star::java::JavaVMCreationFailureException&) { ResMgr *pResMgr = ImplGetResMgr(); if( bErrorMessage && bAllowCancel && pResMgr ) @@ -460,8 +458,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return false; } - - catch(::com::sun::star::java::MissingJavaRuntimeException e) + catch (const ::com::sun::star::java::MissingJavaRuntimeException&) { ResMgr *pResMgr = ImplGetResMgr(); if( bErrorMessage && bAllowCancel && pResMgr ) @@ -485,8 +482,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return false; } - - catch(::com::sun::star::java::JavaDisabledException e) + catch (const ::com::sun::star::java::JavaDisabledException&) { ResMgr *pResMgr = ImplGetResMgr(); if( bErrorMessage && bAllowCancel && pResMgr ) @@ -510,9 +506,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return false; } - - - catch(::com::sun::star::uno::RuntimeException e) + catch (const ::com::sun::star::uno::RuntimeException& e) { ResMgr *pResMgr = ImplGetResMgr(); if( bErrorMessage && pResMgr ) @@ -564,7 +558,6 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return false; } - catch (...) { return false; diff --git a/vcl/source/app/svmainhook.cxx b/vcl/source/app/svmainhook.cxx index dd446125a7aa..47c3854a2987 100644 --- a/vcl/source/app/svmainhook.cxx +++ b/vcl/source/app/svmainhook.cxx @@ -31,89 +31,13 @@ #include <tools/tools.h> #ifndef MACOSX +// MacOSX implementation of ImplSVMainHook is in aqua/source/app/salinst.cxx sal_Bool ImplSVMainHook( int * ) { return sal_False; // indicate that ImplSVMainHook is not implemented } -#else -// MACOSX cocoa implementation of ImplSVMainHook is in aqua/source/app/salinst.cxx -#ifndef QUARTZ // MACOSX (X11) needs the CFRunLoop() -#include <osl/thread.h> -#include <premac.h> -#include <CoreFoundation/CoreFoundation.h> -#include <postmac.h> -#include <unistd.h> - -extern sal_Bool ImplSVMain(); - -// ============================================================================ - - -static void SourceContextCallBack( void *pInfo ) -{ -} - -struct ThreadContext -{ - int* pRet; - CFRunLoopRef* pRunLoopRef; -}; - -static void RunSVMain(void *pData) -{ - ThreadContext* tcx = reinterpret_cast<ThreadContext*>(pData); - - // busy waiting (ok in this case) until the run loop is - // running - while (!CFRunLoopIsWaiting(*tcx->pRunLoopRef)) - usleep(100); - - *tcx->pRet = ImplSVMain(); - - // Force exit since some JVMs won't shutdown when only exit() is invoked - _exit( 0 ); -} - -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 - // are written in Cocoa, we need to start the CFRunLoop here and run - // ImplSVMain() in a secondary thread. - // See http://developer.apple.com/samplecode/simpleJavaLauncher/listing3.html - // for further details and an example - - CFRunLoopRef runLoopRef = CFRunLoopGetCurrent(); - ThreadContext tcx; - tcx.pRet = pnInit; // the return value - tcx.pRunLoopRef = &runLoopRef; - oslThread hThreadID = osl_createThread(RunSVMain, &tcx); - - // Start the CFRunLoop - CFRunLoopSourceContext aSourceContext; - aSourceContext.version = 0; - aSourceContext.info = NULL; - aSourceContext.retain = NULL; - aSourceContext.release = NULL; - aSourceContext.copyDescription = NULL; - aSourceContext.equal = NULL; - aSourceContext.hash = NULL; - aSourceContext.schedule = NULL; - aSourceContext.cancel = NULL; - aSourceContext.perform = &SourceContextCallBack; - CFRunLoopSourceRef aSourceRef = CFRunLoopSourceCreate(NULL, 0, &aSourceContext); - CFRunLoopAddSource(runLoopRef, aSourceRef, kCFRunLoopCommonModes); - CFRunLoopRun(); - - osl_joinWithThread( hThreadID ); - osl_destroyThread( hThreadID ); - - return sal_True; // indicate that ImplSVMainHook is implemented -} - -#endif // MACOSX #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index 04b0e122cbce..9701e83e886a 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -83,14 +83,7 @@ namespace rsvg extern "C" { - VCL_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( - const sal_Char** ppEnvTypeName, - uno_Environment** /*ppEnv*/ ) - { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - - VCL_DLLPUBLIC void* SAL_CALL component_getFactory( + VCL_DLLPUBLIC void* SAL_CALL vcl_component_getFactory( const sal_Char* pImplementationName, void* pXUnoSMgr, void* /*pXUnoKey*/ @@ -144,12 +137,14 @@ extern "C" { xMgr, vcl::DropTarget_getImplementationName(), vcl::DropTarget_createInstance, vcl::DropTarget_getSupportedServiceNames() ); } +#ifdef ENABLE_LIBRSVG else if( vcl::rsvg::Rasterizer_getImplementationName().equalsAscii( pImplementationName ) ) { xFactory = ::cppu::createSingleFactory( xMgr, vcl::rsvg::Rasterizer_getImplementationName(), vcl::rsvg::Rasterizer_createInstance, vcl::rsvg::Rasterizer_getSupportedServiceNames() ); } +#endif if( xFactory.is() ) { xFactory->acquire(); diff --git a/vcl/source/components/makefile.mk b/vcl/source/components/makefile.mk deleted file mode 100644 index 41f21bfa3749..000000000000 --- a/vcl/source/components/makefile.mk +++ /dev/null @@ -1,55 +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=components -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile2.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES= $(SLO)$/display.obj \ - $(SLO)$/dtranscomp.obj \ - $(SLO)$/fontident.obj \ - $(SLO)$/stringmirror.obj \ - $(SLO)$/rasterizer_rsvg.obj \ - $(SLO)$/factory.obj - -EXCEPTIONSFILES= $(SLO)$/rasterizer_rsvg.obj - - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk -.INCLUDE : $(PRJ)$/util$/target.pmk diff --git a/vcl/source/components/rasterizer_rsvg.cxx b/vcl/source/components/rasterizer_rsvg.cxx index 006b30b28e28..ef0d5f82e937 100644 --- a/vcl/source/components/rasterizer_rsvg.cxx +++ b/vcl/source/components/rasterizer_rsvg.cxx @@ -1,3 +1,4 @@ +/* -*- 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,23 +38,25 @@ #include <cppuhelper/implbase2.hxx> #include <osl/module.h> +#ifdef SYSTEM_CAIRO +#include <cairo.h> +#else +#include <cairo/cairo.h> +#endif + #include <vector> #if defined MACOSX #define VCL_RSVG_GOBJECT_LIBNAME "libgobject-2.0.0.dylib" - #define VCL_RSVG_CAIRO_LIBNAME "libcairo.2.dylib" #define VCL_RSVG_LIBRSVG_LIBNAME "librsvg-2.2.dylib" #elif defined UNX #define VCL_RSVG_GOBJECT_LIBNAME "libgobject-2.0.so" - #define VCL_RSVG_CAIRO_LIBNAME "libcairo.so" #define VCL_RSVG_LIBRSVG_LIBNAME "librsvg-2.so" #elif defined WNT #define VCL_RSVG_GOBJECT_LIBNAME "gobjectlo.dll" - #define VCL_RSVG_CAIRO_LIBNAME "cairo.dll" #define VCL_RSVG_LIBRSVG_LIBNAME "librsvg-2-2.dll" #else #define VCL_RSVG_GOBJECT_LIBNAME "nogobjectlib" - #define VCL_RSVG_CAIRO_LIBNAME "nocairolib" #define VCL_RSVG_LIBRSVG_LIBNAME "nolibrsvglib" #endif @@ -72,18 +75,6 @@ typedef void* gpointer; struct GError; -enum cairo_format_t { CAIRO_FORMAT_ARGB32 = 0 }; -enum cairo_status_t { CAIRO_STATUS_SUCCESS = 0 }; - -struct cairo_surface_t; -struct cairo_t; -struct cairo_matrix_t -{ - double xx; double yx; - double xy; double yy; - double x0; double y0; -}; - struct RsvgHandle; struct RsvgDimensionData { @@ -126,30 +117,12 @@ public: static LibraryWrapper& get(); - bool isValid() const { return( ( mpGObjectLib != NULL ) && ( mpCairoLib != NULL ) && ( mpRSVGLib != NULL ) ); } + bool isValid() const { return( ( mpGObjectLib != NULL ) && ( mpRSVGLib != NULL ) ); } // G-Object gpointer g_object_unref( gpointer pointer ) { return( (*mp_g_object_unref)( pointer ) ); }; // LibRSVG - - // Cairo - cairo_surface_t* image_surface_create( cairo_format_t format, int width, int height ) { return( (*mp_image_surface_create)( format, width, height ) ); } - void surface_destroy( cairo_surface_t* surface ) { (*mp_surface_destroy)( surface ); } - cairo_status_t surface_status( cairo_surface_t* surface ) { return( (*mp_surface_status)( surface ) ); } - cairo_t* create( cairo_surface_t* surface ) { return( (*mp_create)( surface ) ); } - void destroy( cairo_t* cairo ) { (*mp_destroy )( cairo ); } - void matrix_init_identity( cairo_matrix_t* matrix ){ (*mp_matrix_init_identity)( matrix ); } - void matrix_translate( cairo_matrix_t* matrix, double nx, double ny ) { (*mp_matrix_translate)( matrix, nx, ny ); } - void matrix_scale( cairo_matrix_t* matrix, double sx, double sy ) {( *mp_matrix_scale )( matrix, sx, sy ); } - void matrix_rotate( cairo_matrix_t* matrix, double radians ) { ( *mp_matrix_rotate )( matrix, radians ); } - void transform( cairo_t* cairo, cairo_matrix_t *matrix ) { (*mp_transform)( cairo, matrix ); } - unsigned char* image_surface_get_data(cairo_surface_t* surface) { return( (*mp_image_surface_get_data)( surface ) ); } - int image_surface_get_width(cairo_surface_t* surface) { return( (*mp_image_surface_get_width)( surface ) ); } - int image_surface_get_height(cairo_surface_t* surface) { return( (*mp_image_surface_get_height)( surface ) ); } - int image_surface_get_stride(cairo_surface_t* surface) { return( (*mp_image_surface_get_stride)( surface ) ); } - - // LibRSVG void rsvg_init() { (*mp_rsvg_init)(); } RsvgHandle* rsvg_handle_new_from_data( const guint8* data, gsize size, GError** error) { return( (*mp_rsvg_handle_new_from_data)( data, size, error ) ); } gboolean rsvg_handle_close( RsvgHandle* handle, GError** error ) { return( (*mp_rsvg_handle_close)( handle, error ) ); } @@ -164,28 +137,11 @@ private: private: oslModule mpGObjectLib; - oslModule mpCairoLib; oslModule mpRSVGLib; // GObject gpointer (*mp_g_object_unref)( gpointer ); - // Cairo - cairo_surface_t* (*mp_image_surface_create)(cairo_format_t,int,int); - void (*mp_surface_destroy )(cairo_surface_t*); - cairo_status_t (*mp_surface_status)(cairo_surface_t*); - cairo_t* (*mp_create)(cairo_surface_t*); - void (*mp_destroy)(cairo_t*); - void (*mp_matrix_init_identity)(cairo_matrix_t*); - void (*mp_matrix_translate)( cairo_matrix_t*, double, double); - void (*mp_matrix_scale )( cairo_matrix_t*, double, double); - void (*mp_matrix_rotate)( cairo_matrix_t*, double); - void (*mp_transform)( cairo_t*, cairo_matrix_t*); - unsigned char* (*mp_image_surface_get_data)( cairo_surface_t* ); - int (*mp_image_surface_get_width)(cairo_surface_t* surface); - int (*mp_image_surface_get_height)(cairo_surface_t* surface); - int (*mp_image_surface_get_stride)(cairo_surface_t* surface); - // LibRSVG void (*mp_rsvg_init)( void ); RsvgHandle* (*mp_rsvg_handle_new_from_data)( const guint8*, gsize, GError** ); @@ -211,11 +167,9 @@ LibraryWrapper& LibraryWrapper::get() LibraryWrapper::LibraryWrapper() : mpGObjectLib( NULL ), - mpCairoLib( NULL ), mpRSVGLib( NULL ) { const ::rtl::OUString aGObjectLibName( RTL_CONSTASCII_USTRINGPARAM( VCL_RSVG_GOBJECT_LIBNAME ) ); - const ::rtl::OUString aCairoLibName( RTL_CONSTASCII_USTRINGPARAM( VCL_RSVG_CAIRO_LIBNAME ) ); const ::rtl::OUString aRSVGLibName( RTL_CONSTASCII_USTRINGPARAM( VCL_RSVG_LIBRSVG_LIBNAME ) ); bool bCont = true; @@ -235,47 +189,6 @@ LibraryWrapper::LibraryWrapper() : } } - // Cairo - if( bCont && ( NULL != ( mpCairoLib = osl_loadModule( aCairoLibName.pData, SAL_LOADMODULE_DEFAULT ) ) || - NULL != ( mpCairoLib = osl_loadModuleRelative( (oslGenericFunction)LibraryWrapper::get, - aCairoLibName.pData, SAL_LOADMODULE_DEFAULT ) ) - ) ) - { - mp_image_surface_create = ( cairo_surface_t* (*)( cairo_format_t, int, int ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_image_surface_create" ); - mp_surface_destroy = ( void (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_surface_destroy" ); - mp_surface_status = ( cairo_status_t (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_surface_status" ); - mp_create = ( cairo_t* (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_create" ); - mp_destroy = ( void (*)( cairo_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_destroy" ); - mp_matrix_init_identity = ( void (*)( cairo_matrix_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_init_identity" ); - mp_matrix_translate = ( void (*)( cairo_matrix_t*, double, double ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_translate" ); - mp_matrix_scale = ( void (*)( cairo_matrix_t*, double, double ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_scale" ); - mp_matrix_rotate = ( void (*)( cairo_matrix_t*, double ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_rotate" ); - mp_transform = ( void (*)( cairo_t*, cairo_matrix_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_transform" ); - mp_image_surface_get_data = ( unsigned char* (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_image_surface_get_data" ); - mp_image_surface_get_width = ( int (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_image_surface_get_width" ); - mp_image_surface_get_height = ( int (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_image_surface_get_height" ); - mp_image_surface_get_stride = ( int (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_image_surface_get_stride" ); - - if( !( mp_image_surface_create && - mp_surface_destroy && - mp_surface_status && - mp_create && - mp_destroy && - mp_matrix_init_identity && - mp_matrix_translate && - mp_matrix_scale && - mp_matrix_rotate && - mp_transform && - mp_image_surface_get_data && - mp_image_surface_get_width && - mp_image_surface_get_height && - mp_image_surface_get_stride ) ) - { - OSL_TRACE( "not all needed symbols were found in cairo library" ); - bCont = false; - } - } - // LibRSVG if( bCont && ( NULL != ( mpRSVGLib = osl_loadModule( aRSVGLibName.pData, SAL_LOADMODULE_DEFAULT ) ) || NULL != ( mpRSVGLib = osl_loadModuleRelative( (oslGenericFunction)LibraryWrapper::get, @@ -302,10 +215,9 @@ LibraryWrapper::LibraryWrapper() : } OSL_ENSURE( mpGObjectLib, "g-object library could not be loaded" ); - OSL_ENSURE( mpCairoLib, "cairo library could not be loaded" ); OSL_ENSURE( mpRSVGLib, "librsvg library could not be loaded" ); - bCont = bCont && mpGObjectLib != NULL && mpCairoLib != NULL && mpRSVGLib != NULL; + bCont = bCont && mpGObjectLib != NULL && mpRSVGLib != NULL; // unload all libraries in case of failure if( !bCont ) @@ -316,12 +228,6 @@ LibraryWrapper::LibraryWrapper() : mpRSVGLib = NULL; } - if( mpCairoLib ) - { - osl_unloadModule( mpCairoLib ); - mpCairoLib = NULL; - } - if( mpGObjectLib ) { osl_unloadModule( mpGObjectLib ); @@ -426,11 +332,10 @@ void Rasterizer::implFreeRsvgHandle() uno::Reference< graphic::XGraphic > Rasterizer::implGetXGraphicFromSurface( cairo_surface_t* pSurface ) const { - LibraryWrapper& rLib = LibraryWrapper::get(); - unsigned char* pData = rLib.image_surface_get_data( pSurface ); - const sal_Int32 nWidth = rLib.image_surface_get_width( pSurface ); - const sal_Int32 nHeight =rLib.image_surface_get_height( pSurface ); - const sal_Int32 nStride = rLib.image_surface_get_stride( pSurface ); + unsigned char* pData = cairo_image_surface_get_data( pSurface ); + const sal_Int32 nWidth = cairo_image_surface_get_width( pSurface ); + const sal_Int32 nHeight = cairo_image_surface_get_height( pSurface ); + const sal_Int32 nStride = cairo_image_surface_get_stride( pSurface ); uno::Reference< graphic::XGraphic > xRet; @@ -563,31 +468,31 @@ uno::Reference< graphic::XGraphic > SAL_CALL Rasterizer::rasterize( ::sal_uInt32 if( mpRsvgHandle && rLib.isValid() && nWidth && nHeight && mnDefaultWidth && mnDefaultHeight ) { - cairo_surface_t* pSurface = rLib.image_surface_create( CAIRO_FORMAT_ARGB32, nWidth, nHeight ); + cairo_surface_t* pSurface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, nWidth, nHeight ); - if( pSurface && ( CAIRO_STATUS_SUCCESS == rLib.surface_status( pSurface ) ) ) + if( pSurface && ( CAIRO_STATUS_SUCCESS == cairo_surface_status( pSurface ) ) ) { - cairo_t* pCr = rLib.create( pSurface ); + cairo_t* pCr = cairo_create( pSurface ); if( pCr ) { cairo_matrix_t aMatrix; - rLib.matrix_init_identity( &aMatrix ); - rLib.matrix_scale( &aMatrix, + cairo_matrix_init_identity( &aMatrix ); + cairo_matrix_scale( &aMatrix, static_cast< double >( nWidth ) / mnDefaultWidth, static_cast< double >( nHeight ) / mnDefaultHeight ); - rLib.transform( pCr, &aMatrix ); + cairo_transform( pCr, &aMatrix ); if( rLib.rsvg_handle_render_cairo( mpRsvgHandle, pCr ) ) { xRet = implGetXGraphicFromSurface( pSurface ); } - rLib.destroy( pCr ); + cairo_destroy( pCr ); } - rLib.surface_destroy( pSurface ); + cairo_surface_destroy( pSurface ); OSL_ENSURE( xRet.is(), "SVG *not* rendered successfully" ); } } @@ -638,3 +543,5 @@ uno::Reference< uno::XInterface > SAL_CALL Rasterizer_createInstance( const uno: } // namespace rsvg } // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/components/stringmirror.cxx b/vcl/source/components/stringmirror.cxx index 78806914a7c4..70bf44b568d0 100644 --- a/vcl/source/components/stringmirror.cxx +++ b/vcl/source/components/stringmirror.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -121,3 +122,5 @@ Sequence< OUString > SAL_CALL StringMirror::getSupportedServiceNames() throw (Ru } } // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 69a3fdbdce9d..4929a8bfa01a 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -241,11 +241,11 @@ static int ImplKommaPointCharEqual( xub_Unicode c1, xub_Unicode c2 ) // ----------------------------------------------------------------------- static XubString ImplPatternReformat( const XubString& rStr, - const ByteString& rEditMask, + const rtl::OString& rEditMask, const XubString& rLiteralMask, sal_uInt16 nFormatFlags ) { - if ( !rEditMask.Len() ) + if (rEditMask.isEmpty()) return rStr; XubString aStr = rStr; @@ -258,14 +258,14 @@ static XubString ImplPatternReformat( const XubString& rStr, xub_StrLen i = 0; xub_StrLen n; - while ( i < rEditMask.Len() ) + while ( i < rEditMask.getLength() ) { if ( nStrIndex >= aStr.Len() ) break; cChar = aStr.GetChar(nStrIndex); cLiteral = rLiteralMask.GetChar(i); - cMask = rEditMask.GetChar(i); + cMask = rEditMask[i]; // Aktuelle Position ein Literal if ( cMask == EDITMASK_LITERAL ) @@ -281,11 +281,11 @@ static XubString ImplPatternReformat( const XubString& rStr, // Dies ist dann der Fall, wenn es nicht in das Muster // des naechsten nicht Literal-Zeichens passt n = i+1; - while ( n < rEditMask.Len() ) + while ( n < rEditMask.getLength() ) { - if ( rEditMask.GetChar(n) != EDITMASK_LITERAL ) + if ( rEditMask[n] != EDITMASK_LITERAL ) { - if ( !ImplIsPatternChar( cChar, rEditMask.GetChar(n) ) ) + if ( !ImplIsPatternChar( cChar, rEditMask[n] ) ) nStrIndex++; break; } @@ -318,9 +318,9 @@ static XubString ImplPatternReformat( const XubString& rStr, if ( nFormatFlags & PATTERN_FORMAT_EMPTYLITERALS ) { n = i; - while ( n < rEditMask.Len() ) + while ( n < rEditMask.getLength() ) { - if ( rEditMask.GetChar( n ) == EDITMASK_LITERAL ) + if ( rEditMask[n] == EDITMASK_LITERAL ) { if ( ImplKommaPointCharEqual( cChar, rLiteralMask.GetChar( n ) ) ) i = n+1; @@ -346,7 +346,7 @@ static XubString ImplPatternReformat( const XubString& rStr, // ----------------------------------------------------------------------- -static void ImplPatternMaxPos( const XubString rStr, const ByteString& rEditMask, +static void ImplPatternMaxPos( const XubString rStr, const rtl::OString& rEditMask, sal_uInt16 nFormatFlags, sal_Bool bSameMask, sal_uInt16 nCursorPos, sal_uInt16& rPos ) { @@ -360,7 +360,7 @@ static void ImplPatternMaxPos( const XubString rStr, const ByteString& rEditMask { while ( nMaxPos ) { - if ( (rEditMask.GetChar(nMaxPos-1) != EDITMASK_LITERAL) && + if ( (rEditMask[nMaxPos-1] != EDITMASK_LITERAL) && (rStr.GetChar(nMaxPos-1) != ' ') ) break; nMaxPos--; @@ -369,9 +369,9 @@ static void ImplPatternMaxPos( const XubString rStr, const ByteString& rEditMask // Wenn wir vor einem Literal stehen, dann solange weitersuchen, // bis erste Stelle nach Literal xub_StrLen nTempPos = nMaxPos; - while ( nTempPos < rEditMask.Len() ) + while ( nTempPos < rEditMask.getLength() ) { - if ( rEditMask.GetChar(nTempPos) != EDITMASK_LITERAL ) + if ( rEditMask[nTempPos] != EDITMASK_LITERAL ) { nMaxPos = nTempPos; break; @@ -390,7 +390,7 @@ static void ImplPatternMaxPos( const XubString rStr, const ByteString& rEditMask // ----------------------------------------------------------------------- static void ImplPatternProcessStrictModify( Edit* pEdit, - const ByteString& rEditMask, + const rtl::OString& rEditMask, const XubString& rLiteralMask, sal_uInt16 nFormatFlags, sal_Bool bSameMask ) { @@ -403,14 +403,14 @@ static void ImplPatternProcessStrictModify( Edit* pEdit, xub_StrLen nMaxLen = aText.Len(); while ( i < nMaxLen ) { - if ( (rEditMask.GetChar( i ) != EDITMASK_LITERAL) && + if ( (rEditMask[i] != EDITMASK_LITERAL) && (aText.GetChar( i ) != ' ') ) break; i++; } // Alle Literalzeichen beibehalten - while ( i && (rEditMask.GetChar( i ) == EDITMASK_LITERAL) ) + while ( i && (rEditMask[i] == EDITMASK_LITERAL) ) i--; aText.Erase( 0, i ); } @@ -442,14 +442,14 @@ static void ImplPatternProcessStrictModify( Edit* pEdit, // ----------------------------------------------------------------------- -static xub_StrLen ImplPatternLeftPos( const ByteString& rEditMask, xub_StrLen nCursorPos ) +static xub_StrLen ImplPatternLeftPos(const rtl::OString& rEditMask, xub_StrLen nCursorPos) { // Vorheriges Zeichen suchen, was kein Literal ist xub_StrLen nNewPos = nCursorPos; xub_StrLen nTempPos = nNewPos; while ( nTempPos ) { - if ( rEditMask.GetChar(nTempPos-1) != EDITMASK_LITERAL ) + if ( rEditMask[nTempPos-1] != EDITMASK_LITERAL ) { nNewPos = nTempPos-1; break; @@ -461,16 +461,16 @@ static xub_StrLen ImplPatternLeftPos( const ByteString& rEditMask, xub_StrLen nC // ----------------------------------------------------------------------- -static xub_StrLen ImplPatternRightPos( const XubString& rStr, const ByteString& rEditMask, +static xub_StrLen ImplPatternRightPos( const XubString& rStr, const rtl::OString& rEditMask, sal_uInt16 nFormatFlags, sal_Bool bSameMask, xub_StrLen nCursorPos ) { // Naechstes Zeichen suchen, was kein Literal ist xub_StrLen nNewPos = nCursorPos; xub_StrLen nTempPos = nNewPos; - while ( nTempPos < rEditMask.Len() ) + while ( nTempPos < rEditMask.getLength() ) { - if ( rEditMask.GetChar(nTempPos+1) != EDITMASK_LITERAL ) + if ( rEditMask[nTempPos+1] != EDITMASK_LITERAL ) { nNewPos = nTempPos+1; break; @@ -484,14 +484,14 @@ static xub_StrLen ImplPatternRightPos( const XubString& rStr, const ByteString& // ----------------------------------------------------------------------- static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, - const ByteString& rEditMask, + const rtl::OString& rEditMask, const XubString& rLiteralMask, sal_Bool bStrictFormat, sal_uInt16 nFormatFlags, sal_Bool bSameMask, sal_Bool& rbInKeyInput ) { - if ( !rEditMask.Len() || !bStrictFormat ) + if ( rEditMask.isEmpty() || !bStrictFormat ) return sal_False; Selection aOldSel = pEdit->GetSelection(); @@ -533,8 +533,8 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, { // Home ist Position des ersten nicht literalen Zeichens nNewPos = 0; - while ( (nNewPos < rEditMask.Len()) && - (rEditMask.GetChar(nNewPos) == EDITMASK_LITERAL) ) + while ( (nNewPos < rEditMask.getLength()) && + (rEditMask[nNewPos] == EDITMASK_LITERAL) ) nNewPos++; // Home sollte nicht nach rechts wandern if ( nCursorPos < nNewPos ) @@ -548,9 +548,9 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, else if ( nKeyCode == KEY_END ) { // End ist die Position des letzten nicht literalen Zeichens - nNewPos = rEditMask.Len(); + nNewPos = rEditMask.getLength(); while ( nNewPos && - (rEditMask.GetChar(nNewPos-1) == EDITMASK_LITERAL) ) + (rEditMask[nNewPos-1] == EDITMASK_LITERAL) ) nNewPos--; // Hier nehmen wir Selectionsanfang als minimum, da falls durch // Focus alles selektiert ist, ist eine kleine Position schon @@ -601,7 +601,7 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, { if ( bSameMask ) { - if ( rEditMask.GetChar( nNewPos ) != EDITMASK_LITERAL ) + if ( rEditMask[nNewPos] != EDITMASK_LITERAL ) aStr.Erase( nNewPos, 1 ); } else @@ -647,9 +647,9 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, aSel.Justify(); nNewPos = (xub_StrLen)aSel.Min(); - if ( nNewPos < rEditMask.Len() ) + if ( nNewPos < rEditMask.getLength() ) { - xub_Unicode cPattChar = ImplPatternChar( cChar, rEditMask.GetChar(nNewPos) ); + xub_Unicode cPattChar = ImplPatternChar( cChar, rEditMask[nNewPos] ); if ( cPattChar ) cChar = cPattChar; else @@ -661,17 +661,17 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, // nicht dazu fuehren, das der Anwender dann da steht, wo // er nicht stehen wollte. if ( nNewPos && - (rEditMask.GetChar(nNewPos-1) != EDITMASK_LITERAL) && + (rEditMask[nNewPos-1] != EDITMASK_LITERAL) && !aSel.Len() ) { // Naechstes Zeichen suchen, was kein Literal ist nTempPos = nNewPos; - while ( nTempPos < rEditMask.Len() ) + while ( nTempPos < rEditMask.getLength() ) { - if ( rEditMask.GetChar(nTempPos) == EDITMASK_LITERAL ) + if ( rEditMask[nTempPos] == EDITMASK_LITERAL ) { // Gilt nur, wenn ein Literalzeichen vorhanden - if ( (rEditMask.GetChar(nTempPos+1) != EDITMASK_LITERAL ) && + if ( (rEditMask[nTempPos+1] != EDITMASK_LITERAL ) && ImplKommaPointCharEqual( cChar, rLiteralMask.GetChar(nTempPos) ) ) { nTempPos++; @@ -705,7 +705,7 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, while ( n && (n > nNewPos) ) { if ( (aStr.GetChar( n-1 ) != ' ') && - ((n > rEditMask.Len()) || (rEditMask.GetChar(n-1) != EDITMASK_LITERAL)) ) + ((n > rEditMask.getLength()) || (rEditMask[n-1] != EDITMASK_LITERAL)) ) break; n--; @@ -715,14 +715,14 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, if ( aSel.Len() ) aStr.Erase( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() ); - if ( aStr.Len() < rEditMask.Len() ) + if ( aStr.Len() < rEditMask.getLength() ) { // String evtl. noch bis Cursor-Position erweitern if ( aStr.Len() < nNewPos ) aStr += rLiteralMask.Copy( aStr.Len(), nNewPos-aStr.Len() ); if ( nNewPos < aStr.Len() ) aStr.Insert( cChar, nNewPos ); - else if ( nNewPos < rEditMask.Len() ) + else if ( nNewPos < rEditMask.getLength() ) aStr += cChar; aStr = ImplPatternReformat( aStr, rEditMask, rLiteralMask, nFormatFlags ); } @@ -740,7 +740,7 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, if ( nNewPos < aStr.Len() ) aStr.SetChar( nNewPos, cChar ); - else if ( nNewPos < rEditMask.Len() ) + else if ( nNewPos < rEditMask.getLength() ) aStr += cChar; } @@ -764,19 +764,19 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, // ----------------------------------------------------------------------- -void PatternFormatter::ImplSetMask( const ByteString& rEditMask, - const XubString& rLiteralMask ) +void PatternFormatter::ImplSetMask(const rtl::OString& rEditMask, + const XubString& rLiteralMask) { - maEditMask = rEditMask; + m_aEditMask = rEditMask; maLiteralMask = rLiteralMask; mbSameMask = sal_True; - if ( maEditMask.Len() != maLiteralMask.Len() ) + if ( m_aEditMask.getLength() != maLiteralMask.Len() ) { - if ( maEditMask.Len() < maLiteralMask.Len() ) - maLiteralMask.Erase( maEditMask.Len() ); + if ( m_aEditMask.getLength() < maLiteralMask.Len() ) + maLiteralMask.Erase(m_aEditMask.getLength()); else - maLiteralMask.Expand( maEditMask.Len(), ' ' ); + maLiteralMask.Expand(m_aEditMask.getLength(), ' '); } // StrictModus erlaubt nur Input-Mode, wenn als Maske nur @@ -785,9 +785,9 @@ void PatternFormatter::ImplSetMask( const ByteString& rEditMask, // nicht zugelassen sind xub_StrLen i = 0; sal_Char c = 0; - while ( i < rEditMask.Len() ) + while ( i < rEditMask.getLength() ) { - sal_Char cTemp = rEditMask.GetChar( i ); + sal_Char cTemp = rEditMask[i]; if ( cTemp != EDITMASK_LITERAL ) { if ( (cTemp == EDITMASK_ALLCHAR) || @@ -830,7 +830,7 @@ PatternFormatter::PatternFormatter() void PatternFormatter::ImplLoadRes( const ResId& rResId ) { - ByteString aEditMask; + rtl::OString aEditMask; XubString aLiteralMask; ResMgr* pMgr = rResId.GetResMgr(); if( pMgr ) @@ -841,7 +841,10 @@ void PatternFormatter::ImplLoadRes( const ResId& rResId ) SetStrictFormat( (sal_Bool)pMgr->ReadShort() ); if ( PATTERNFORMATTER_EDITMASK & nMask ) - aEditMask = ByteString( pMgr->ReadString(), RTL_TEXTENCODING_ASCII_US ); + { + aEditMask = rtl::OUStringToOString(pMgr->ReadString(), + RTL_TEXTENCODING_ASCII_US); + } if ( PATTERNFORMATTER_LITTERALMASK & nMask ) aLiteralMask = pMgr->ReadString(); @@ -859,7 +862,7 @@ PatternFormatter::~PatternFormatter() // ----------------------------------------------------------------------- -void PatternFormatter::SetMask( const ByteString& rEditMask, +void PatternFormatter::SetMask( const rtl::OString& rEditMask, const XubString& rLiteralMask ) { ImplSetMask( rEditMask, rLiteralMask ); @@ -885,7 +888,7 @@ XubString PatternFormatter::GetString() const if ( !GetField() ) return ImplGetSVEmptyStr(); else - return ImplPatternReformat( GetField()->GetText(), maEditMask, maLiteralMask, mnFormatFlags ); + return ImplPatternReformat( GetField()->GetText(), m_aEditMask, maLiteralMask, mnFormatFlags ); } // ----------------------------------------------------------------------- @@ -894,7 +897,7 @@ void PatternFormatter::Reformat() { if ( GetField() ) { - ImplSetText( ImplPatternReformat( GetField()->GetText(), maEditMask, maLiteralMask, mnFormatFlags ) ); + ImplSetText( ImplPatternReformat( GetField()->GetText(), m_aEditMask, maLiteralMask, mnFormatFlags ) ); if ( !mbSameMask && IsStrictFormat() && !GetField()->IsReadOnly() ) GetField()->SetInsertMode( sal_False ); } @@ -3047,35 +3050,6 @@ Time TimeFormatter::GetTime() const // ----------------------------------------------------------------------- -Time TimeFormatter::GetRealTime() const -{ - Time aTime( 0, 0, 0 ); - - if ( GetField() ) - { - sal_Bool bAllowMailformed = ImplAllowMalformedInput(); - if ( !ImplTimeGetValue( GetField()->GetText(), aTime, GetFormat(), IsDuration(), ImplGetLocaleDataWrapper(), !bAllowMailformed ) ) - if ( bAllowMailformed ) - aTime = GetInvalidTime(); - } - - return aTime; -} - -// ----------------------------------------------------------------------- - -sal_Bool TimeFormatter::IsTimeModified() const -{ - if ( ImplGetEmptyFieldValue() ) - return !IsEmptyTime(); - else if ( GetTime() != maFieldTime ) - return sal_True; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - void TimeFormatter::Reformat() { if ( !GetField() ) @@ -3320,26 +3294,6 @@ TimeBox::TimeBox( Window* pParent, WinBits nWinStyle ) : // ----------------------------------------------------------------------- -TimeBox::TimeBox( Window* pParent, const ResId& rResId ) : - ComboBox( WINDOW_TIMEBOX ) -{ - rResId.SetRT( RSC_TIMEBOX ); - WinBits nStyle = ImplInitRes( rResId ); - ComboBox::ImplInit( pParent, nStyle ); - SetField( this ); - SetText( ImplGetLocaleDataWrapper().getTime( maFieldTime, sal_False, sal_False ) ); - ComboBox::ImplLoadRes( rResId ); - ResMgr* pMgr = rResId.GetResMgr(); - if( pMgr ) - TimeFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes(), *pMgr ) ); - Reformat(); - - if ( !(nStyle & WB_HIDE) ) - Show(); -} - -// ----------------------------------------------------------------------- - TimeBox::~TimeBox() { } @@ -3411,58 +3365,4 @@ void TimeBox::ReformatAll() SetUpdateMode( sal_True ); } -// ----------------------------------------------------------------------- - -void TimeBox::InsertTime( const Time& rTime, sal_uInt16 nPos ) -{ - Time aTime = rTime; - if ( aTime > GetMax() ) - aTime = GetMax(); - else if ( aTime < GetMin() ) - aTime = GetMin(); - - sal_Bool bSec = sal_False; - sal_Bool b100Sec = sal_False; - if ( GetFormat() == TIMEF_SEC ) - bSec = sal_True; - if ( GetFormat() == TIMEF_100TH_SEC || GetFormat() == TIMEF_SEC_CS ) - bSec = b100Sec = sal_True; - ComboBox::InsertEntry( ImplGetLocaleDataWrapper().getTime( aTime, bSec, b100Sec ), nPos ); -} - -// ----------------------------------------------------------------------- - -void TimeBox::RemoveTime( const Time& rTime ) -{ - sal_Bool bSec = sal_False; - sal_Bool b100Sec = sal_False; - if ( GetFormat() == TIMEF_SEC ) - bSec = sal_True; - if ( GetFormat() == TIMEF_100TH_SEC || TIMEF_SEC_CS ) - bSec = b100Sec = sal_True; - ComboBox::RemoveEntry( ImplGetLocaleDataWrapper().getTime( rTime, bSec, b100Sec ) ); -} - -// ----------------------------------------------------------------------- - -Time TimeBox::GetTime( sal_uInt16 nPos ) const -{ - Time aTime( 0, 0, 0 ); - ImplTimeGetValue( ComboBox::GetEntry( nPos ), aTime, GetFormat(), IsDuration(), ImplGetLocaleDataWrapper() ); - return aTime; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 TimeBox::GetTimePos( const Time& rTime ) const -{ - sal_Bool bSec = sal_False; - sal_Bool b100Sec = sal_False; - if ( GetFormat() == TIMEF_SEC ) - bSec = sal_True; - if ( GetFormat() == TIMEF_100TH_SEC || TIMEF_SEC_CS ) - 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/quickselectionengine.cxx b/vcl/source/control/quickselectionengine.cxx index 2d32393bf79a..ee479d27ab20 100644 --- a/vcl/source/control/quickselectionengine.cxx +++ b/vcl/source/control/quickselectionengine.cxx @@ -1,3 +1,4 @@ +/* -*- 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,5 @@ namespace vcl //........................................................................ } // namespace vcl //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 765907721ed6..7bdd0d3af0bf 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1981,18 +1981,6 @@ TabPage* TabControl::GetTabPage( sal_uInt16 nPageId ) const // ----------------------------------------------------------------------- -sal_uInt16 TabControl::GetTabPageResId( sal_uInt16 nPageId ) const -{ - ImplTabItem* pItem = ImplGetItem( nPageId ); - - if ( pItem ) - return pItem->mnTabPageResId; - else - return 0; -} - -// ----------------------------------------------------------------------- - void TabControl::SetPageText( sal_uInt16 nPageId, const XubString& rText ) { ImplTabItem* pItem = ImplGetItem( nPageId ); @@ -2059,16 +2047,6 @@ const XubString& TabControl::GetHelpText( sal_uInt16 nPageId ) const // ----------------------------------------------------------------------- -void TabControl::SetHelpId( sal_uInt16 nPageId, const rtl::OString& rHelpId ) -{ - ImplTabItem* pItem = ImplGetItem( nPageId ); - - if ( pItem ) - pItem->maHelpId = rHelpId; -} - -// ----------------------------------------------------------------------- - rtl::OString TabControl::GetHelpId( sal_uInt16 nPageId ) const { rtl::OString aRet; @@ -2097,14 +2075,6 @@ void TabControl::SetPageImage( sal_uInt16 i_nPageId, const Image& i_rImage ) // ----------------------------------------------------------------------- -const Image* TabControl::GetPageImage( sal_uInt16 i_nPageId ) const -{ - const ImplTabItem* pItem = ImplGetItem( i_nPageId ); - return pItem ? &pItem->maTabImage : NULL; -} - -// ----------------------------------------------------------------------- - Rectangle TabControl::GetCharacterBounds( sal_uInt16 nPageId, long nIndex ) const { Rectangle aRet; diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx index a55fdb3eb379..4aa456c1ddcf 100644 --- a/vcl/source/control/throbber.cxx +++ b/vcl/source/control/throbber.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -323,3 +324,5 @@ IMPL_LINK( Throbber, TimeOutHdl, void*, EMPTYARG ) return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index eed5a9e1ac07..b6516fcc624b 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -1868,7 +1868,6 @@ const char* CffSubsetterContext::getGlyphName( int nGlyphIndex) class Type1Emitter { public: - explicit Type1Emitter( const char* pOutFileName, bool bPfbSubset = true); explicit Type1Emitter( FILE* pOutFile, bool bPfbSubset = true); /*virtual*/ ~Type1Emitter( void); void setSubsetName( const char* ); @@ -1895,20 +1894,6 @@ public: // -------------------------------------------------------------------- -Type1Emitter::Type1Emitter( const char* pPfbFileName, bool bPfbSubset) -: mpFileOut( NULL) -, mbCloseOutfile( true) -, mnEECryptR( 55665) // default eexec seed, TODO: mnEECryptSeed -, mpPtr( maBuffer) -, mbPfbSubset( bPfbSubset) -, mnHexLineCol( 0) -{ - mpFileOut = fopen( pPfbFileName, "wb"); - maSubsetName[0] = '\0'; -} - -// -------------------------------------------------------------------- - Type1Emitter::Type1Emitter( FILE* pOutFile, bool bPfbSubset) : mpFileOut( pOutFile) , mbCloseOutfile( false) diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index da0d84cec089..7dcdc42e88f4 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -162,7 +162,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, } } - if( !aFeatureIndexList.size() ) + if( aFeatureIndexList.empty() ) return true; UshortList aLookupIndexList; @@ -318,7 +318,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, } // now apply the glyph substitutions that have been collected in this subtable - if( aSubstVector.size() > 0 ) + if( !aSubstVector.empty() ) { GlyphSubstitution* pGSubstitution = new GlyphSubstitution; pTTFile->pGSubstitution = (void*)pGSubstitution; diff --git a/vcl/source/fontsubset/list.c b/vcl/source/fontsubset/list.c index def5faa7b553..8b0b0f827a20 100644 --- a/vcl/source/fontsubset/list.c +++ b/vcl/source/fontsubset/list.c @@ -140,24 +140,6 @@ int listIsEmpty(list this) return this->aCount == 0; } -int listFind(list this, void *el) -{ - lnode *ptr; - assert(this != 0); - - ptr = this->head; - - while (ptr) { - if (ptr->value == el) { - this->cptr = ptr; - return 1; - } - ptr = ptr->next; - } - - return 0; -} - int listNext(list this) { return listSkipForward(this, 1); @@ -201,21 +183,6 @@ int listToLast(list this) return 0; } -int listPositionAt(list this, int n) /*- returns the actual position number */ -{ - int m = 0; - assert(this != 0); - - this->cptr = this->head; - while (n != 0) { - if (this->cptr->next == 0) break; - this->cptr = this->cptr->next; - n--; - m++; - } - return m; -} - list listAppend(list this, void *el) { assert(this != 0); diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index 63d0010bd5d2..9dcbce01ffaf 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -100,7 +100,6 @@ Animation::Animation() : { DBG_CTOR( Animation, NULL ); maTimer.SetTimeoutHdl( LINK( this, Animation, ImplTimeoutHdl ) ); - mpViewList = new List; } // ----------------------------------------------------------------------- @@ -117,11 +116,10 @@ Animation::Animation( const Animation& rAnimation ) : { DBG_CTOR( Animation, NULL ); - for( long i = 0, nCount = rAnimation.maList.Count(); i < nCount; i++ ) - maList.Insert( new AnimationBitmap( *(AnimationBitmap*) rAnimation.maList.GetObject( i ) ), LIST_APPEND ); + for( size_t i = 0, nCount = rAnimation.maList.size(); i < nCount; i++ ) + maList.push_back( new AnimationBitmap( *rAnimation.maList[ i ] ) ); maTimer.SetTimeoutHdl( LINK( this, Animation, ImplTimeoutHdl ) ); - mpViewList = new List; mnLoops = mbLoopTerminated ? 0 : mnLoopCount; } @@ -134,13 +132,11 @@ Animation::~Animation() if( mbIsInAnimation ) Stop(); - for( void* pStepBmp = maList.First(); pStepBmp; pStepBmp = maList.Next() ) - delete (AnimationBitmap*) pStepBmp; + for( size_t i = 0, n = maList.size(); i < n; ++i ) + delete maList[ i ]; - for( void* pView = mpViewList->First(); pView; pView = mpViewList->Next() ) - delete (ImplAnimView*) pView; - - delete mpViewList; + for( size_t i = 0, n = maViewList.size(); i < n; ++i ) + delete maViewList[ i ]; } // ----------------------------------------------------------------------- @@ -149,8 +145,8 @@ Animation& Animation::operator=( const Animation& rAnimation ) { Clear(); - for( long i = 0, nCount = rAnimation.maList.Count(); i < nCount; i++ ) - maList.Insert( new AnimationBitmap( *(AnimationBitmap*) rAnimation.maList.GetObject( i ) ), LIST_APPEND ); + for( size_t i = 0, nCount = rAnimation.maList.size(); i < nCount; i++ ) + maList.push_back( new AnimationBitmap( *rAnimation.maList[ i ] ) ); maGlobalSize = rAnimation.maGlobalSize; maBitmapEx = rAnimation.maBitmapEx; @@ -168,20 +164,20 @@ Animation& Animation::operator=( const Animation& rAnimation ) sal_Bool Animation::operator==( const Animation& rAnimation ) const { - const sal_uLong nCount = maList.Count(); - sal_Bool bRet = sal_False; + const size_t nCount = maList.size(); + sal_Bool bRet = sal_False; - if( rAnimation.maList.Count() == nCount && - rAnimation.maBitmapEx == maBitmapEx && - rAnimation.maGlobalSize == maGlobalSize && - rAnimation.meCycleMode == meCycleMode ) + if( rAnimation.maList.size() == nCount + && rAnimation.maBitmapEx == maBitmapEx + && rAnimation.maGlobalSize == maGlobalSize + && rAnimation.meCycleMode == meCycleMode + ) { bRet = sal_True; - for( sal_uLong n = 0; n < nCount; n++ ) + for( size_t n = 0; n < nCount; n++ ) { - if( ( *(AnimationBitmap*) maList.GetObject( n ) ) != - ( *(AnimationBitmap*) rAnimation.maList.GetObject( n ) ) ) + if( ( *maList[ n ] ) != ( *rAnimation.maList[ n ] ) ) { bRet = sal_False; break; @@ -194,29 +190,9 @@ sal_Bool Animation::operator==( const Animation& rAnimation ) const // ------------------------------------------------------------------ -sal_Bool Animation::IsEqual( const Animation& rAnimation ) const -{ - const sal_uLong nCount = maList.Count(); - sal_Bool bRet = sal_False; - - if( rAnimation.maList.Count() == nCount && - rAnimation.maBitmapEx.IsEqual( maBitmapEx ) && - rAnimation.maGlobalSize == maGlobalSize && - rAnimation.meCycleMode == meCycleMode ) - { - for( sal_uLong n = 0; ( n < nCount ) && !bRet; n++ ) - if( ( (AnimationBitmap*) maList.GetObject( n ) )->IsEqual( *(AnimationBitmap*) rAnimation.maList.GetObject( n ) ) ) - bRet = sal_True; - } - - return bRet; -} - -// ------------------------------------------------------------------ - sal_Bool Animation::IsEmpty() const { - return( maBitmapEx.IsEmpty() && !maList.Count() ); + return( maBitmapEx.IsEmpty() && maList.empty() ); } // ------------------------------------------------------------------ @@ -228,13 +204,13 @@ void Animation::SetEmpty() maGlobalSize = Size(); maBitmapEx.SetEmpty(); - for( void* pStepBmp = maList.First(); pStepBmp; pStepBmp = maList.Next() ) - delete (AnimationBitmap*) pStepBmp; - maList.Clear(); + for( size_t i = 0, n = maList.size(); i < n; ++i ) + delete maList[ i ]; + maList.clear(); - for( void* pView = mpViewList->First(); pView; pView = mpViewList->Next() ) - delete (ImplAnimView*) pView; - mpViewList->Clear(); + for( size_t i = 0, n = maViewList.size(); i < n; ++i ) + delete maViewList[ i ]; + maViewList.clear(); } // ----------------------------------------------------------------------- @@ -256,11 +232,13 @@ sal_Bool Animation::IsTransparent() const // ersetzt werden soll, muessen wir 'transparent' sein, um // richtig dargestellt zu werden, da die Appl. aus Optimierungsgruenden // kein Invalidate auf nicht-transp. Grafiken ausfuehren - for( long i = 0, nCount = maList.Count(); i < nCount; i++ ) + for( size_t i = 0, nCount = maList.size(); i < nCount; i++ ) { - const AnimationBitmap* pAnimBmp = (AnimationBitmap*) maList.GetObject( i ); + const AnimationBitmap* pAnimBmp = maList[ i ]; - if( DISPOSE_BACK == pAnimBmp->eDisposal && Rectangle( pAnimBmp->aPosPix, pAnimBmp->aSizePix ) != aRect ) + if( DISPOSE_BACK == pAnimBmp->eDisposal + && Rectangle( pAnimBmp->aPosPix, pAnimBmp->aSizePix ) != aRect + ) { bRet = sal_True; break; @@ -279,9 +257,9 @@ sal_uLong Animation::GetSizeBytes() const { sal_uLong nSizeBytes = GetBitmapEx().GetSizeBytes(); - for( long i = 0, nCount = maList.Count(); i < nCount; i++ ) + for( size_t i = 0, nCount = maList.size(); i < nCount; i++ ) { - const AnimationBitmap* pAnimBmp = (AnimationBitmap*) maList.GetObject( i ); + const AnimationBitmap* pAnimBmp = maList[ i ]; nSizeBytes += pAnimBmp->aBmpEx.GetSizeBytes(); } @@ -295,7 +273,7 @@ sal_uLong Animation::GetChecksum() const SVBT32 aBT32; sal_uInt32 nCrc = GetBitmapEx().GetChecksum(); - UInt32ToSVBT32( maList.Count(), aBT32 ); + UInt32ToSVBT32( maList.size(), aBT32 ); nCrc = rtl_crc32( nCrc, aBT32, 4 ); UInt32ToSVBT32( maGlobalSize.Width(), aBT32 ); @@ -307,9 +285,9 @@ sal_uLong Animation::GetChecksum() const UInt32ToSVBT32( (long) meCycleMode, aBT32 ); nCrc = rtl_crc32( nCrc, aBT32, 4 ); - for( long i = 0, nCount = maList.Count(); i < nCount; i++ ) + for( size_t i = 0, nCount = maList.size(); i < nCount; i++ ) { - UInt32ToSVBT32( ( (AnimationBitmap*) maList.GetObject( i ) )->GetChecksum(), aBT32 ); + UInt32ToSVBT32( maList[ i ]->GetChecksum(), aBT32 ); nCrc = rtl_crc32( nCrc, aBT32, 4 ); } @@ -331,16 +309,19 @@ sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& { sal_Bool bRet = sal_False; - if( maList.Count() ) + if( !maList.empty() ) { - if( ( pOut->GetOutDevType() == OUTDEV_WINDOW ) && !mbLoopTerminated && - ( ANIMATION_TIMEOUT_ON_CLICK != ( (AnimationBitmap*) maList.GetObject( mnPos ) )->nWait ) ) + if( ( pOut->GetOutDevType() == OUTDEV_WINDOW ) + && !mbLoopTerminated + && ( ANIMATION_TIMEOUT_ON_CLICK != maList[ mnPos ]->nWait ) + ) { ImplAnimView* pView; ImplAnimView* pMatch = NULL; - for( pView = (ImplAnimView*) mpViewList->First(); pView; pView = (ImplAnimView*) mpViewList->Next() ) + for( size_t i = 0; i < maViewList.size(); ++i ) { + pView = maViewList[ i ]; if( pView->ImplMatches( pOut, nExtraData ) ) { if( pView->ImplGetOutPos() == rDestPt && @@ -351,7 +332,8 @@ sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& } else { - delete (ImplAnimView*) mpViewList->Remove( pView ); + delete maViewList[ i ]; + maViewList.erase( maViewList.begin() + i ); pView = NULL; } @@ -359,7 +341,7 @@ sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& } } - if( !mpViewList->Count() ) + if( maViewList.empty() ) { maTimer.Stop(); mbIsInAnimation = sal_False; @@ -367,11 +349,11 @@ sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& } if( !pMatch ) - mpViewList->Insert( new ImplAnimView( this, pOut, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev ), LIST_APPEND ); + maViewList.push_back( new ImplAnimView( this, pOut, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev ) ); if( !mbIsInAnimation ) { - ImplRestartTimer( ( (AnimationBitmap*) maList.GetObject( mnPos ) )->nWait ); + ImplRestartTimer( maList[ mnPos ]->nWait ); mbIsInAnimation = sal_True; } } @@ -388,20 +370,21 @@ sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& void Animation::Stop( OutputDevice* pOut, long nExtraData ) { - ImplAnimView* pView = (ImplAnimView*) mpViewList->First(); - - while( pView ) + for( size_t i = 0; i < maViewList.size(); ) { + + + ImplAnimView* pView = maViewList[ i ]; if( pView->ImplMatches( pOut, nExtraData ) ) { - delete (ImplAnimView*) mpViewList->Remove( pView ); - pView = (ImplAnimView*) mpViewList->GetCurObject(); + delete pView; + maViewList.erase( maViewList.begin() + i ); } else - pView = (ImplAnimView*) mpViewList->Next(); + i++; } - if( !mpViewList->Count() ) + if( maViewList.empty() ) { maTimer.Stop(); mbIsInAnimation = sal_False; @@ -419,19 +402,21 @@ void Animation::Draw( OutputDevice* pOut, const Point& rDestPt ) const void Animation::Draw( OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz ) const { - const sal_uLong nCount = maList.Count(); + const size_t nCount = maList.size(); if( nCount ) { - AnimationBitmap* pObj = (AnimationBitmap*) maList.GetObject( Min( mnPos, (long) nCount - 1L ) ); + AnimationBitmap* pObj = maList[ Min( mnPos, nCount - 1 ) ]; - if( pOut->GetConnectMetaFile() || ( pOut->GetOutDevType() == OUTDEV_PRINTER ) ) - ( (AnimationBitmap*) maList.GetObject( 0 ) )->aBmpEx.Draw( pOut, rDestPt, rDestSz ); + if( pOut->GetConnectMetaFile() + || ( pOut->GetOutDevType() == OUTDEV_PRINTER ) + ) + maList[ 0 ]->aBmpEx.Draw( pOut, rDestPt, rDestSz ); else if( ANIMATION_TIMEOUT_ON_CLICK == pObj->nWait ) pObj->aBmpEx.Draw( pOut, rDestPt, rDestSz ); else { - const sal_uLong nOldPos = mnPos; + const size_t nOldPos = mnPos; ( (Animation*) this )->mnPos = mbLoopTerminated ? ( nCount - 1UL ) : mnPos; delete new ImplAnimView( (Animation*) this, pOut, rDestPt, rDestSz, 0 ); ( (Animation*) this )->mnPos = nOldPos; @@ -448,35 +433,38 @@ void Animation::ImplRestartTimer( sal_uLong nTimeout ) } // ----------------------------------------------------------------------- +typedef ::std::vector< AInfo* > AInfoList_impl; IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) { - const sal_uLong nAnimCount = maList.Count(); + const size_t nAnimCount = maList.size(); + AInfoList_impl aAInfoList; if( nAnimCount ) { ImplAnimView* pView; - sal_Bool bGlobalPause = sal_True; + sal_Bool bGlobalPause = sal_True; if( maNotifyLink.IsSet() ) { AInfo* pAInfo; // create AInfo-List - for( pView = (ImplAnimView*) mpViewList->First(); pView; pView = (ImplAnimView*) mpViewList->Next() ) - maAInfoList.Insert( pView->ImplCreateAInfo() ); + for( size_t i = 0, n = maViewList.size(); i < n; ++i ) + aAInfoList.push_back( maViewList[ i ]->ImplCreateAInfo() ); maNotifyLink.Call( this ); // set view state from AInfo structure - for( pAInfo = (AInfo*) maAInfoList.First(); pAInfo; pAInfo = (AInfo*) maAInfoList.Next() ) + for( size_t i = 0, n = aAInfoList.size(); i < n; ++i ) { + pAInfo = aAInfoList[ i ]; if( !pAInfo->pViewData ) { pView = new ImplAnimView( this, pAInfo->pOutDev, pAInfo->aStartOrg, pAInfo->aStartSize, pAInfo->nExtraData ); - mpViewList->Insert( pView, LIST_APPEND ); + maViewList.push_back( pView ); } else pView = (ImplAnimView*) pAInfo->pViewData; @@ -486,18 +474,18 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) } // delete AInfo structures - for( pAInfo = (AInfo*) maAInfoList.First(); pAInfo; pAInfo = (AInfo*) maAInfoList.Next() ) - delete (AInfo*) pAInfo; - maAInfoList.Clear(); + for( size_t i = 0, n = aAInfoList.size(); i < n; ++i ) + delete aAInfoList[ i ]; + aAInfoList.clear(); // delete all unmarked views and reset marked state - pView = (ImplAnimView*) mpViewList->First(); - while( pView ) + for( size_t i = 0; i < maViewList.size(); ) { + pView = maViewList[ i ]; if( !pView->ImplIsMarked() ) { - delete (ImplAnimView*) mpViewList->Remove( pView ); - pView = (ImplAnimView*) mpViewList->GetCurObject(); + delete pView; + maViewList.erase( maViewList.begin() + i ); } else { @@ -505,20 +493,20 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) bGlobalPause = sal_False; pView->ImplSetMarked( sal_False ); - pView = (ImplAnimView*) mpViewList->Next(); + i++; } } } else bGlobalPause = sal_False; - if( !mpViewList->Count() ) + if( maViewList.empty() ) Stop(); else if( bGlobalPause ) ImplRestartTimer( 10 ); else { - AnimationBitmap* pStepBmp = (AnimationBitmap*) maList.GetObject( ++mnPos ); + AnimationBitmap* pStepBmp = (++mnPos < maList.size()) ? maList[ mnPos ] : NULL; if( !pStepBmp ) { @@ -527,7 +515,7 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) Stop(); mbLoopTerminated = sal_True; mnPos = nAnimCount - 1UL; - maBitmapEx = ( (AnimationBitmap*) maList.GetObject( mnPos ) )->aBmpEx; + maBitmapEx = maList[ mnPos ]->aBmpEx; return 0L; } else @@ -536,7 +524,7 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) mnLoops--; mnPos = 0; - pStepBmp = (AnimationBitmap*) maList.GetObject( mnPos ); + pStepBmp = maList[ mnPos ]; } } @@ -544,22 +532,22 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) // marked; in this case remove view, because area of output // lies out of display area of window; mark state is // set from view itself - pView = (ImplAnimView*) mpViewList->First(); - while( pView ) + for( size_t i = 0; i < maViewList.size(); ) { + pView = maViewList[ i ]; pView->ImplDraw( mnPos ); if( pView->ImplIsMarked() ) { - delete (ImplAnimView*) mpViewList->Remove( pView ); - pView = (ImplAnimView*) mpViewList->GetCurObject(); + delete pView; + maViewList.erase( maViewList.begin() + i ); } else - pView = (ImplAnimView*) mpViewList->Next(); + i++; } // stop or restart timer - if( !mpViewList->Count() ) + if( maViewList.empty() ) Stop(); else ImplRestartTimer( pStepBmp->nWait ); @@ -583,10 +571,10 @@ sal_Bool Animation::Insert( const AnimationBitmap& rStepBmp ) Rectangle aGlobalRect( aPoint, maGlobalSize ); maGlobalSize = aGlobalRect.Union( Rectangle( rStepBmp.aPosPix, rStepBmp.aSizePix ) ).GetSize(); - maList.Insert( new AnimationBitmap( rStepBmp ), LIST_APPEND ); + maList.push_back( new AnimationBitmap( rStepBmp ) ); // zunaechst nehmen wir die erste BitmapEx als Ersatz-BitmapEx - if( maList.Count() == 1 ) + if( maList.size() == 1 ) maBitmapEx = rStepBmp.aBmpEx; bRet = sal_True; @@ -599,24 +587,33 @@ sal_Bool Animation::Insert( const AnimationBitmap& rStepBmp ) const AnimationBitmap& Animation::Get( sal_uInt16 nAnimation ) const { - DBG_ASSERT( ( nAnimation < maList.Count() ), "No object at this position" ); - return *(AnimationBitmap*) maList.GetObject( nAnimation ); + DBG_ASSERT( ( nAnimation < maList.size() ), "No object at this position" ); + return *maList[ nAnimation ]; } // ----------------------------------------------------------------------- void Animation::Replace( const AnimationBitmap& rNewAnimationBitmap, sal_uInt16 nAnimation ) { - DBG_ASSERT( ( nAnimation < maList.Count() ), "No object at this position" ); + DBG_ASSERT( ( nAnimation < maList.size() ), "No object at this position" ); - delete (AnimationBitmap*) maList.Replace( new AnimationBitmap( rNewAnimationBitmap ), nAnimation ); + delete maList[ nAnimation ]; + maList[ nAnimation ] = new AnimationBitmap( rNewAnimationBitmap ); // Falls wir an erster Stelle einfuegen, // muessen wir natuerlich auch, // auch die Ersatzdarstellungs-BitmapEx // aktualisieren; - if ( ( !nAnimation && ( !mbLoopTerminated || ( maList.Count() == 1 ) ) ) || - ( ( nAnimation == maList.Count() - 1 ) && mbLoopTerminated ) ) + if ( ( !nAnimation + && ( !mbLoopTerminated + || ( maList.size() == 1 ) + ) + ) + || + ( ( nAnimation == maList.size() - 1 ) + && mbLoopTerminated + ) + ) { maBitmapEx = rNewAnimationBitmap.aBmpEx; } @@ -646,12 +643,12 @@ sal_Bool Animation::Convert( BmpConversion eConversion ) sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Convert( eConversion ); + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) + bRet = maList[ i ]->aBmpEx.Convert( eConversion ); maBitmapEx.Convert( eConversion ); } @@ -669,12 +666,12 @@ sal_Bool Animation::ReduceColors( sal_uInt16 nNewColorCount, BmpReduce eReduce ) sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.ReduceColors( nNewColorCount, eReduce ); + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) + bRet = maList[ i ]->aBmpEx.ReduceColors( nNewColorCount, eReduce ); maBitmapEx.ReduceColors( nNewColorCount, eReduce ); } @@ -692,12 +689,12 @@ sal_Bool Animation::Invert() sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Invert(); + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) + bRet = maList[ i ]->aBmpEx.Invert(); maBitmapEx.Invert(); } @@ -715,16 +712,15 @@ sal_Bool Animation::Mirror( sal_uLong nMirrorFlags ) sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; if( nMirrorFlags ) { - for( AnimationBitmap* pStepBmp = (AnimationBitmap*) maList.First(); - pStepBmp && bRet; - pStepBmp = (AnimationBitmap*) maList.Next() ) + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) { + AnimationBitmap* pStepBmp = maList[ i ]; if( ( bRet = pStepBmp->aBmpEx.Mirror( nMirrorFlags ) ) == sal_True ) { if( nMirrorFlags & BMP_MIRROR_HORZ ) @@ -746,29 +742,6 @@ sal_Bool Animation::Mirror( sal_uLong nMirrorFlags ) // ----------------------------------------------------------------------- -sal_Bool Animation::Dither( sal_uLong nDitherFlags ) -{ - DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); - - sal_Bool bRet; - - if( !IsInAnimation() && maList.Count() ) - { - bRet = sal_True; - - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Dither( nDitherFlags ); - - maBitmapEx.Dither( nDitherFlags ); - } - else - bRet = sal_False; - - return bRet; -} - -// ----------------------------------------------------------------------- - sal_Bool Animation::Adjust( short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, double fGamma, sal_Bool bInvert ) @@ -777,15 +750,19 @@ sal_Bool Animation::Adjust( short nLuminancePercent, short nContrastPercent, sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) { - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Adjust( nLuminancePercent, nContrastPercent, - nChannelRPercent, nChannelGPercent, nChannelBPercent, - fGamma, bInvert ); + bRet = maList[ i ]->aBmpEx.Adjust( nLuminancePercent, + nContrastPercent, + nChannelRPercent, + nChannelGPercent, + nChannelBPercent, + fGamma, bInvert + ); } maBitmapEx.Adjust( nLuminancePercent, nContrastPercent, @@ -806,12 +783,12 @@ sal_Bool Animation::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterPara sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Filter( eFilter, pFilterParam, pProgress ); + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) + bRet = maList[ i ]->aBmpEx.Filter( eFilter, pFilterParam, pProgress ); maBitmapEx.Filter( eFilter, pFilterParam, pProgress ); } @@ -830,7 +807,7 @@ SvStream& operator<<( SvStream& rOStm, const Animation& rAnimation ) if( nCount ) { const ByteString aDummyStr; - const sal_uInt32 nDummy32 = 0UL; + const sal_uInt32 nDummy32 = 0UL; // Falls keine BitmapEx gesetzt wurde, schreiben wir // einfach die erste Bitmap der Animation diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 21f977a45396..193c066b1d98 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -41,6 +41,7 @@ #include <vcl/lineinfo.hxx> #include <vcl/salbtype.hxx> #include <vcl/cvtsvm.hxx> +#include <rtl/strbuf.hxx> // ----------- // - Defines - @@ -2431,10 +2432,11 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, #ifdef DBG_UTIL default: { - ByteString aStr( "Missing implementation for Action#: " ); - aStr += ByteString::CreateFromInt32( pAction->GetType() ); - aStr += '!'; - OSL_FAIL( aStr.GetBuffer() ); + rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM( + "Missing implementation for Action#: ")); + aStr.append(static_cast<sal_Int32>(pAction->GetType())); + aStr.append('!'); + OSL_FAIL(aStr.getStr()); } break; #endif diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 984386028cdc..30740176d676 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -254,6 +254,7 @@ size_t ImpLabelList::ImplGetLabelPos( const String& rLabelName ) // --------------- GDIMetaFile::GDIMetaFile() : + nCurrentActionElement( 0 ), aPrefSize ( 1, 1 ), pPrev ( NULL ), pNext ( NULL ), diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index eb22d31937df..8fa11e969aa8 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -662,13 +662,6 @@ void Graphic::ResetAnimationLoopCount() // ------------------------------------------------------------------------ -List* Graphic::GetAnimationInfoList() const -{ - return mpImpGraphic->ImplGetAnimationInfoList(); -} - -// ------------------------------------------------------------------------ - GraphicReader* Graphic::GetContext() { return mpImpGraphic->ImplGetContext(); diff --git a/vcl/source/gdi/graphictools.cxx b/vcl/source/gdi/graphictools.cxx index 2e20a3639790..251261d0943e 100644 --- a/vcl/source/gdi/graphictools.cxx +++ b/vcl/source/gdi/graphictools.cxx @@ -675,26 +675,6 @@ void SvtGraphicFill::setHatchColor( Color aHatchColor ) maHatchColor = aHatchColor; } -void SvtGraphicFill::setGradientType( GradientType aGradType ) -{ - maGradientType = aGradType; -} - -void SvtGraphicFill::setGradient1stColor( Color aColor ) -{ - maGradient1stColor = aColor; -} - -void SvtGraphicFill::setGradient2ndColor( Color aColor ) -{ - maGradient2ndColor = aColor; -} - -void SvtGraphicFill::setGradientStepCount( int aCount ) -{ - maGradientStepCount = aCount; -} - void SvtGraphicFill::setGraphic( const Graphic& rGraphic ) { maFillGraphic = rGraphic; diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index 18f927e5b0ff..f587bc29d2e9 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -276,45 +276,6 @@ uno::Reference< graphic::XGraphic > Image::GetXGraphic() const // ----------------------------------------------------------------------- -void Image::Invert() -{ - BitmapEx aInvertedBmp( GetBitmapEx() ); - aInvertedBmp.Invert(); - *this = aInvertedBmp; -} - -// ----------------------------------------------------------------------- - -void Image::GetColorTransformArrays( ImageColorTransform eColorTransform, - Color*& rpSrcColor, Color*& rpDstColor, sal_uLong& rColorCount ) -{ - if( IMAGECOLORTRANSFORM_HIGHCONTRAST == eColorTransform ) - { - rpSrcColor = new Color[ 4 ]; - rpDstColor = new Color[ 4 ]; - rColorCount = 4; - - rpSrcColor[ 0 ] = Color( COL_BLACK ); - rpDstColor[ 0 ] = Color( COL_WHITE ); - - rpSrcColor[ 1 ] = Color( COL_WHITE ); - rpDstColor[ 1 ] = Color( COL_BLACK ); - - rpSrcColor[ 2 ] = Color( COL_BLUE ); - rpDstColor[ 2 ] = Color( COL_WHITE ); - - rpSrcColor[ 3 ] = Color( COL_LIGHTBLUE ); - rpDstColor[ 3 ] = Color( COL_WHITE ); - } - else - { - rpSrcColor = rpDstColor = NULL; - rColorCount = 0; - } -} - -// ----------------------------------------------------------------------- - Image& Image::operator=( const Image& rImage ) { DBG_CHKTHIS( Image, NULL ); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 9d995f361329..bd457f3fda22 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -928,13 +928,6 @@ void ImpGraphic::ImplResetAnimationLoopCount() // ------------------------------------------------------------------------ -List* ImpGraphic::ImplGetAnimationInfoList() const -{ - return( mpAnimation ? mpAnimation->GetAInfoList() : NULL ); -} - -// ------------------------------------------------------------------------ - GraphicReader* ImpGraphic::ImplGetContext() { return mpContext; diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk deleted file mode 100755 index e124dc343eba..000000000000 --- a/vcl/source/gdi/makefile.mk +++ /dev/null @@ -1,127 +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=gdi - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.INCLUDE : $(PRJ)$/util$/makefile2.pmk - -.IF "$(COM)"=="ICC" -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)$/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)$/bitmap3.obj \ - $(SLO)$/bitmap4.obj \ - $(SLO)$/alpha.obj \ - $(SLO)$/bmpacc.obj \ - $(SLO)$/bmpacc2.obj \ - $(SLO)$/bmpacc3.obj \ - $(SLO)$/bmpfast.obj \ - $(SLO)$/font.obj \ - $(SLO)$/gradient.obj \ - $(SLO)$/hatch.obj \ - $(SLO)$/impbmp.obj \ - $(SLO)$/mapmod.obj \ - $(SLO)$/octree.obj \ - $(SLO)$/regband.obj \ - $(SLO)$/region.obj \ - $(SLO)$/extoutdevdata.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 2ffa3c68e4f7..32c4a589f54d 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -4409,4 +4409,4 @@ void MetaRenderGraphicAction::Read( SvStream& rIStm, ImplMetaReadData* ) rIStm >> maRenderGraphic >> maPoint >> maSize >> mfRotateAngle >> mfShearAngleX >> mfShearAngleY; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index c1fd5a8c6ca5..0569de5e3464 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -2050,3 +2051,5 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess* i_pBitmap ) rtl_freeMemory( pFirstRefLine ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 4c9461fbcb97..440da9c5bb56 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -667,14 +667,6 @@ Printer::Printer() // ----------------------------------------------------------------------- -Printer::Printer( const Window* pWindow ) -{ - ImplInitData(); - ImplInitDisplay( pWindow ); -} - -// ----------------------------------------------------------------------- - Printer::Printer( const JobSetup& rJobSetup ) : maJobSetup( rJobSetup ) { @@ -1336,13 +1328,6 @@ const PaperInfo& Printer::GetPaperInfo( int nPaper ) const // ----------------------------------------------------------------------- -DuplexMode Printer::GetDuplexMode() const -{ - return maJobSetup.ImplGetConstData()->meDuplexMode; -} - -// ----------------------------------------------------------------------- - sal_Bool Printer::SetDuplexMode( DuplexMode eDuplex ) { if ( mbInPrintPage ) @@ -1455,25 +1440,6 @@ sal_uLong Printer::ImplSalPrinterErrorCodeToVCL( sal_uLong nError ) // ----------------------------------------------------------------------- -void Printer::ImplEndPrint() -{ - mbPrinting = sal_False; - mnCurPrintPage = 0; - maJobName.Erase(); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( Printer, ImplDestroyPrinterAsync, void*, pSalPrinter ) -{ - SalPrinter* pPrinter = (SalPrinter*)pSalPrinter; - ImplSVData* pSVData = ImplGetSVData(); - pSVData->mpDefInst->DestroyPrinter( pPrinter ); - return 0; -} - -// ----------------------------------------------------------------------- - sal_Bool Printer::EndJob() { sal_Bool bRet = sal_False; @@ -1510,38 +1476,6 @@ sal_Bool Printer::EndJob() // ----------------------------------------------------------------------- -sal_Bool Printer::AbortJob() -{ - // Wenn wir einen Queue-Printer haben, kann man diesen noch mit - // AbortJob() abbrechen, solange dieser noch am Drucken ist - if ( !IsJobActive() && !IsPrinting() ) - return sal_False; - - mbJobActive = sal_False; - mbInPrintPage = sal_False; - mpJobGraphics = NULL; - - if ( mpPrinter ) - { - mbPrinting = sal_False; - mnCurPage = 0; - mnCurPrintPage = 0; - maJobName.Erase(); - - ImplReleaseGraphics(); - mbDevOutput = sal_False; - mpPrinter->AbortJob(); - Application::PostUserEvent( LINK( this, Printer, ImplDestroyPrinterAsync ), mpPrinter ); - mpPrinter = NULL; - - return sal_True; - } - - return sal_False; -} - -// ----------------------------------------------------------------------- - void Printer::ImplStartPage() { if ( !IsJobActive() ) diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 42ef64a48289..2001968c60e8 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -1580,47 +1580,4 @@ void Printer::DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const pOut->DrawGradient( rRect, rGradient ); } -// ----------------------------------------------------------------------------- - -void Printer::DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, const Gradient& rGradient ) -{ - const PrinterOptions& rPrinterOptions = GetPrinterOptions(); - - if( rPrinterOptions.IsReduceGradients() ) - { - if( PRINTER_GRADIENT_STRIPES == rPrinterOptions.GetReducedGradientMode() ) - { - if( !rGradient.GetSteps() || ( rGradient.GetSteps() > rPrinterOptions.GetReducedGradientStepCount() ) ) - { - Gradient aNewGradient( rGradient ); - - aNewGradient.SetSteps( rPrinterOptions.GetReducedGradientStepCount() ); - pOut->DrawGradient( rPolyPoly, aNewGradient ); - } - else - pOut->DrawGradient( rPolyPoly, rGradient ); - } - else - { - const Color& rStartColor = rGradient.GetStartColor(); - const Color& rEndColor = rGradient.GetEndColor(); - const long nR = ( ( (long) rStartColor.GetRed() * rGradient.GetStartIntensity() ) / 100L + - ( (long) rEndColor.GetRed() * rGradient.GetEndIntensity() ) / 100L ) >> 1; - const long nG = ( ( (long) rStartColor.GetGreen() * rGradient.GetStartIntensity() ) / 100L + - ( (long) rEndColor.GetGreen() * rGradient.GetEndIntensity() ) / 100L ) >> 1; - const long nB = ( ( (long) rStartColor.GetBlue() * rGradient.GetStartIntensity() ) / 100L + - ( (long) rEndColor.GetBlue() * rGradient.GetEndIntensity() ) / 100L ) >> 1; - const Color aColor( (sal_uInt8) nR, (sal_uInt8) nG, (sal_uInt8) nB ); - - pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); - pOut->SetLineColor( aColor ); - pOut->SetFillColor( aColor ); - pOut->DrawPolyPolygon( rPolyPoly ); - pOut->Pop(); - } - } - 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 61a40af43bdd..dfe5bfb2aa73 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -250,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 ) + catch (const lang::IllegalArgumentException&) { DBG_ERRORFILE( "caught IllegalArgumentException when registering filter\n" ); } @@ -460,7 +460,7 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr makeAny( sal_True ) ); } } - catch( std::bad_alloc& ) + catch (const std::bad_alloc&) { } } diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 3992b774630d..e4c1a3a7c4f7 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -382,34 +382,6 @@ const char* ImplDbgTestRegion( const void* pObj ) return NULL; } -void TraceBands (const ImplRegionBand* pFirstBand) -{ - int nBandIndex (0); - const ImplRegionBand* pBand = pFirstBand; - while (pBand != NULL) - { - OSL_TRACE(" band %d %d->%d : ", nBandIndex++, - pBand->mnYTop, pBand->mnYBottom); - - ImplRegionBandPoint* pPoint = pBand->mpFirstBandPoint; - while (pPoint != NULL) - { - OSL_TRACE(" %d ", pPoint->mnX); - pPoint = pPoint->mpNextBandPoint; - } - OSL_TRACE(" | "); - - ImplRegionBandSep* pSep = pBand->mpFirstSep; - while (pSep != NULL) - { - OSL_TRACE(" %d->%d ", pSep->mnXLeft, pSep->mnXRight); - pSep = pSep->mpNextSep; - } - OSL_TRACE("\n"); - - pBand = pBand->mpNextBand; - } -} #endif // ======================================================================= diff --git a/vcl/source/gdi/rendergraphic.cxx b/vcl/source/gdi/rendergraphic.cxx index 10b6064cc57c..79771163fa2d 100644 --- a/vcl/source/gdi/rendergraphic.cxx +++ b/vcl/source/gdi/rendergraphic.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -238,3 +239,5 @@ void RenderGraphic::ImplGetDefaults() const } } // VCL + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/rendergraphicrasterizer.cxx b/vcl/source/gdi/rendergraphicrasterizer.cxx index 29c9863335b3..4c70d866245b 100644 --- a/vcl/source/gdi/rendergraphicrasterizer.cxx +++ b/vcl/source/gdi/rendergraphicrasterizer.cxx @@ -1,3 +1,4 @@ +/* -*- 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,3 +399,5 @@ void RenderGraphicRasterizer::ImplUpdateCache( const RenderGraphicRasterizer& rR } } // VCL + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 9679170df9b9..8b04476a1bea 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -159,91 +159,6 @@ VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 nChar ) // ----------------------------------------------------------------------- -// Get simple approximations for unicodes -const char* GetAutofallback( sal_UCS4 nChar ) -{ - const char* pStr = NULL; - switch( nChar ) - { - case 0x01C0: - case 0x2223: - case 0x2758: - pStr = "|"; break; - case 0x02DC: - pStr = "~"; break; - case 0x037E: - pStr = ";"; break; - case 0x2000: - case 0x2001: - case 0x2002: - case 0x2003: - case 0x2004: - case 0x2005: - case 0x2006: - case 0x2007: - case 0x2008: - case 0x2009: - case 0x200A: - case 0x202F: - pStr = " "; break; - case 0x2010: - case 0x2011: - case 0x2012: - case 0x2013: - case 0x2014: - pStr = "-"; break; - case 0x2015: - pStr = "--"; break; - case 0x2016: - pStr = "||"; break; - case 0x2017: - pStr = "_"; break; - case 0x2018: - case 0x2019: - case 0x201B: - pStr = "\'"; break; - case 0x201A: - pStr = ","; break; - case 0x201C: - case 0x201D: - case 0x201E: - case 0x201F: - case 0x2033: - pStr = "\""; break; - case 0x2039: - pStr = "<"; break; - case 0x203A: - pStr = ">"; break; - case 0x203C: - pStr = "!!"; break; - case 0x203D: - pStr = "?"; break; - case 0x2044: - case 0x2215: - pStr = "/"; break; - case 0x2048: - pStr = "?!"; break; - case 0x2049: - pStr = "!?"; break; - case 0x2216: - pStr = "\\"; break; - case 0x2217: - pStr = "*"; break; - case 0x2236: - pStr = ":"; break; - case 0x2264: - pStr = "<="; break; - case 0x2265: - pStr = "<="; break; - case 0x2303: - pStr = "^"; break; - } - - return pStr; -} - -// ----------------------------------------------------------------------- - sal_UCS4 GetLocalizedChar( sal_UCS4 nChar, LanguageType eLang ) { // currently only conversion from ASCII digits is interesting diff --git a/vcl/source/gdi/svgread.cxx b/vcl/source/gdi/svgread.cxx index 554cfa804b1b..0573f924e277 100644 --- a/vcl/source/gdi/svgread.cxx +++ b/vcl/source/gdi/svgread.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -129,3 +130,5 @@ namespace vcl } } // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx index a24d3b0cbd66..5529d9c06232 100644 --- a/vcl/source/gdi/wall.cxx +++ b/vcl/source/gdi/wall.cxx @@ -366,20 +366,6 @@ void Wallpaper::SetBitmap( const BitmapEx& rBitmap ) // ----------------------------------------------------------------------- -void Wallpaper::SetBitmap() -{ - DBG_CHKTHIS( Wallpaper, NULL ); - - if ( mpImplWallpaper->mpBitmap ) - { - ImplMakeUnique(); - delete mpImplWallpaper->mpBitmap; - mpImplWallpaper->mpBitmap = NULL; - } -} - -// ----------------------------------------------------------------------- - BitmapEx Wallpaper::GetBitmap() const { DBG_CHKTHIS( Wallpaper, NULL ); @@ -422,20 +408,6 @@ void Wallpaper::SetGradient( const Gradient& rGradient ) // ----------------------------------------------------------------------- -void Wallpaper::SetGradient() -{ - DBG_CHKTHIS( Wallpaper, NULL ); - - if ( mpImplWallpaper->mpGradient ) - { - ImplMakeUnique(); - delete mpImplWallpaper->mpGradient; - mpImplWallpaper->mpGradient = NULL; - } -} - -// ----------------------------------------------------------------------- - Gradient Wallpaper::GetGradient() const { DBG_CHKTHIS( Wallpaper, NULL ); @@ -504,20 +476,6 @@ void Wallpaper::SetRect( const Rectangle& rRect ) // ----------------------------------------------------------------------- -void Wallpaper::SetRect() -{ - DBG_CHKTHIS( Wallpaper, NULL ); - - if ( mpImplWallpaper->mpRect ) - { - ImplMakeUnique( sal_False ); - delete mpImplWallpaper->mpRect; - mpImplWallpaper->mpRect = NULL; - } -} - -// ----------------------------------------------------------------------- - Rectangle Wallpaper::GetRect() const { DBG_CHKTHIS( Wallpaper, NULL ); diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx index ac8e658f7bd8..7b152938744b 100644 --- a/vcl/source/helper/canvastools.cxx +++ b/vcl/source/helper/canvastools.cxx @@ -185,23 +185,6 @@ namespace vcl //--------------------------------------------------------------------------------------- - const uno::Sequence< sal_Int8 > getTunnelIdentifier( TunnelIdentifierType eType ) - { - 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() ) - { - uno::Sequence< sal_Int8 > aNewId( 16 ); - rtl_createUuid( (sal_uInt8*)aNewId.getArray(), NULL, sal_True ); - aIds[ eType ] = aNewId; - it = aIds.find( eType ); - } - return it->second; - } - - //--------------------------------------------------------------------------------------- - namespace { inline bool operator==( const rendering::IntegerBitmapLayout& rLHS, diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx index c8b5cc7fbf22..c192431e87e6 100644 --- a/vcl/source/helper/strhelper.cxx +++ b/vcl/source/helper/strhelper.cxx @@ -173,15 +173,15 @@ String GetCommandLineToken( int nToken, const String& rLine ) return aRet; } -ByteString GetCommandLineToken( int nToken, const ByteString& rLine ) +rtl::OString GetCommandLineToken(int nToken, const rtl::OString& rLine) { - int nLen = rLine.Len(); - if( ! nLen ) - return ByteString(); + sal_Int32 nLen = rLine.getLength(); + if (!nLen) + return rLine; int nActualToken = 0; char* pBuffer = (char*)alloca( nLen + 1 ); - const char* pRun = rLine.GetBuffer(); + const char* pRun = rLine.getStr(); char* pLeap = NULL; while( *pRun && nActualToken <= nToken ) @@ -275,13 +275,13 @@ int GetCommandLineTokenCount( const String& rLine ) return nTokenCount; } -int GetCommandLineTokenCount( const ByteString& rLine ) +int GetCommandLineTokenCount(const rtl::OString& rLine) { - if( ! rLine.Len() ) + if (rLine.isEmpty()) return 0; int nTokenCount = 0; - const char *pRun = rLine.GetBuffer(); + const char *pRun = rLine.getStr(); while( *pRun ) @@ -383,14 +383,14 @@ String WhitespaceToSpace( const String& rLine, sal_Bool bProtect ) return aRet; } -ByteString WhitespaceToSpace( const ByteString& rLine, sal_Bool bProtect ) +rtl::OString WhitespaceToSpace(const rtl::OString& rLine, sal_Bool bProtect) { - int nLen = rLine.Len(); - if( ! nLen ) - return ByteString(); + sal_Int32 nLen = rLine.getLength(); + if (!nLen) + return rLine; char *pBuffer = (char*)alloca( nLen + 1 ); - const char *pRun = rLine.GetBuffer(); + const char *pRun = rLine.getStr(); char *pLeap = pBuffer; while( *pRun ) @@ -436,8 +436,7 @@ ByteString WhitespaceToSpace( const ByteString& rLine, sal_Bool bProtect ) if( *pLeap == ' ' ) *pLeap = 0; - ByteString aRet( *pBuffer == ' ' ? pBuffer+1 : pBuffer ); - return aRet; + return rtl::OString(*pBuffer == ' ' ? pBuffer+1 : pBuffer); } } // namespace diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx index ad351410e2c2..f0db5e3a372f 100644 --- a/vcl/source/helper/threadex.cxx +++ b/vcl/source/helper/threadex.cxx @@ -35,46 +35,6 @@ using namespace vcl; -ThreadExecutor::ThreadExecutor() -{ - m_aFinish = osl_createCondition(); - m_aThread = NULL; -} - -ThreadExecutor::~ThreadExecutor() -{ - osl_destroyCondition( m_aFinish ); - if( m_aThread ) - osl_destroyThread( m_aThread ); -} - -extern "C" -{ - static void call_worker( void* pInstance ) - { - ThreadExecutor::worker( pInstance ); - } -} - -void ThreadExecutor::worker( void* pInstance ) -{ - ThreadExecutor* pThis = ((ThreadExecutor*)pInstance); - pThis->m_nReturn = pThis->doIt(); - osl_setCondition( pThis->m_aFinish ); -} - -long ThreadExecutor::execute() -{ - osl_resetCondition( m_aFinish ); - if( m_aThread ) - osl_destroyThread( m_aThread ), m_aThread = NULL; - m_aThread = osl_createThread( call_worker, this ); - while( ! osl_checkCondition( m_aFinish ) ) - Application::Reschedule(); - return m_nReturn; -} - - SolarThreadExecutor::SolarThreadExecutor() :m_nReturn( 0 ) ,m_bTimeout( false ) diff --git a/vcl/source/salmain/salmain.cxx b/vcl/source/salmain/salmain.cxx index 80e853b3b654..0c3adf887023 100644 --- a/vcl/source/salmain/salmain.cxx +++ b/vcl/source/salmain/salmain.cxx @@ -36,7 +36,7 @@ #include "salinst.hxx" -SAL_IMPLEMENT_MAIN() { +SAL_IMPLEMENT_MAIN_WITH_GUI() { tools::extendApplicationEnvironment(); return SVMain(); } diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx index 525c8ad5a76a..3fb5aabc4a35 100644 --- a/vcl/source/window/accel.cxx +++ b/vcl/source/window/accel.cxx @@ -410,85 +410,6 @@ void Accelerator::InsertItem( const ResId& rResId ) // ----------------------------------------------------------------------- -void Accelerator::RemoveItem( sal_uInt16 nItemId ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - // Aus der Id-Liste entfernen - sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); - if ( nIndex != ACCELENTRY_NOTFOUND ) - { - sal_uInt16 nItemCount = GetItemCount(); - do - { - ImplAccelEntry* pEntry = ( nIndex < mpData->maIdList.size() ) ? mpData->maIdList[ nIndex ] : NULL; - if ( pEntry && pEntry->mnId == nItemId ) - { - mpData->maKeyTable.Remove( pEntry->maKeyCode.GetFullKeyCode() ); - - ImplAccelList::iterator it = mpData->maIdList.begin(); - ::std::advance( it, nIndex ); - mpData->maIdList.erase( it ); - - // AutoResAccel zerstoeren - if ( pEntry->mpAutoAccel ) - delete pEntry->mpAutoAccel; - - delete pEntry; - } - else - break; - } - while ( nIndex < nItemCount ); - } -} - -// ----------------------------------------------------------------------- - -void Accelerator::RemoveItem( const KeyCode rKeyCode ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - { - // Aus der Id-Liste entfernen - sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), pEntry->mnId ); - sal_uInt16 nItemCount = GetItemCount(); - do - { - if ( mpData->maIdList[ nIndex ] == pEntry ) - break; - nIndex++; - } - while ( nIndex < nItemCount ); - - mpData->maKeyTable.Remove( rKeyCode.GetFullKeyCode() ); - - ImplAccelList::iterator it = mpData->maIdList.begin(); - ::std::advance( it, nIndex ); - mpData->maIdList.erase( it ); - - // AutoResAccel zerstoeren - if ( pEntry->mpAutoAccel ) - delete pEntry->mpAutoAccel; - - delete pEntry; - } -} - -// ----------------------------------------------------------------------- - -void Accelerator::Clear() -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplDeleteData(); - mpData->maKeyTable.Clear(); -} - -// ----------------------------------------------------------------------- - sal_uInt16 Accelerator::GetItemCount() const { DBG_CHKTHIS( Accelerator, NULL ); @@ -498,45 +419,6 @@ sal_uInt16 Accelerator::GetItemCount() const // ----------------------------------------------------------------------- -sal_uInt16 Accelerator::GetItemId( sal_uInt16 nPos ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL; - if ( pEntry ) - return pEntry->mnId; - else - return 0; -} - -// ----------------------------------------------------------------------- - -KeyCode Accelerator::GetItemKeyCode( sal_uInt16 nPos ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL; - if ( pEntry ) - return pEntry->maKeyCode; - else - return KeyCode(); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 Accelerator::GetItemId( const KeyCode& rKeyCode ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - return pEntry->mnId; - else - return 0; -} - -// ----------------------------------------------------------------------- - KeyCode Accelerator::GetKeyCode( sal_uInt16 nItemId ) const { DBG_CHKTHIS( Accelerator, NULL ); @@ -550,76 +432,15 @@ KeyCode Accelerator::GetKeyCode( sal_uInt16 nItemId ) const // ----------------------------------------------------------------------- -sal_Bool Accelerator::IsIdValid( sal_uInt16 nItemId ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); - return (nIndex != ACCELENTRY_NOTFOUND); -} - -// ----------------------------------------------------------------------- - -sal_Bool Accelerator::IsKeyCodeValid( const KeyCode rKeyCode ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - return (pEntry != NULL); -} - -// ----------------------------------------------------------------------- - -sal_Bool Accelerator::Call( const KeyCode& rKeyCode, sal_uInt16 nRepeat ) +sal_uInt16 Accelerator::GetItemId( sal_uInt16 nPos ) const { DBG_CHKTHIS( Accelerator, NULL ); - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); + ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL; if ( pEntry ) - { - if ( pEntry->mbEnabled ) - { - sal_Bool bDel = sal_False; - mnCurId = pEntry->mnId; - maCurKeyCode = rKeyCode; - mnCurRepeat = nRepeat; - mpDel = &bDel; - Select(); - if ( !bDel ) - { - mnCurId = 0; - maCurKeyCode = KeyCode(); - mnCurRepeat = 0; - } - - return sal_True; - } - } - - return sal_False; -} - -// ----------------------------------------------------------------------- - -void Accelerator::SetAccel( sal_uInt16 nItemId, Accelerator* pAccel ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); - if ( nIndex != ACCELENTRY_NOTFOUND ) - { - sal_uInt16 nItemCount = GetItemCount(); - do - { - ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ]; - if ( pEntry->mnId != nItemId ) - break; - - pEntry->mpAccel = pAccel; - nIndex++; - } - while ( nIndex < nItemCount ); - } + return pEntry->mnId; + else + return 0; } // ----------------------------------------------------------------------- @@ -637,90 +458,6 @@ Accelerator* Accelerator::GetAccel( sal_uInt16 nItemId ) const // ----------------------------------------------------------------------- -void Accelerator::SetAccel( const KeyCode rKeyCode, Accelerator* pAccel ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - pEntry->mpAccel = pAccel; -} - -// ----------------------------------------------------------------------- - -Accelerator* Accelerator::GetAccel( const KeyCode rKeyCode ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - return pEntry->mpAccel; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -void Accelerator::EnableItem( sal_uInt16 nItemId, sal_Bool bEnable ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); - if ( nIndex != ACCELENTRY_NOTFOUND ) - { - sal_uInt16 nItemCount = GetItemCount(); - do - { - ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ]; - if ( pEntry->mnId != nItemId ) - break; - - pEntry->mbEnabled = bEnable; - nIndex++; - } - while ( nIndex < nItemCount ); - } -} - -// ----------------------------------------------------------------------- - -sal_Bool Accelerator::IsItemEnabled( sal_uInt16 nItemId ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); - if ( nIndex != ACCELENTRY_NOTFOUND ) - return mpData->maIdList[ nIndex ]->mbEnabled; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -void Accelerator::EnableItem( const KeyCode rKeyCode, sal_Bool bEnable ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - pEntry->mbEnabled = bEnable; -} - -// ----------------------------------------------------------------------- - -sal_Bool Accelerator::IsItemEnabled( const KeyCode rKeyCode ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - return pEntry->mbEnabled; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - Accelerator& Accelerator::operator=( const Accelerator& rAccel ) { DBG_CHKTHIS( Accelerator, NULL ); diff --git a/vcl/source/window/dndlcon.cxx b/vcl/source/window/dndlcon.cxx index 977e8611e70a..08c8e4d24c3b 100644 --- a/vcl/source/window/dndlcon.cxx +++ b/vcl/source/window/dndlcon.cxx @@ -193,8 +193,7 @@ sal_uInt32 DNDListenerContainer::fireDropEvent( const Reference< XDropTargetDrop nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } @@ -209,8 +208,7 @@ sal_uInt32 DNDListenerContainer::fireDropEvent( const Reference< XDropTargetDrop { context->rejectDrop(); } - - catch( RuntimeException exc ) + catch (const RuntimeException&) { } } @@ -253,8 +251,7 @@ sal_uInt32 DNDListenerContainer::fireDragExitEvent() nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } @@ -305,8 +302,7 @@ sal_uInt32 DNDListenerContainer::fireDragOverEvent( const Reference< XDropTarget nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } @@ -321,8 +317,7 @@ sal_uInt32 DNDListenerContainer::fireDragOverEvent( const Reference< XDropTarget { context->rejectDrag(); } - - catch( RuntimeException exc ) + catch (const RuntimeException&) { } } @@ -373,8 +368,7 @@ sal_uInt32 DNDListenerContainer::fireDragEnterEvent( const Reference< XDropTarge nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } @@ -389,8 +383,7 @@ sal_uInt32 DNDListenerContainer::fireDragEnterEvent( const Reference< XDropTarge { context->rejectDrag(); } - - catch( RuntimeException exc ) + catch (const RuntimeException&) { } } @@ -440,8 +433,7 @@ sal_uInt32 DNDListenerContainer::fireDropActionChangedEvent( const Reference< XD nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } @@ -456,8 +448,7 @@ sal_uInt32 DNDListenerContainer::fireDropActionChangedEvent( const Reference< XD { context->rejectDrag(); } - - catch( RuntimeException exc ) + catch (const RuntimeException&) { } } @@ -502,8 +493,7 @@ sal_uInt32 DNDListenerContainer::fireDragGestureEvent( sal_Int8 dragAction, sal_ nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 118c60f214cc..72847ab17bc7 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -697,13 +697,22 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags ) // so they can be compared across different frames // !!! rRect is expected to be in screen coordinates of the parent frame window !!! maFloatRect = rRect; - if( GetParent()->ImplHasMirroredGraphics() ) + + Window *pReference = GetParent(); + + // compare coordinates in absolute screen coordinates + // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509 + if( pReference->ImplHasMirroredGraphics() ) { - maFloatRect.SetPos( GetParent()->ScreenToOutputPixel( rRect.TopLeft() ) ); - maFloatRect = GetParent()->ImplOutputToUnmirroredAbsoluteScreenPixel( maFloatRect ); + if(!pReference->IsRTLEnabled() ) + // --- RTL --- re-mirror back to get device coordiantes + pReference->ImplReMirror(maFloatRect); + + maFloatRect.SetPos(pReference->ScreenToOutputPixel(maFloatRect.TopLeft())); + maFloatRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel(maFloatRect); } else - maFloatRect.SetPos( GetParent()->OutputToAbsoluteScreenPixel( GetParent()->ScreenToOutputPixel( rRect.TopLeft() ) ) ); + maFloatRect.SetPos(pReference->OutputToAbsoluteScreenPixel(pReference->ScreenToOutputPixel(rRect.TopLeft()))); maFloatRect.Left() -= 2; maFloatRect.Top() -= 2; diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index d4e16ed6c121..9e47d34716cb 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -156,7 +156,7 @@ struct MenuItemData pSalMenuItem ( NULL ) {} ~MenuItemData(); - bool HasCheck() + bool HasCheck() const { return bChecked || ( nBits & ( MIB_RADIOCHECK | MIB_CHECKABLE | MIB_AUTOCHECK ) ); } diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index 341d7f3bfff8..1de33b56b15b 100755..100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -198,16 +198,6 @@ void SystemChildWindow::EnableEraseBackground( sal_Bool bEnable ) // ----------------------------------------------------------------------- -sal_Bool SystemChildWindow::IsEraseBackgroundEnabled() -{ - if ( mpWindowImpl->mpSysObj ) - return mpWindowImpl->mpSysObj->IsEraseBackgroundEnabled(); - else - return sal_False; -} - -// ----------------------------------------------------------------------- - void SystemChildWindow::ImplTestJavaException( void* pEnv ) { #ifdef SOLAR_JAVA @@ -260,6 +250,9 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava ) // FIXME: this is wrong nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView ); (void)bUseJava; +#elif defined IOS + // FIXME: this is wrong + nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView ); #elif defined UNX if( !bUseJava ) { diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index f6c7e422cc3b..77cfb7044740 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -39,6 +39,8 @@ #include <vcl/taskpanelist.hxx> #include <vcl/unowrap.hxx> +#include <rtl/strbuf.hxx> + #include <salframe.hxx> #include <svdata.hxx> #include <brdwin.hxx> @@ -242,36 +244,6 @@ void SystemWindow::Resizing( Size& ) // ----------------------------------------------------------------------- -void SystemWindow::SetZLevel( sal_uInt8 nLevel ) -{ - Window* pWindow = this; - while ( pWindow->mpWindowImpl->mpBorderWindow ) - pWindow = pWindow->mpWindowImpl->mpBorderWindow; - if ( pWindow->mpWindowImpl->mbOverlapWin && !pWindow->mpWindowImpl->mbFrame ) - { - sal_uInt8 nOldLevel = pWindow->mpWindowImpl->mpOverlapData->mnTopLevel; - pWindow->mpWindowImpl->mpOverlapData->mnTopLevel = nLevel; - // Wenn der neue Level groesser als der alte ist, schieben - // wir das Fenster nach hinten - if ( !IsReallyVisible() && (nLevel > nOldLevel) && pWindow->mpWindowImpl->mpNext ) - { - // Fenster aus der Liste entfernen - if ( pWindow->mpWindowImpl->mpPrev ) - pWindow->mpWindowImpl->mpPrev->mpWindowImpl->mpNext = pWindow->mpWindowImpl->mpNext; - else - pWindow->mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = pWindow->mpWindowImpl->mpNext; - pWindow->mpWindowImpl->mpNext->mpWindowImpl->mpPrev = pWindow->mpWindowImpl->mpPrev; - pWindow->mpWindowImpl->mpNext = NULL; - // und Fenster wieder in die Liste am Ende eintragen - pWindow->mpWindowImpl->mpPrev = pWindow->mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap; - pWindow->mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = pWindow; - pWindow->mpWindowImpl->mpPrev->mpWindowImpl->mpNext = pWindow; - } - } -} - -// ----------------------------------------------------------------------- - void SystemWindow::SetRepresentedURL( const rtl::OUString& i_rURL ) { bool bChanged = (i_rURL != mpImplData->maRepresentedURL); @@ -286,12 +258,6 @@ void SystemWindow::SetRepresentedURL( const rtl::OUString& i_rURL ) pWindow->mpWindowImpl->mpFrame->SetRepresentedURL( i_rURL ); } } -// ----------------------------------------------------------------------- - -const rtl::OUString& SystemWindow::GetRepresentedURL() const -{ - return mpImplData->maRepresentedURL; -} // ----------------------------------------------------------------------- @@ -315,19 +281,6 @@ void SystemWindow::SetIcon( sal_uInt16 nIcon ) // ----------------------------------------------------------------------- -sal_uInt8 SystemWindow::GetZLevel() const -{ - const Window* pWindow = this; - while ( pWindow->mpWindowImpl->mpBorderWindow ) - pWindow = pWindow->mpWindowImpl->mpBorderWindow; - if ( pWindow->mpWindowImpl->mpOverlapData ) - return pWindow->mpWindowImpl->mpOverlapData->mnTopLevel; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - void SystemWindow::EnableSaveBackground( sal_Bool bSave ) { if( ImplGetSVData()->maWinData.mbNoSaveBackground ) @@ -498,16 +451,17 @@ Size SystemWindow::GetResizeOutputSizePixel() const // ----------------------------------------------------------------------- -static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rStr ) +static void ImplWindowStateFromStr(WindowStateData& rData, + const rtl::OString& rStr) { sal_uLong nValidMask = 0; - xub_StrLen nIndex = 0; - ByteString aTokenStr; + sal_Int32 nIndex = 0; + rtl::OString aTokenStr; - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetX( aTokenStr.ToInt32() ); + rData.SetX(aTokenStr.toInt32()); if( rData.GetX() > -16384 && rData.GetX() < 16384 ) nValidMask |= WINDOWSTATE_MASK_X; else @@ -515,10 +469,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetX( 0 ); - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetY( aTokenStr.ToInt32() ); + rData.SetY(aTokenStr.toInt32()); if( rData.GetY() > -16384 && rData.GetY() < 16384 ) nValidMask |= WINDOWSTATE_MASK_Y; else @@ -526,10 +480,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetY( 0 ); - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetWidth( aTokenStr.ToInt32() ); + rData.SetWidth(aTokenStr.toInt32()); if( rData.GetWidth() > 0 && rData.GetWidth() < 16384 ) nValidMask |= WINDOWSTATE_MASK_WIDTH; else @@ -537,10 +491,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetWidth( 0 ); - aTokenStr = rStr.GetToken( 0, ';', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ';', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetHeight( aTokenStr.ToInt32() ); + rData.SetHeight(aTokenStr.toInt32()); if( rData.GetHeight() > 0 && rData.GetHeight() < 16384 ) nValidMask |= WINDOWSTATE_MASK_HEIGHT; else @@ -548,12 +502,12 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetHeight( 0 ); - aTokenStr = rStr.GetToken( 0, ';', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ';', nIndex); + if (!aTokenStr.isEmpty()) { // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - ignore Minimize - sal_uLong nState = (sal_uLong)aTokenStr.ToInt32(); + sal_uInt32 nState = (sal_uInt32)aTokenStr.toInt32(); //nState &= ~(WINDOWSTATE_STATE_MINIMIZED); rData.SetState( nState ); nValidMask |= WINDOWSTATE_MASK_STATE; @@ -562,10 +516,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS rData.SetState( 0 ); // read maximized pos/size - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetMaximizedX( aTokenStr.ToInt32() ); + rData.SetMaximizedX(aTokenStr.toInt32()); if( rData.GetMaximizedX() > -16384 && rData.GetMaximizedX() < 16384 ) nValidMask |= WINDOWSTATE_MASK_MAXIMIZED_X; else @@ -573,10 +527,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetMaximizedX( 0 ); - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetMaximizedY( aTokenStr.ToInt32() ); + rData.SetMaximizedY(aTokenStr.toInt32()); if( rData.GetMaximizedY() > -16384 && rData.GetMaximizedY() < 16384 ) nValidMask |= WINDOWSTATE_MASK_MAXIMIZED_Y; else @@ -584,10 +538,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetMaximizedY( 0 ); - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetMaximizedWidth( aTokenStr.ToInt32() ); + rData.SetMaximizedWidth(aTokenStr.toInt32()); if( rData.GetMaximizedWidth() > 0 && rData.GetMaximizedWidth() < 16384 ) nValidMask |= WINDOWSTATE_MASK_MAXIMIZED_WIDTH; else @@ -595,10 +549,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetMaximizedWidth( 0 ); - aTokenStr = rStr.GetToken( 0, ';', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ';', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetMaximizedHeight( aTokenStr.ToInt32() ); + rData.SetMaximizedHeight(aTokenStr.toInt32()); if( rData.GetMaximizedHeight() > 0 && rData.GetMaximizedHeight() < 16384 ) nValidMask |= WINDOWSTATE_MASK_MAXIMIZED_HEIGHT; else @@ -613,45 +567,48 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS // ----------------------------------------------------------------------- -static void ImplWindowStateToStr( const WindowStateData& rData, ByteString& rStr ) +static rtl::OString ImplWindowStateToStr(const WindowStateData& rData) { sal_uLong nValidMask = rData.GetMask(); if ( !nValidMask ) - return; + return rtl::OString(); + + rtl::OStringBuffer rStrBuf; if ( nValidMask & WINDOWSTATE_MASK_X ) - rStr.Append( ByteString::CreateFromInt32( rData.GetX() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetX())); + rStrBuf.append(','); if ( nValidMask & WINDOWSTATE_MASK_Y ) - rStr.Append( ByteString::CreateFromInt32( rData.GetY() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetY())); + rStrBuf.append(','); if ( nValidMask & WINDOWSTATE_MASK_WIDTH ) - rStr.Append( ByteString::CreateFromInt32( rData.GetWidth() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetWidth())); + rStrBuf.append(','); if ( nValidMask & WINDOWSTATE_MASK_HEIGHT ) - rStr.Append( ByteString::CreateFromInt32( rData.GetHeight() ) ); - rStr.Append( ';' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetHeight())); + rStrBuf.append( ';' ); if ( nValidMask & WINDOWSTATE_MASK_STATE ) { // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - ignore Minimize - sal_uLong nState = rData.GetState(); - //nState &= ~(WINDOWSTATE_STATE_MINIMIZED); - rStr.Append( ByteString::CreateFromInt32( (long)nState ) ); + sal_uInt32 nState = rData.GetState(); + rStrBuf.append(static_cast<sal_Int32>(nState)); } - rStr.Append( ';' ); + rStrBuf.append(';'); if ( nValidMask & WINDOWSTATE_MASK_MAXIMIZED_X ) - rStr.Append( ByteString::CreateFromInt32( rData.GetMaximizedX() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetMaximizedX())); + rStrBuf.append(','); if ( nValidMask & WINDOWSTATE_MASK_MAXIMIZED_Y ) - rStr.Append( ByteString::CreateFromInt32( rData.GetMaximizedY() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetMaximizedY())); + rStrBuf.append( ',' ); if ( nValidMask & WINDOWSTATE_MASK_MAXIMIZED_WIDTH ) - rStr.Append( ByteString::CreateFromInt32( rData.GetMaximizedWidth() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetMaximizedWidth())); + rStrBuf.append(','); if ( nValidMask & WINDOWSTATE_MASK_MAXIMIZED_HEIGHT ) - rStr.Append( ByteString::CreateFromInt32( rData.GetMaximizedHeight() ) ); - rStr.Append( ';' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetMaximizedHeight())); + rStrBuf.append(';'); + + return rStrBuf.makeStringAndClear(); } // ----------------------------------------------------------------------- @@ -955,9 +912,9 @@ void SystemWindow::GetWindowStateData( WindowStateData& rData ) const // ----------------------------------------------------------------------- -void SystemWindow::SetWindowState( const ByteString& rStr ) +void SystemWindow::SetWindowState(const rtl::OString& rStr) { - if ( !rStr.Len() ) + if (rStr.isEmpty()) return; WindowStateData aData; @@ -967,15 +924,13 @@ void SystemWindow::SetWindowState( const ByteString& rStr ) // ----------------------------------------------------------------------- -ByteString SystemWindow::GetWindowState( sal_uLong nMask ) const +rtl::OString SystemWindow::GetWindowState( sal_uLong nMask ) const { WindowStateData aData; aData.SetMask( nMask ); GetWindowStateData( aData ); - ByteString aStr; - ImplWindowStateToStr( aData, aStr ); - return aStr; + return ImplWindowStateToStr(aData); } // ----------------------------------------------------------------------- diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx index 24c8ded6e4b4..bfb3be82b70f 100644 --- a/vcl/source/window/taskpanelist.cxx +++ b/vcl/source/window/taskpanelist.cxx @@ -262,41 +262,6 @@ sal_Bool TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent ) // -------------------------------------------------- -// returns next valid pane -Window* TaskPaneList::FindNextPane( Window *pWindow, sal_Bool bForward ) -{ - if( bForward ) - ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSort() ); - else - ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSortBackward() ); - - ::std::vector< Window* >::iterator p = mTaskPanes.begin(); - while( p != mTaskPanes.end() ) - { - if( *p == pWindow ) - { - unsigned n = mTaskPanes.size(); - while( --n ) - { - if( ++p == mTaskPanes.end() ) - p = mTaskPanes.begin(); - if( (*p)->IsReallyVisible() && !(*p)->IsDialog() && !(*p)->ImplIsSplitter() ) - { - pWindow = *p; - break; - } - } - break; - } - else - ++p; - } - - return pWindow; -} - -// -------------------------------------------------- - // returns next splitter Window* TaskPaneList::FindNextSplitter( Window *pWindow, sal_Bool bForward ) { diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 8ffe04c4208a..742d821a1f7e 100755..100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -194,8 +194,6 @@ public: void UpdateDragRect(); DECL_LINK( SelectHdl, Accelerator* ); - void StartCustomizeMode(); - void EndCustomizeMode(); sal_Bool IsCustomizeMode() { return mbCustomizeMode; } sal_Bool IsResizeMode() { return mbResizeMode; } }; @@ -1503,29 +1501,6 @@ IMPL_LINK( ImplTBDragMgr, SelectHdl, Accelerator*, pAccel ) // ----------------------------------------------------------------------- -void ImplTBDragMgr::StartCustomizeMode() -{ - mbCustomizeMode = sal_True; - - for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i ) { - (*mpBoxList)[ i ]->ImplStartCustomizeMode(); - } -} - -// ----------------------------------------------------------------------- - -void ImplTBDragMgr::EndCustomizeMode() -{ - mbCustomizeMode = sal_False; - - for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i ) { - (*mpBoxList)[ i ]->ImplEndCustomizeMode(); - } -} - -// ----------------------------------------------------------------------- - - static void ImplDrawOutButton( OutputDevice* pOutDev, const Rectangle& rRect, sal_uInt16 nStyle ) { @@ -3178,60 +3153,6 @@ void ToolBox::ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, sal_Bool bBlac } } -void ToolBox::SetToolArrowClipregion( ToolBox* pBox, long nX, long nY, - sal_Bool bLeft, sal_Bool bTop, long nSize ) -{ - WindowAlign eAlign = pBox->meAlign; - long nHalfSize; - if ( bLeft ) - eAlign = WINDOWALIGN_RIGHT; - else if ( bTop ) - eAlign = WINDOWALIGN_BOTTOM; - - nHalfSize = nSize/2; - - Point p[6]; - - switch ( eAlign ) - { - case WINDOWALIGN_LEFT: - p[0].X() = nX-1; p[0].Y() = nY-1; - p[1].X() = nX-1; p[1].Y() = nY+nSize+1; - p[2].X() = nX+1; p[2].Y() = nY+nSize+1; - p[3].X() = nX+nHalfSize+1; p[3].Y() = nY+nHalfSize+1; - p[4].X() = nX+nHalfSize+1; p[4].Y() = nY+nHalfSize-1; - p[5].X() = nX+1; p[5].Y() = nY-1; - break; - case WINDOWALIGN_TOP: - p[0].X() = nX-1; p[0].Y() = nY-1; - p[1].X() = nX-1; p[1].Y() = nY+1; - p[2].X() = nX+nHalfSize-1; p[2].Y() = nY+nHalfSize+1; - p[3].X() = nX+nHalfSize+1; p[3].Y() = nY+nHalfSize+1; - p[4].X() = nX+nSize+1; p[4].Y() = nY+1; - p[5].X() = nX+nSize+1; p[5].Y() = nY-1; - break; - case WINDOWALIGN_RIGHT: - p[0].X() = nX+nHalfSize-1; p[0].Y() = nY-1; - p[1].X() = nX-1; p[1].Y() = nY+nHalfSize-1; - p[2].X() = nX-1; p[2].Y() = nY+nHalfSize+1; - p[3].X() = nX+nHalfSize-1; p[3].Y() = nY+nSize+1; - p[4].X() = nX+nHalfSize+1; p[4].Y() = nY+nSize+1; - p[5].X() = nX+nHalfSize+1; p[5].Y() = nY-1; - break; - case WINDOWALIGN_BOTTOM: - p[0].X() = nX-1; p[0].Y() = nY+nHalfSize-1; - p[1].X() = nX-1; p[1].Y() = nY+nHalfSize+1; - p[2].X() = nX+nSize+1; p[2].Y() = nY+nHalfSize+1; - p[3].X() = nX+nSize+1; p[3].Y() = nY+nHalfSize-1; - p[4].X() = nX+nHalfSize+1; p[4].Y() = nY-1; - p[5].X() = nX+nHalfSize-1; p[5].Y() = nY-1; - break; - } - Polygon aPoly(6,p); - Region aRgn( aPoly ); - pBox->SetClipRegion( aRgn ); -} - // ----------------------------------------------------------------------- void ToolBox::ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight ) @@ -3847,60 +3768,6 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, sal_Bool bPa // ----------------------------------------------------------------------- -void ToolBox::ImplStartCustomizeMode() -{ - mbCustomizeMode = sal_True; - - mpData->ImplClearLayoutData(); - - std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); - while ( it != mpData->m_aItems.end() ) - { - if ( it->mbShowWindow ) - { - it->mpWindow->Hide(); - - if ( !(it->maRect.IsEmpty()) ) - Invalidate( it->maRect ); - } - - ++it; - } -} - -void ToolBox::SetCustomizeMode( sal_Bool bSet ) -{ - if ( bSet ) - ImplStartCustomizeMode(); - else - ImplEndCustomizeMode(); -} - -// ----------------------------------------------------------------------- - -void ToolBox::ImplEndCustomizeMode() -{ - mbCustomizeMode = sal_False; - - mpData->ImplClearLayoutData(); - - std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); - while ( it != mpData->m_aItems.end() ) - { - if ( it->mbShowWindow ) - { - if ( !(it->maRect.IsEmpty()) ) - Invalidate( it->maRect ); - - it->mpWindow->Show(); - } - - ++it; - } -} - -// ----------------------------------------------------------------------- - void ToolBox::ImplDrawFloatwinBorder( ImplToolItem* pItem ) { if ( !pItem->maRect.IsEmpty() ) @@ -5545,49 +5412,6 @@ void ToolBox::EnableCustomize( sal_Bool bEnable ) // ----------------------------------------------------------------------- -void ToolBox::StartCustomize( const Rectangle& rRect, void* pData ) -{ - DBG_ASSERT( mbCustomize, - "ToolBox::StartCustomize(): ToolBox must be customized" ); - - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - Point aMousePos = GetPointerPosPixel(); - Point aPos = ScreenToOutputPixel( rRect.TopLeft() ); - Rectangle aRect( aPos.X(), aPos.Y(), - aPos.X()+rRect.GetWidth()+SMALLBUTTON_HSIZE, - aPos.Y()+rRect.GetHeight()+SMALLBUTTON_VSIZE ); - aMousePos = ScreenToOutputPixel( aPos ); - Pointer aPtr; - SetPointer( aPtr ); - pMgr->StartDragging( this, aMousePos, aRect, 0, sal_False, pData ); -} - -// ----------------------------------------------------------------------- - -void ToolBox::StartCustomizeMode() -{ - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - pMgr->StartCustomizeMode(); -} - -// ----------------------------------------------------------------------- - -void ToolBox::EndCustomizeMode() -{ - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - pMgr->EndCustomizeMode(); -} - -// ----------------------------------------------------------------------- - -sal_Bool ToolBox::IsCustomizeMode() -{ - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - return pMgr->IsCustomizeMode(); -} - -// ----------------------------------------------------------------------- - void ToolBox::GetFocus() { DockingWindow::GetFocus(); @@ -5985,39 +5809,6 @@ ImplToolItem* ToolBox::ImplGetFirstValidItem( sal_uInt16 nLine ) return (it == mpData->m_aItems.end()) ? NULL : &(*it); } -// returns the last displayable item in the given line -ImplToolItem* ToolBox::ImplGetLastValidItem( sal_uInt16 nLine ) -{ - if( !nLine || nLine > mnCurLines ) - return NULL; - - nLine--; - ImplToolItem *pFound = NULL; - std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); - while( it != mpData->m_aItems.end() ) - { - // find correct line - if ( it->mbBreak ) - nLine--; - if( !nLine ) - { - // find last useful item - while( it != mpData->m_aItems.end() && ((it->meType == TOOLBOXITEM_BUTTON) && - /*it->mbEnabled &&*/ it->mbVisible && !ImplIsFixedControl( &(*it) )) ) - { - pFound = &(*it); - ++it; - if( it == mpData->m_aItems.end() || it->mbBreak ) - return pFound; // end of line: return last useful item - } - return pFound; - } - ++it; - } - - return pFound; -} - // ----------------------------------------------------------------------- sal_uInt16 ToolBox::ImplFindItemPos( const ImplToolItem* pItem, const std::vector< ImplToolItem >& rList ) diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 348ecec00104..3e32f5d02bf2 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -828,41 +828,6 @@ void ToolBox::RemoveItem( sal_uInt16 nPos ) // ----------------------------------------------------------------------- -void ToolBox::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos ) -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - - if ( nPos == nNewPos ) - return; - - if ( nPos < nNewPos ) - nNewPos--; - - // Existiert Item - if ( nPos != TOOLBOX_ITEM_NOTFOUND ) - { - // ToolBox-Item in der Liste verschieben - ImplToolItem aItem = mpData->m_aItems[nPos]; - mpData->m_aItems.erase( mpData->m_aItems.begin()+nPos ); - mpData->m_aItems.insert( (nNewPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nNewPos : mpData->m_aItems.end(), aItem ); - mpData->ImplClearLayoutData(); - - // ToolBox neu ausgeben - ImplInvalidate( sal_False ); - - // Notify - if( nPos < nNewPos ) // only send one event, all indices above this item are invalid anyway - ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMREMOVED, reinterpret_cast< void* >( nPos ) ); - else - { - sal_uInt16 nNewPos2 = sal::static_int_cast<sal_uInt16>(( nNewPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nNewPos); - ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos2 ) ); - } - } -} - -// ----------------------------------------------------------------------- - void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, sal_uInt16 nNewPos ) { @@ -893,29 +858,6 @@ void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, // ----------------------------------------------------------------------- -void ToolBox::CopyItems( const ToolBox& rToolBox ) -{ - mpData->ImplClearLayoutData(); - mpData->m_aItems = rToolBox.mpData->m_aItems; - // Absichern gegen das Loeschen im Select-Handler - mnCurItemId = 0; - mnHighItemId = 0; - - for( std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); - it != mpData->m_aItems.end(); ++it ) - { - it->mpWindow = NULL; - it->mbShowWindow = sal_False; - } - - ImplInvalidate( sal_True, sal_True ); - - // Notify - ImplCallEventListeners( VCLEVENT_TOOLBOX_ALLITEMSCHANGED ); -} - -// ----------------------------------------------------------------------- - void ToolBox::Clear() { mpData->m_aItems.clear(); @@ -1043,11 +985,6 @@ void ToolBox::SetPageScroll( sal_Bool b ) mpData->mbPageScroll = b; } -sal_Bool ToolBox::GetPageScroll() -{ - return mpData->mbPageScroll; -} - // ----------------------------------------------------------------------- void ToolBox::SetNextToolBox( const XubString& rStr ) @@ -1225,16 +1162,6 @@ Rectangle ToolBox::GetItemPosRect( sal_uInt16 nPos ) const } // ----------------------------------------------------------------------- -Rectangle ToolBox::GetItemDropDownRect( sal_uInt16 nItemId ) const -{ - if ( mbCalc || mbFormat ) - ((ToolBox*)this)->ImplFormat(); - - sal_uInt16 nPos = GetItemPos( nItemId ); - return GetItemPosDropDownRect( nPos ); -} - -// ----------------------------------------------------------------------- Rectangle ToolBox::GetItemPosDropDownRect( sal_uInt16 nPos ) const { @@ -1249,11 +1176,6 @@ Rectangle ToolBox::GetItemPosDropDownRect( sal_uInt16 nPos ) const // ----------------------------------------------------------------------- -Rectangle ToolBox::GetMenubuttonRect() const -{ - return mpData->maMenubuttonItem.maRect; -} - sal_Bool ToolBox::ImplHasExternalMenubutton() { // check if the borderwindow (i.e. the decoration) provides the menu button @@ -1459,55 +1381,6 @@ Image ToolBox::GetItemImage( sal_uInt16 nItemId ) const // ----------------------------------------------------------------------- -long ToolBox::GetItemImageAngle( sal_uInt16 nItemId ) const -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - - if ( pItem ) - return pItem->mnImageAngle; - else - return 0; -} - -// ----------------------------------------------------------------------- - -sal_Bool ToolBox::GetItemImageMirrorMode( sal_uInt16 nItemId ) const -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - - if ( pItem ) - return pItem->mbMirrorMode; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -void ToolBox::SetItemHighImage( sal_uInt16 nItemId, const Image& rImage ) -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - if ( pItem ) - { - DBG_ASSERT( (pItem->maImage.GetSizePixel() == rImage.GetSizePixel()) || - ((!rImage) == sal_True), "ToolBox::SetItemHighImage() - ImageSize != HighImageSize" ); - pItem->maHighImage = rImage; - } -} - -// ----------------------------------------------------------------------- - -Image ToolBox::GetItemHighImage( sal_uInt16 nItemId ) const -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - - if ( pItem ) - return pItem->maHighImage; - else - return Image(); -} - -// ----------------------------------------------------------------------- - void ToolBox::SetItemText( sal_uInt16 nItemId, const XubString& rText ) { sal_uInt16 nPos = GetItemPos( nItemId ); @@ -1668,18 +1541,6 @@ void ToolBox::SetItemDown( sal_uInt16 nItemId, sal_Bool bDown, sal_Bool bRelease // ----------------------------------------------------------------------- -sal_Bool ToolBox::IsItemDown( sal_uInt16 nItemId ) const -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - - if ( nPos != TOOLBOX_ITEM_NOTFOUND ) - return (nPos == mnCurPos); - else - return sal_False; -} - -// ----------------------------------------------------------------------- - void ToolBox::SetItemState( sal_uInt16 nItemId, TriState eState ) { sal_uInt16 nPos = GetItemPos( nItemId ); @@ -1969,13 +1830,6 @@ void ToolBox::SetOutStyle( sal_uInt16 nNewStyle ) // ----------------------------------------------------------------------- -void ToolBox::RecalcItems() -{ - ImplInvalidate( sal_True ); -} - -// ----------------------------------------------------------------------- - // disable key input if all items are disabled void ToolBox::ImplUpdateInputEnable() @@ -2066,37 +1920,6 @@ long ToolBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const // ----------------------------------------------------------------------- -long ToolBox::GetTextCount() const -{ - if( ! mpData->m_pLayoutData ) - ImplFillLayoutData(); - return mpData->m_pLayoutData ? mpData->m_pLayoutData->GetLineCount() : 0; -} - -// ----------------------------------------------------------------------- - -Pair ToolBox::GetTextStartEnd( long nText ) const -{ - if( ! mpData->m_pLayoutData ) - ImplFillLayoutData(); - return mpData->m_pLayoutData ? mpData->m_pLayoutData->GetLineStartEnd( nText ) : Pair( -1, -1 ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 ToolBox::GetDisplayItemId( long nText ) const -{ - sal_uInt16 nItemId = 0; - if( ! mpData->m_pLayoutData ) - ImplFillLayoutData(); - if( mpData->m_pLayoutData && nText >= 0 && (sal_uLong)nText < mpData->m_pLayoutData->m_aLineItemIds.size() ) - nItemId = mpData->m_pLayoutData->m_aLineItemIds[nText]; - return nItemId; -} - - -// ----------------------------------------------------------------------- - void ToolBox::SetDropdownClickHdl( const Link& rLink ) { mpData->maDropdownClickHdl = rLink; @@ -2154,11 +1977,6 @@ void ToolBox::SetMenuButtonHdl( const Link& rLink ) mpData->maMenuButtonHdl = rLink; } -const Link& ToolBox::GetMenuButtonHdl() const -{ - return mpData->maMenuButtonHdl; -} - // ----------------------------------------------------------------------- sal_Bool ToolBox::ImplHasClippedItems() diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index b8457d1267a5..1e4157f5fcd3 100755..100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -4340,8 +4340,7 @@ Window::~Window() if( xComponent.is() ) xComponent->dispose(); } - - catch ( Exception ) + catch (const Exception&) { // can be safely ignored here. } @@ -8378,8 +8377,7 @@ uno::Reference< XDropTarget > Window::GetDropTarget() mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = sal_True; } - - catch( RuntimeException ) + catch (const RuntimeException&) { // release all instances mpWindowImpl->mpFrameData->mxDropTarget.clear(); @@ -8430,6 +8428,16 @@ uno::Reference< XDragSource > Window::GetDragSource() 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 IOS + /* What does LibreOffice's use of DND concepts mean on + * iOS, huh, is this both inter-app DND (which clearly is + * meaningless), or intra-app? Anyway, use the same code + * as for MacOSX for now, even if meaningless... + */ + 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 ); @@ -8452,7 +8460,7 @@ uno::Reference< XDragSource > Window::GetDragSource() } // createInstance can throw any exception - catch( Exception ) + catch (const Exception&) { // release all instances mpWindowImpl->mpFrameData->mxDropTarget.clear(); @@ -8532,7 +8540,7 @@ uno::Reference< XClipboard > Window::GetClipboard() } // createInstance can throw any exception - catch( Exception ) + catch (const Exception&) { // release all instances mpWindowImpl->mpFrameData->mxClipboard.clear(); @@ -8584,7 +8592,7 @@ uno::Reference< XClipboard > Window::GetPrimarySelection() } // createInstance can throw any exception - catch( Exception ) + catch (const Exception&) { // release all instances mpWindowImpl->mpFrameData->mxSelection.clear(); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index bf81d2665f48..a2dd24378e37 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1759,11 +1759,6 @@ sal_Bool Window::IsCompoundControl() const return mpWindowImpl->mbCompoundControl; } -sal_Bool Window::HasCompoundControlFocus() const -{ - return mpWindowImpl->mbCompoundControlHasFocus; -} - sal_Bool Window::IsChildPointerOverwrite() const { return mpWindowImpl->mbChildPtrOverwrite; diff --git a/vcl/source/window/window4.cxx b/vcl/source/window/window4.cxx index 775249c450ee..b4abcf229502 100644 --- a/vcl/source/window/window4.cxx +++ b/vcl/source/window/window4.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -223,3 +224,4 @@ uno::Sequence< beans::PropertyValue > Window::getProperties() const return aProps; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/wpropset.cxx b/vcl/source/window/wpropset.cxx index 10e3e8fa5e2f..ceca8f8784d6 100644 --- a/vcl/source/window/wpropset.cxx +++ b/vcl/source/window/wpropset.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -345,3 +346,5 @@ IMPL_LINK( vcl::WindowPropertySet, ChildEventListener, VclWindowEvent*, pEvent ) return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 24ca3c9120d5..24ca3c9120d5 100755..100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx diff --git a/vcl/unx/generic/app/i18n_xkb.cxx b/vcl/unx/generic/app/i18n_xkb.cxx index cb93f48b6bd7..c9e42dda6751 100644 --- a/vcl/unx/generic/app/i18n_xkb.cxx +++ b/vcl/unx/generic/app/i18n_xkb.cxx @@ -36,16 +36,10 @@ #include "unx/saldata.hxx" #include "unx/i18n_xkb.hxx" -SalI18N_KeyboardExtension::SalI18N_KeyboardExtension( Display* -#if __XKeyboardExtension__ -pDisplay -#endif -) - : mbUseExtension( (sal_Bool)__XKeyboardExtension__ ), +SalI18N_KeyboardExtension::SalI18N_KeyboardExtension( Display* pDisplay ) + : mbUseExtension( sal_True ), mnDefaultGroup( 0 ) { - #if __XKeyboardExtension__ - mpDisplay = pDisplay; // allow user to set the default keyboard group idx or to disable the usage @@ -94,19 +88,11 @@ pDisplay XkbGetState( mpDisplay, XkbUseCoreKbd, &aStateRecord ); mnGroup = aStateRecord.group; } - - #endif // __XKeyboardExtension__ } void -SalI18N_KeyboardExtension::Dispatch( XEvent* -#if __XKeyboardExtension__ -pEvent -#endif -) +SalI18N_KeyboardExtension::Dispatch( XEvent* pEvent ) { - #if __XKeyboardExtension__ - // must the event be handled? if ( !mbUseExtension || (pEvent->type != mnEventBase) ) @@ -130,21 +116,13 @@ pEvent #endif break; } - #endif // __XKeyboardExtension__ } -#if __XKeyboardExtension__ sal_uInt32 SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32 nKeyCode, sal_uInt32 nShiftState, sal_uInt32 nGroup ) const -#else -sal_uInt32 -SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32,sal_uInt32,sal_uInt32 ) const -#endif { - #if __XKeyboardExtension__ - if ( !mbUseExtension ) return NoSymbol; @@ -153,12 +131,6 @@ SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32,sal_uInt32,sal_uInt32 KeySym nKeySymbol; nKeySymbol = XkbKeycodeToKeysym( mpDisplay, nKeyCode, nGroup, nShiftState ); return nKeySymbol; - - #else - - return NoSymbol; - - #endif // __XKeyboardExtension__ } diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx index e164d06d5d07..c2db38c2a13a 100644 --- a/vcl/unx/generic/app/keysymnames.cxx +++ b/vcl/unx/generic/app/keysymnames.cxx @@ -583,7 +583,7 @@ static const keyboard_layout type6_layout[] = const char* SalDisplay::GetKeyboardName( bool bRefresh ) { - if( bRefresh || ! m_aKeyboardName.Len() ) + if (bRefresh || m_aKeyboardName.isEmpty()) { #if defined(SOLARIS) if( IsLocal() ) @@ -665,10 +665,10 @@ const char* SalDisplay::GetKeyboardName( bool bRefresh ) } } #endif - if( ! m_aKeyboardName.Len() ) + if (m_aKeyboardName.isEmpty()) m_aKeyboardName = "<unknown keyboard>"; } - return m_aKeyboardName.GetBuffer(); + return m_aKeyboardName.getStr(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 358bbc205004..8156b86cab08 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -885,10 +885,7 @@ void SalDisplay::Init() sscanf( pProperties, "%li", &nProperties_ ); else { -#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD || \ - defined NETBSD || defined OPENBSD || defined DRAGONFLY nProperties_ |= PROPERTY_FEATURE_Maximize; -#endif // Server Bugs & Properties if( GetServerVendor() == vendor_excursion ) { @@ -909,31 +906,6 @@ void SalDisplay::Init() if( otherwm == eWindowManager_ ) eWindowManager_ = mwm; } else - if( GetServerVendor() == vendor_xfree ) - { - nProperties_ |= PROPERTY_BUG_XCopyArea_GXxor; -#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 - // doesn't harm. #57791# start maximized if possible - if( (otherwm == eWindowManager_) - || (olwm == eWindowManager_ )) - { - eWindowManager_ = fvwm; // ??? - nProperties_ |= PROPERTY_FEATURE_Maximize; - } -#else - if( otherwm == eWindowManager_ ) eWindowManager_ = winmgr; -#endif -#if defined SOLARIS && defined SPARC - nProperties_ |= PROPERTY_BUG_Bitmap_Bit_Order; - // solaris xlib seems to have problems with putting images - // in correct bit order to xfree 8 bit displays -#endif - } - else if( GetServerVendor() == vendor_sun ) { // nicht alle! (bekannt: nur Sparc II CG3, CG6?) @@ -2358,7 +2330,7 @@ void SalX11Display::Yield() if( pXLib_->HasXErrorOccurred() ) { XFlush( pDisp_ ); - PrintEvent( "SalDisplay::Yield (WasXError)", &aEvent ); + DbgPrintDisplayEvent("SalDisplay::Yield (WasXError)", &aEvent); } #endif pXLib_->ResetXErrorOccurred(); @@ -2475,14 +2447,13 @@ long SalX11Display::Dispatch( XEvent *pEvent ) return 0; } -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void SalDisplay::PrintEvent( const ByteString &rComment, - XEvent *pEvent ) const +#ifdef DBG_UTIL +void SalDisplay::DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) const { if( pEvent->type <= MappingNotify ) { fprintf( stderr, "[%s] %s s=%d w=%ld\n", - rComment.GetBuffer(), + pComment, EventNames[pEvent->type], pEvent->xany.send_event, pEvent->xany.window ); @@ -2609,11 +2580,12 @@ void SalDisplay::PrintEvent( const ByteString &rComment, } else fprintf( stderr, "[%s] %d s=%d w=%ld\n", - rComment.GetBuffer(), + pComment, pEvent->type, pEvent->xany.send_event, pEvent->xany.window ); } +#endif // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void SalDisplay::PrintInfo() const diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index ad9b5ee22d6c..7ad584953069 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -228,8 +228,9 @@ WMAdaptor* WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay ) pAdaptor = new WMAdaptor( pSalDisplay ); #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "Window Manager's name is \"%s\"\n", - ByteString( pAdaptor->getWindowManagerName(), RTL_TEXTENCODING_ISO_8859_1 ).GetBuffer() ); + fprintf(stderr, "Window Manager's name is \"%s\"\n", + rtl::OUStringToOString(pAdaptor->getWindowManagerName(), + RTL_TEXTENCODING_UTF8).getStr()); #endif return pAdaptor; } @@ -1075,10 +1076,11 @@ void GnomeWMAdaptor::initAtoms() void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const { - ByteString aTitle( rWMName, osl_getThreadTextEncoding() ); + rtl::OString aTitle(rtl::OUStringToOString(rWMName, + osl_getThreadTextEncoding())); if( ! rWMName.Len() && m_aWMName.EqualsAscii( "Dtwm" ) ) - aTitle = " "; + aTitle = rtl::OString(' '); ::rtl::OString aWMLocale; rtl_Locale* pLocale = NULL; @@ -1140,7 +1142,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const } #endif - char* pT = const_cast<char*>(aTitle.GetBuffer()); + char* pT = const_cast<char*>(aTitle.getStr()); XTextProperty aProp = { NULL, None, 0, 0 }; if( bTrustXmb ) { @@ -1151,10 +1153,10 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const &aProp ); } - unsigned char* pData = aProp.nitems ? aProp.value : (unsigned char*)aTitle.GetBuffer(); - Atom nType = aProp.nitems ? aProp.encoding : XA_STRING; - int nFormat = aProp.nitems ? aProp.format : 8; - int nBytes = aProp.nitems ? aProp.nitems : aTitle.Len(); + unsigned char* pData = aProp.nitems ? aProp.value : (unsigned char*)aTitle.getStr(); + Atom nType = aProp.nitems ? aProp.encoding : XA_STRING; + int nFormat = aProp.nitems ? aProp.format : 8; + int nBytes = aProp.nitems ? aProp.nitems : aTitle.getLength(); const SystemEnvData* pEnv = pFrame->GetSystemData(); XChangeProperty( m_pDisplay, (XLIB_Window)pEnv->aShellWindow, @@ -1195,7 +1197,7 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const { WMAdaptor::setWMName( pFrame, rWMName ); - ByteString aTitle( rWMName, RTL_TEXTENCODING_UTF8 ); + rtl::OString aTitle(rtl::OUStringToOString(rWMName, RTL_TEXTENCODING_UTF8)); const SystemEnvData* pEnv = pFrame->GetSystemData(); if( m_aWMAtoms[ NET_WM_NAME ] ) XChangeProperty( m_pDisplay, @@ -1204,8 +1206,8 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const m_aWMAtoms[ UTF8_STRING ], 8, PropModeReplace, - (unsigned char*)aTitle.GetBuffer(), - aTitle.Len()+1 ); + (unsigned char*)aTitle.getStr(), + aTitle.getLength()+1 ); if( m_aWMAtoms[ NET_WM_ICON_NAME ] ) XChangeProperty( m_pDisplay, (XLIB_Window)pEnv->aShellWindow, @@ -1213,8 +1215,8 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const m_aWMAtoms[ UTF8_STRING ], 8, PropModeReplace, - (unsigned char*)aTitle.GetBuffer(), - aTitle.Len()+1 ); + (unsigned char*)aTitle.getStr(), + aTitle.getLength()+1 ); // The +1 copies the terminating null byte. Although // the spec says, this should not be necessary // at least the kwin implementation seems to depend diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx b/vcl/unx/generic/fontmanager/fontcache.cxx index e7a4008f07f0..e47c95ec07ca 100644 --- a/vcl/unx/generic/fontmanager/fontcache.cxx +++ b/vcl/unx/generic/fontmanager/fontcache.cxx @@ -40,6 +40,8 @@ #include "tools/stream.hxx" +#include <rtl/strbuf.hxx> + #include <unistd.h> #include <sys/stat.h> @@ -132,13 +134,14 @@ void FontCache::flush() const FontDirMap& rDir( dir_it->second.m_aEntries ); ByteString aDirectory( rManager.getDirectory( dir_it->first ) ); - ByteString aLine( "FontCacheDirectory:" ); - aLine.Append( ByteString::CreateFromInt64( dir_it->second.m_nTimestamp ) ); - aLine.Append( ':' ); - aLine.Append( aDirectory ); + rtl::OStringBuffer aLine( + RTL_CONSTASCII_STRINGPARAM("FontCacheDirectory:")); + aLine.append(dir_it->second.m_nTimestamp); + aLine.append(':'); + aLine.append(aDirectory); if( rDir.empty() && dir_it->second.m_bNoFiles ) - aLine.Insert( "Empty", 0 ); - aStream.WriteLine( aLine ); + aLine.insert(0, RTL_CONSTASCII_STRINGPARAM("Empty")); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); for( FontDirMap::const_iterator entry_it = rDir.begin(); entry_it != rDir.end(); ++entry_it ) { @@ -147,16 +150,16 @@ void FontCache::flush() if( rEntry.begin() == rEntry.end() ) continue; - aLine = "File:"; - aLine.Append( ByteString( entry_it->first ) ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("File:")); + aLine.append(entry_it->first); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); int nEntrySize = entry_it->second.m_aEntry.size(); // write: type;nfonts - aLine = ByteString::CreateFromInt32( rEntry.front()->m_eType ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( nEntrySize ) ); - aStream.WriteLine( aLine ); + aLine.append(static_cast<sal_Int32>(rEntry.front()->m_eType)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>(nEntrySize)); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); sal_Int32 nSubEntry = 0; for( FontCacheEntry::const_iterator it = rEntry.begin(); it != rEntry.end(); ++it, nSubEntry++ ) @@ -171,73 +174,73 @@ void FontCache::flush() else nSubEntry = -1; - aLine = OUStringToOString( pAtoms->getString( ATOM_FAMILYNAME, (*it)->m_nFamilyName ), RTL_TEXTENCODING_UTF8 ); + aLine.append(OUStringToOString(pAtoms->getString( ATOM_FAMILYNAME, (*it)->m_nFamilyName), RTL_TEXTENCODING_UTF8)); for( ::std::list< int >::const_iterator name_it = (*it)->m_aAliases.begin(); name_it != (*it)->m_aAliases.end(); ++name_it ) { const OUString& rAdd( pAtoms->getString( ATOM_FAMILYNAME, *name_it ) ); if( rAdd.getLength() ) { - aLine.Append( ';' ); - aLine.Append( ByteString( String( rAdd ), RTL_TEXTENCODING_UTF8 ) ); + aLine.append(';'); + aLine.append(OUStringToOString(rAdd, RTL_TEXTENCODING_UTF8)); } } - aStream.WriteLine( aLine ); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); const OUString& rPSName( pAtoms->getString( ATOM_PSNAME, (*it)->m_nPSName ) ); - aLine = ByteString::CreateFromInt32( nSubEntry ); - aLine.Append( ';' ); - aLine.Append( ByteString( String( rPSName ), RTL_TEXTENCODING_UTF8 ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_eItalic ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_eWeight ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_eWidth ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_ePitch ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aEncoding ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_nAscend ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_nDescend ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_nLeading ) ); - aLine.Append( ';' ); - aLine.Append( (*it)->m_bHaveVerticalSubstitutedGlyphs ? "1" : "0" ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricX.width ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricX.height ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricY.width ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricY.height ) ); - aLine.Append( ';' ); - aLine.Append( (*it)->m_bUserOverride ? "1" : "0" ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( 0 ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( 0 ) ); + aLine.append(nSubEntry); + aLine.append(';'); + aLine.append(OUStringToOString(rPSName, RTL_TEXTENCODING_UTF8)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_eItalic)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_eWeight)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_eWidth)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_ePitch)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_aEncoding)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_nAscend)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_nDescend)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_nLeading)); + aLine.append(';'); + aLine.append((*it)->m_bHaveVerticalSubstitutedGlyphs ? '1' : '0'); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricX.width )); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricX.height)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricY.width )); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricY.height)); + aLine.append(';'); + aLine.append((*it)->m_bUserOverride ? '1' : '0'); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>(0)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>(0)); switch( (*it)->m_eType ) { case fonttype::Type1: - aLine.Append( ';' ); - aLine.Append( ByteString( static_cast<const PrintFontManager::Type1FontFile*>(*it)->m_aMetricFile ) ); + aLine.append(';'); + aLine.append(static_cast<const PrintFontManager::Type1FontFile*>(*it)->m_aMetricFile); break; case fonttype::TrueType: - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( static_cast<const PrintFontManager::TrueTypeFontFile*>(*it)->m_nTypeFlags ) ); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>(static_cast<const PrintFontManager::TrueTypeFontFile*>(*it)->m_nTypeFlags)); break; default: break; } if( (*it)->m_aStyleName.getLength() ) { - aLine.Append( ';' ); - aLine.Append( ByteString( String( (*it)->m_aStyleName ), RTL_TEXTENCODING_UTF8 ) ); + aLine.append(';'); + aLine.append(OUStringToOString((*it)->m_aStyleName, RTL_TEXTENCODING_UTF8)); } - aStream.WriteLine( aLine ); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); } aStream.WriteLine( ByteString() ); } diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index c1d506d91d83..38a5e93e56f3 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -36,53 +36,40 @@ using namespace psp; -#ifdef ENABLE_FONTCONFIG - #include <fontconfig/fontconfig.h> - #include <ft2build.h> - #include <fontconfig/fcfreetype.h> - // allow compile on baseline (currently with fontconfig 2.2.0) - #ifndef FC_WEIGHT_BOOK // TODO: remove when baseline moves to fc>=2.2.1 - #define FC_WEIGHT_BOOK 75 - #endif - #ifndef FC_EMBEDDED_BITMAP // TODO: remove when baseline moves to fc>=2.3.92 - #define FC_EMBEDDED_BITMAP "embeddedbitmap" - #endif - #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 - #define FC_HINT_SLIGHT 1 - #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; - typedef void FcPattern; - typedef void FcFontSet; - typedef void FcCharSet; - typedef int FcResult; - typedef int FcBool; - typedef int FcMatchKind; - typedef char FcChar8; - typedef int FcChar32; - typedef unsigned int FT_UInt; - typedef void* FT_Face; - typedef int FcSetName; +#include <fontconfig/fontconfig.h> +#include <ft2build.h> +#include <fontconfig/fcfreetype.h> +// allow compile on baseline (currently with fontconfig 2.2.0) +#ifndef FC_WEIGHT_BOOK // TODO: remove when baseline moves to fc>=2.2.1 + #define FC_WEIGHT_BOOK 75 +#endif +#ifndef FC_EMBEDDED_BITMAP // TODO: remove when baseline moves to fc>=2.3.92 + #define FC_EMBEDDED_BITMAP "embeddedbitmap" +#endif +#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 + #define FC_HINT_SLIGHT 1 + #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 +#ifndef FC_FONTFORMAT + #define FC_FONTFORMAT "fontformat" #endif #include <cstdio> @@ -114,53 +101,8 @@ namespace class FontCfgWrapper { - oslModule m_pLib; FcFontSet* m_pOutlineSet; - 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*); - FcBool (*m_pFcPatternEqual)(const FcPattern*,const FcPattern*); - FcFontSet* (*m_pFcConfigGetFonts)(FcConfig*,FcSetName); - FcFontSet* (*m_pFcFontSetCreate)(); - FcCharSet* (*m_pFcCharSetCreate)(); - FcBool (*m_pFcCharSetAddChar)(FcCharSet *, FcChar32); - FcBool (*m_pFcCharSetHasChar)(FcCharSet *, FcChar32); - void (*m_pFcCharSetDestroy)(FcCharSet*); - void (*m_pFcFontSetDestroy)(FcFontSet*); - FcBool (*m_pFcFontSetAdd)(FcFontSet*,FcPattern*); - void (*m_pFcPatternReference)(FcPattern*); - FcResult (*m_pFcPatternGetCharSet)(const FcPattern*,const char*,int,FcCharSet**); - FcResult (*m_pFcPatternGetString)(const FcPattern*,const char*,int,FcChar8**); - FcResult (*m_pFcPatternGetInteger)(const FcPattern*,const char*,int,int*); - FcResult (*m_pFcPatternGetDouble)(const FcPattern*,const char*,int,double*); - FcResult (*m_pFcPatternGetBool)(const FcPattern*,const char*,int,FcBool*); - void (*m_pFcDefaultSubstitute)(FcPattern *); - FcPattern* (*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*); - FcPattern* (*m_pFcFontMatch)(FcConfig*,FcPattern*,FcResult*); - FcBool (*m_pFcConfigAppFontAddFile)(FcConfig*, const FcChar8*); - FcBool (*m_pFcConfigAppFontAddDir)(FcConfig*, const FcChar8*); - FcBool (*m_pFcConfigParseAndLoad)(FcConfig*,const FcChar8*,FcBool); - FcBool (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind); - - FcPattern* (*m_pFcPatternDuplicate)(const FcPattern*); - FcBool (*m_pFcPatternAddInteger)(FcPattern*,const char*,int); - FcBool (*m_pFcPatternAddDouble)(FcPattern*,const char*,double); - FcBool (*m_pFcPatternAddBool)(FcPattern*,const char*,FcBool); - FcBool (*m_pFcPatternAddCharSet)(FcPattern*,const char*,const FcCharSet*); - FcBool (*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*); - 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 ); FontCfgWrapper(); @@ -170,127 +112,8 @@ public: static FontCfgWrapper& get(); static void release(); - bool isValid() const - { return m_pLib != NULL;} - FcFontSet* getFontSet(); - 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(); } - - FcConfig* FcConfigGetCurrent() - { return m_pFcConfigGetCurrent(); } - - FcObjectSet* FcObjectSetBuild( const char* first, ... ) - { - va_list ap; - va_start( ap, first ); - FcObjectSet* pSet = m_pFcObjectSetVaBuild( first, ap ); - va_end( ap ); - return pSet; - } - - void FcObjectSetDestroy( FcObjectSet* pSet ) - { m_pFcObjectSetDestroy( pSet ); } - - FcPattern* FcPatternCreate() - { return m_pFcPatternCreate(); } - - void FcPatternDestroy( FcPattern* pPattern ) - { if (m_pFcPatternDestroy) m_pFcPatternDestroy( pPattern ); } - - FcBool FcPatternEqual( const FcPattern* pPatternA, const FcPattern *pPatternB ) - { return m_pFcPatternEqual( pPatternA, pPatternB ); } - - FcFontSet* FcConfigGetFonts( FcConfig* pConfig, FcSetName eSet) - { return m_pFcConfigGetFonts( pConfig, eSet ); } - - FcFontSet* FcFontSetCreate() - { return m_pFcFontSetCreate(); } - - FcCharSet* FcCharSetCreate() - { return m_pFcCharSetCreate(); } - - FcBool FcCharSetAddChar(FcCharSet *fcs, FcChar32 ucs4) - { return m_pFcCharSetAddChar(fcs, ucs4); } - - FcBool FcCharSetHasChar(FcCharSet *fcs, FcChar32 ucs4) - { return m_pFcCharSetHasChar(fcs, ucs4); } - - void FcCharSetDestroy( FcCharSet* pSet ) - { m_pFcCharSetDestroy( pSet );} - - void FcFontSetDestroy( FcFontSet* pSet ) - { m_pFcFontSetDestroy( pSet );} - - FcBool FcFontSetAdd( FcFontSet* pSet, FcPattern* pPattern ) - { return m_pFcFontSetAdd( pSet, pPattern ); } - - void FcPatternReference( FcPattern* pPattern ) - { m_pFcPatternReference( pPattern ); } - - FcResult FcPatternGetCharSet( const FcPattern* pPattern, const char* object, int n, FcCharSet** s ) - { return m_pFcPatternGetCharSet( pPattern, object, n, s ); } - - FcResult FcPatternGetString( const FcPattern* pPattern, const char* object, int n, FcChar8** s ) - { return m_pFcPatternGetString( pPattern, object, n, s ); } - - FcResult FcPatternGetInteger( const FcPattern* pPattern, const char* object, int n, int* s ) - { return m_pFcPatternGetInteger( pPattern, object, n, s ); } - - FcResult FcPatternGetDouble( const FcPattern* pPattern, const char* object, int n, double* s ) - { return m_pFcPatternGetDouble( pPattern, object, n, s ); } - - FcResult FcPatternGetBool( const FcPattern* pPattern, const char* object, int n, FcBool* s ) - { return m_pFcPatternGetBool( pPattern, object, n, s ); } - FcBool FcConfigAppFontAddFile( FcConfig* pConfig, const FcChar8* pFileName ) - { return m_pFcConfigAppFontAddFile( pConfig, pFileName ); } - FcBool FcConfigAppFontAddDir(FcConfig* pConfig, const FcChar8* pDirName ) - { return m_pFcConfigAppFontAddDir( pConfig, pDirName ); } - FcBool FcConfigParseAndLoad( FcConfig* pConfig, const FcChar8* pFileName, FcBool bComplain ) - { return m_pFcConfigParseAndLoad( pConfig, pFileName, bComplain ); } - - void FcDefaultSubstitute( FcPattern* pPattern ) - { m_pFcDefaultSubstitute( pPattern ); } - FcPattern* FcFontSetMatch( FcConfig* pConfig, FcFontSet **ppFontSet, int nset, FcPattern* pPattern, FcResult* pResult ) - { return m_pFcFontSetMatch ? m_pFcFontSetMatch( pConfig, ppFontSet, nset, pPattern, pResult ) : 0; } - FcPattern* FcFontMatch( FcConfig* pConfig, FcPattern* pPattern, FcResult* pResult ) - { return m_pFcFontMatch( pConfig, pPattern, pResult ); } - FcBool FcConfigSubstitute( FcConfig* pConfig, FcPattern* pPattern, FcMatchKind eKind ) - { return m_pFcConfigSubstitute( pConfig, pPattern, eKind ); } - - FcPattern* FcPatternDuplicate( const FcPattern* pPattern ) const - { return m_pFcPatternDuplicate( pPattern ); } - FcBool FcPatternAddInteger( FcPattern* pPattern, const char* pObject, int nValue ) - { return m_pFcPatternAddInteger( pPattern, pObject, nValue ); } - FcBool FcPatternAddDouble( FcPattern* pPattern, const char* pObject, double nValue ) - { return m_pFcPatternAddDouble( pPattern, pObject, nValue ); } - FcBool FcPatternAddString( FcPattern* pPattern, const char* pObject, const FcChar8* pString ) - { return m_pFcPatternAddString( pPattern, pObject, pString ); } - FcBool FcPatternAddBool( FcPattern* pPattern, const char* pObject, bool nValue ) - { return m_pFcPatternAddBool( pPattern, pObject, nValue ); } - FcBool FcPatternAddCharSet(FcPattern* pPattern,const char* pObject,const FcCharSet*pCharSet) - { return m_pFcPatternAddCharSet(pPattern,pObject,pCharSet); } - FcBool FcPatternDel(FcPattern* pPattern, const char* object) - { return m_pFcPatternDel( pPattern, object); } - - FT_UInt FcFreeTypeCharIndex( FT_Face face, FcChar32 ucs4 ) - { return m_pFcFreeTypeCharIndex ? m_pFcFreeTypeCharIndex( face, ucs4 ) : 0; } - 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); @@ -301,189 +124,14 @@ private: void cacheLocalizedFontNames(FcChar8 *origfontname, FcChar8 *bestfontname, const std::vector< lang_and_element > &lang_and_elements); }; -oslGenericFunction FontCfgWrapper::loadSymbol( const char* pSymbol ) -{ - OUString aSym( OUString::createFromAscii( pSymbol ) ); - oslGenericFunction pSym = osl_getFunctionSymbol( m_pLib, aSym.pData ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "%s %s\n", pSymbol, pSym ? "found" : "not found" ); -#endif - return pSym; -} - FontCfgWrapper::FontCfgWrapper() - : m_pLib( NULL ), - m_pOutlineSet( NULL ), - m_nFcVersion( 0 ) + : m_pOutlineSet( NULL ) { - OUString aLib( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so.1" ) ); - m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY ); - if( !m_pLib ) - { - aLib = OUString( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so" ) ); - m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY ); - } - - if( ! m_pLib ) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "no libfontconfig\n" ); -#endif - return; - } - - m_pFcInit = (FcBool(*)()) - loadSymbol( "FcInit" ); - m_pFcFini = (void(*)()) - loadSymbol( "FcFini" ); - m_pFcGetVersion = (int(*)()) - loadSymbol( "FcGetVersion" ); - m_pFcConfigGetCurrent = (FcConfig *(*)()) - loadSymbol( "FcConfigGetCurrent" ); - m_pFcObjectSetVaBuild = (FcObjectSet*(*)(const char*,va_list)) - loadSymbol( "FcObjectSetVaBuild" ); - m_pFcObjectSetDestroy = (void(*)(FcObjectSet*)) - loadSymbol( "FcObjectSetDestroy" ); - m_pFcPatternCreate = (FcPattern*(*)()) - loadSymbol( "FcPatternCreate" ); - m_pFcPatternDestroy = (void(*)(FcPattern*)) - loadSymbol( "FcPatternDestroy" ); - m_pFcPatternEqual = (FcBool(*)(const FcPattern*,const FcPattern*)) - loadSymbol( "FcPatternEqual" ); - m_pFcConfigGetFonts = (FcFontSet*(*)(FcConfig*,FcSetName)) - loadSymbol( "FcConfigGetFonts" ); - m_pFcFontSetCreate = (FcFontSet*(*)()) - loadSymbol( "FcFontSetCreate" ); - m_pFcCharSetCreate = (FcCharSet*(*)()) - loadSymbol( "FcCharSetCreate" ); - m_pFcCharSetAddChar = (FcBool(*)(FcCharSet*, FcChar32)) - loadSymbol( "FcCharSetAddChar" ); - m_pFcCharSetHasChar = (FcBool(*)(FcCharSet*, FcChar32)) - loadSymbol( "FcCharSetHasChar" ); - m_pFcCharSetDestroy = (void(*)(FcCharSet*)) - loadSymbol( "FcCharSetDestroy" ); - m_pFcFontSetDestroy = (void(*)(FcFontSet*)) - loadSymbol( "FcFontSetDestroy" ); - m_pFcFontSetAdd = (FcBool(*)(FcFontSet*,FcPattern*)) - loadSymbol( "FcFontSetAdd" ); - m_pFcPatternReference = (void(*)(FcPattern*)) - loadSymbol( "FcPatternReference" ); - m_pFcPatternGetCharSet = (FcResult(*)(const FcPattern*,const char*,int,FcCharSet**)) - loadSymbol( "FcPatternGetCharSet" ); - m_pFcPatternGetString = (FcResult(*)(const FcPattern*,const char*,int,FcChar8**)) - loadSymbol( "FcPatternGetString" ); - m_pFcPatternGetInteger = (FcResult(*)(const FcPattern*,const char*,int,int*)) - loadSymbol( "FcPatternGetInteger" ); - m_pFcPatternGetDouble = (FcResult(*)(const FcPattern*,const char*,int,double*)) - loadSymbol( "FcPatternGetDouble" ); - m_pFcPatternGetBool = (FcResult(*)(const FcPattern*,const char*,int,FcBool*)) - loadSymbol( "FcPatternGetBool" ); - m_pFcConfigAppFontAddFile = (FcBool(*)(FcConfig*, const FcChar8*)) - loadSymbol( "FcConfigAppFontAddFile" ); - m_pFcConfigAppFontAddDir = (FcBool(*)(FcConfig*, const FcChar8*)) - loadSymbol( "FcConfigAppFontAddDir" ); - m_pFcConfigParseAndLoad = (FcBool(*)(FcConfig*, const FcChar8*, FcBool)) - loadSymbol( "FcConfigParseAndLoad" ); - m_pFcDefaultSubstitute = (void(*)(FcPattern *)) - loadSymbol( "FcDefaultSubstitute" ); - m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**,int,FcPattern*,FcResult*)) - loadSymbol( "FcFontSetMatch" ); - m_pFcFontMatch = (FcPattern*(*)(FcConfig*,FcPattern*,FcResult*)) - loadSymbol( "FcFontMatch" ); - m_pFcConfigSubstitute = (FcBool(*)(FcConfig*,FcPattern*,FcMatchKind)) - loadSymbol( "FcConfigSubstitute" ); - - m_pFcPatternDuplicate = (FcPattern*(*)(const FcPattern*)) - loadSymbol( "FcPatternDuplicate" ); - m_pFcPatternAddInteger = (FcBool(*)(FcPattern*,const char*,int)) - loadSymbol( "FcPatternAddInteger" ); - m_pFcPatternAddDouble = (FcBool(*)(FcPattern*,const char*,double)) - loadSymbol( "FcPatternAddDouble" ); - m_pFcPatternAddBool = (FcBool(*)(FcPattern*,const char*,FcBool)) - loadSymbol( "FcPatternAddBool" ); - m_pFcPatternAddCharSet = (FcBool(*)(FcPattern*,const char*,const FcCharSet *)) - loadSymbol( "FcPatternAddCharSet" ); - m_pFcPatternAddString = (FcBool(*)(FcPattern*,const char*,const FcChar8*)) - loadSymbol( "FcPatternAddString" ); - m_pFcPatternDel = (FcBool(*)(FcPattern*,const char*)) - loadSymbol( "FcPatternDel" ); - - 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) - fprintf( stderr,"FC_VERSION = %05d\n", m_nFcVersion ); -#endif - // make minimum version configurable - const char* pMinFcVersion = getenv( "SAL_MIN_FC_VERSION"); - if( pMinFcVersion ) - { - const int nMinFcVersion = atoi( pMinFcVersion ); - if( m_nFcVersion < nMinFcVersion ) - m_pFcInit = NULL; - } - - if( ! ( - m_pFcInit && - m_pFcGetVersion && - m_pFcConfigGetCurrent && - m_pFcObjectSetVaBuild && - m_pFcObjectSetDestroy && - m_pFcPatternCreate && - m_pFcPatternDestroy && - m_pFcPatternEqual && - m_pFcConfigGetFonts && - m_pFcFontSetCreate && - m_pFcCharSetCreate && - m_pFcCharSetAddChar && - m_pFcCharSetHasChar && - m_pFcCharSetDestroy && - m_pFcFontSetDestroy && - m_pFcFontSetAdd && - m_pFcPatternReference && - m_pFcPatternGetCharSet && - m_pFcPatternGetString && - m_pFcPatternGetInteger && - m_pFcPatternGetDouble && - m_pFcPatternGetBool && - m_pFcConfigAppFontAddFile && - m_pFcConfigAppFontAddDir && - m_pFcConfigParseAndLoad && - m_pFcFontMatch && - m_pFcDefaultSubstitute && - m_pFcConfigSubstitute && - m_pFcPatternDuplicate && - m_pFcPatternAddInteger && - m_pFcPatternAddDouble && - m_pFcPatternAddCharSet && - m_pFcPatternAddBool && - m_pFcPatternAddString && - m_pFcPatternDel - ) ) - { - osl_unloadModule( (oslModule)m_pLib ); - m_pLib = NULL; -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "not all needed symbols were found in libfontconfig\n" ); -#endif - return; - } - - FcInit(); - if( ! FcConfigGetCurrent() ) - { - osl_unloadModule( (oslModule)m_pLib ); - m_pLib = NULL; - } } void FontCfgWrapper::addFontSet( FcSetName eSetName ) { - #ifdef ENABLE_FONTCONFIG /* add only acceptable outlined fonts to our config, for future fontconfig use @@ -506,20 +154,16 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName ) } // TODO?: FcFontSetDestroy( pOrig ); - #else - (void)eSetName; // prevent compiler warning about unused parameter - #endif } -#ifdef ENABLE_FONTCONFIG namespace { - int compareFontNames(FontCfgWrapper& rWrapper, const FcPattern *a, const FcPattern *b) + int compareFontNames(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; + bool bHaveA = FcPatternGetString(a, FC_FAMILY, 0, &pNameA) == FcResultMatch; + bool bHaveB = FcPatternGetString(b, FC_FAMILY, 0, &pNameB) == FcResultMatch; if (bHaveA && bHaveB) return strcmp((const char*)pNameA, (const char*)pNameB); @@ -531,21 +175,17 @@ namespace //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); + int comp = compareFontNames(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; + bool bHaveA = FcPatternGetInteger(a, FC_FONTVERSION, 0, &nVersionA) == FcResultMatch; + bool bHaveB = FcPatternGetInteger(b, FC_FONTVERSION, 0, &nVersionB) == FcResultMatch; if (bHaveA && bHaveB) return nVersionA > nVersionB; @@ -560,7 +200,7 @@ namespace //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) + bool isPreviouslyDuplicateOrObsoleted(FcFontSet *pFSet, int i) { if (i == 0) return false; @@ -568,46 +208,41 @@ namespace const FcPattern *a = pFSet->fonts[i]; const FcPattern *b = pFSet->fonts[i-1]; - if (compareFontNames(rWrapper, a, b) != 0) + if (compareFontNames(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* pTestPatternA = FcPatternDuplicate(a); + FcPatternDel(pTestPatternA, FC_FILE); + FcPatternDel(pTestPatternA, FC_CHARSET); + FcPatternDel(pTestPatternA, FC_CAPABILITY); + 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); + FcPattern* pTestPatternB = FcPatternDuplicate(b); + FcPatternDel(pTestPatternB, FC_FILE); + FcPatternDel(pTestPatternB, FC_CHARSET); + FcPatternDel(pTestPatternB, FC_CAPABILITY); + FcPatternDel(pTestPatternB, FC_FONTVERSION); - bool bIsDup = false; - if (rWrapper.FcPatternEqual(pTestPatternA, pTestPatternB)) - bIsDup = true; + bool bIsDup = FcPatternEqual(pTestPatternA, pTestPatternB); - rWrapper.FcPatternDestroy(pTestPatternB); - rWrapper.FcPatternDestroy(pTestPatternA); + FcPatternDestroy(pTestPatternB); + FcPatternDestroy(pTestPatternA); return bIsDup; } } -#endif FcFontSet* FontCfgWrapper::getFontSet() { - #ifdef ENABLE_FONTCONFIG if( !m_pOutlineSet ) { m_pOutlineSet = FcFontSetCreate(); addFontSet( FcSetSystem ); - if( m_nFcVersion > 20400 ) // #i85462# prevent crashes + if( FcGetVersion() > 20400 ) // #i85462# prevent crashes addFontSet( FcSetApplication ); - ::std::sort(m_pOutlineSet->fonts,m_pOutlineSet->fonts+m_pOutlineSet->nfont,SortFont(*this)); + ::std::sort(m_pOutlineSet->fonts,m_pOutlineSet->fonts+m_pOutlineSet->nfont,SortFont()); } - #endif return m_pOutlineSet; } @@ -616,9 +251,8 @@ FontCfgWrapper::~FontCfgWrapper() { if( m_pOutlineSet ) FcFontSetDestroy( m_pOutlineSet ); - FcFini(); - if( m_pLib ) - osl_unloadModule( (oslModule)m_pLib ); + //To-Do: get gtk vclplug smoketest to pass + //FcFini(); } static FontCfgWrapper* pOneInstance = NULL; @@ -639,7 +273,6 @@ void FontCfgWrapper::release() } } -#ifdef ENABLE_FONTCONFIG namespace { class localizedsorter @@ -749,9 +382,7 @@ FcResult FontCfgWrapper::LocalizedElementFromPattern(FcPattern* pPattern, FcChar */ bool PrintFontManager::initFontconfig() { - FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( ! rWrapper.isValid() ) - return false; + FontCfgWrapper::get(); return true; } @@ -827,8 +458,6 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i int nFonts = 0; FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( !rWrapper.isValid() ) - return 0; FcFontSet* pFSet = rWrapper.getFontSet(); if( pFSet ) @@ -841,20 +470,22 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i FcChar8* file = NULL; FcChar8* family = NULL; FcChar8* style = NULL; + FcChar8* format = NULL; int slant = 0; int weight = 0; int spacing = 0; int nCollectionEntry = -1; FcBool outline = false; - FcResult eFileRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_FILE, 0, &file ); + FcResult eFileRes = FcPatternGetString(pFSet->fonts[i], FC_FILE, 0, &file); 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 ); - FcResult eOutRes = rWrapper.FcPatternGetBool( pFSet->fonts[i], FC_OUTLINE, 0, &outline ); - FcResult eIndexRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_INDEX, 0, &nCollectionEntry ); + FcResult eSlantRes = FcPatternGetInteger(pFSet->fonts[i], FC_SLANT, 0, &slant); + FcResult eWeightRes = FcPatternGetInteger(pFSet->fonts[i], FC_WEIGHT, 0, &weight); + FcResult eSpacRes = FcPatternGetInteger(pFSet->fonts[i], FC_SPACING, 0, &spacing); + FcResult eOutRes = FcPatternGetBool(pFSet->fonts[i], FC_OUTLINE, 0, &outline); + FcResult eIndexRes = FcPatternGetInteger(pFSet->fonts[i], FC_INDEX, 0, &nCollectionEntry); + FcResult eFormatRes = FcPatternGetString(pFSet->fonts[i], FC_FONTFORMAT, 0, &format); if( eFileRes != FcResultMatch || eFamilyRes != FcResultMatch || eOutRes != FcResultMatch ) continue; @@ -862,13 +493,14 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i #if (OSL_DEBUG_LEVEL > 2) fprintf( stderr, "found font \"%s\" in file %s\n" " weight = %d, slant = %d, style = \"%s\"\n" - " spacing = %d, outline = %d\n" + " spacing = %d, outline = %d, format %s\n" , family, file , eWeightRes == FcResultMatch ? weight : -1 , eSpacRes == FcResultMatch ? slant : -1 , eStyleRes == FcResultMatch ? (const char*) style : "<nil>" , eSpacRes == FcResultMatch ? spacing : -1 , eOutRes == FcResultMatch ? outline : -1 + , eFormatRes == FcResultMatch ? (const char*)format : "<unknown>" ); #endif @@ -878,7 +510,7 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i if( eOutRes == FcResultMatch && ! outline ) continue; - if (isPreviouslyDuplicateOrObsoleted(rWrapper, pFSet, i)) + if (isPreviouslyDuplicateOrObsoleted(pFSet, i)) { #if OSL_DEBUG_LEVEL > 2 fprintf(stderr, "Ditching %s as duplicate/obsolete\n", file); @@ -903,7 +535,9 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i // not known, analyze font file to get attributes // not described by fontconfig (e.g. alias names, PSName) std::list< OString > aDummy; - analyzeFontFile( nDirID, aBase, aDummy, aFonts ); + if (eFormatRes != FcResultMatch) + format = NULL; + analyzeFontFile( nDirID, aBase, aDummy, aFonts, (const char*)format ); #if OSL_DEBUG_LEVEL > 1 if( aFonts.empty() ) fprintf( stderr, "Warning: file \"%s\" is unusable to psprint\n", aOrgPath.getStr() ); @@ -1004,25 +638,15 @@ void PrintFontManager::deinitFontconfig() FontCfgWrapper::release(); } -int PrintFontManager::FreeTypeCharIndex( void *pFace, sal_uInt32 aChar ) -{ - FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - return rWrapper.isValid() ? rWrapper.FcFreeTypeCharIndex( (FT_Face)pFace, aChar ) : 0; -} - bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) { - FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( ! rWrapper.isValid() ) - return false; - // workaround for a stability problems in older FC versions // when handling application specifc fonts - const int nVersion = rWrapper.FcGetVersion(); + const int nVersion = FcGetVersion(); if( nVersion <= 20400 ) return false; const char* pDirName = (const char*)rDirName.getStr(); - bool bDirOk = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue); + bool bDirOk = (FcConfigAppFontAddDir(FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bDirOk ); @@ -1037,8 +661,8 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) if( pCfgFile ) { fclose( pCfgFile); - bool bCfgOk = rWrapper.FcConfigParseAndLoad( rWrapper.FcConfigGetCurrent(), - (FcChar8*)aConfFileName.getStr(), FcTrue ); + bool bCfgOk = FcConfigParseAndLoad(FcConfigGetCurrent(), + (FcChar8*)aConfFileName.getStr(), FcTrue); if( !bCfgOk ) fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk ); } @@ -1046,7 +670,7 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) return true; } -static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, +static void addtopattern(FcPattern *pPattern, FontItalic eItalic, FontWeight eWeight, FontWidth eWidth, FontPitch ePitch) { if( eItalic != ITALIC_DONTKNOW ) @@ -1054,12 +678,16 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, int nSlant = FC_SLANT_ROMAN; switch( eItalic ) { - case ITALIC_NORMAL: 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 ); + FcPatternAddInteger(pPattern, FC_SLANT, nSlant); } if( eWeight != WEIGHT_DONTKNOW ) { @@ -1079,7 +707,7 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, default: break; } - rWrapper.FcPatternAddInteger( pPattern, FC_WEIGHT, nWeight ); + FcPatternAddInteger(pPattern, FC_WEIGHT, nWeight); } if( eWidth != WIDTH_DONTKNOW ) { @@ -1098,7 +726,7 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, default: break; } - rWrapper.FcPatternAddInteger( pPattern, FC_WIDTH, nWidth ); + FcPatternAddInteger(pPattern, FC_WIDTH, nWidth); } if( ePitch != PITCH_DONTKNOW ) { @@ -1110,9 +738,9 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, default: break; } - rWrapper.FcPatternAddInteger( pPattern, FC_SPACING, nSpacing ); + FcPatternAddInteger(pPattern, FC_SPACING, nSpacing); if (nSpacing == FC_MONO) - rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)"monospace"); + FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)"monospace"); } } @@ -1123,18 +751,16 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, { rtl::OUString aName; FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( ! rWrapper.isValid() ) - return aName; // build pattern argument for fontconfig query - FcPattern* pPattern = rWrapper.FcPatternCreate(); + FcPattern* pPattern = FcPatternCreate(); // Prefer scalable fonts - rWrapper.FcPatternAddBool( pPattern, FC_SCALABLE, FcTrue ); + FcPatternAddBool(pPattern, FC_SCALABLE, FcTrue); const rtl::OString aTargetName = rtl::OUStringToOString( rFontName, RTL_TEXTENCODING_UTF8 ); const FcChar8* pTargetNameUtf8 = (FcChar8*)aTargetName.getStr(); - rWrapper.FcPatternAddString( pPattern, FC_FAMILY, pTargetNameUtf8 ); + FcPatternAddString(pPattern, FC_FAMILY, pTargetNameUtf8); if( rLangAttrib.getLength() ) { @@ -1143,42 +769,42 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, pLangAttribUtf8 = (FcChar8*)"pa"; else pLangAttribUtf8 = (FcChar8*)rLangAttrib.getStr(); - rWrapper.FcPatternAddString( pPattern, FC_LANG, pLangAttribUtf8 ); + FcPatternAddString(pPattern, FC_LANG, pLangAttribUtf8); } // Add required Unicode characters, if any if ( rMissingCodes.getLength() ) { - FcCharSet *unicodes = rWrapper.FcCharSetCreate(); + FcCharSet *unicodes = FcCharSetCreate(); for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); ) { // also handle unicode surrogates const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex ); - rWrapper.FcCharSetAddChar( unicodes, nCode ); + FcCharSetAddChar( unicodes, nCode ); } - rWrapper.FcPatternAddCharSet( pPattern, FC_CHARSET, unicodes); - rWrapper.FcCharSetDestroy( unicodes ); + FcPatternAddCharSet(pPattern, FC_CHARSET, unicodes); + FcCharSetDestroy(unicodes); } - addtopattern(rWrapper, pPattern, rItalic, rWeight, rWidth, rPitch); + addtopattern(pPattern, rItalic, rWeight, rWidth, rPitch); // query fontconfig for a substitute - rWrapper.FcConfigSubstitute( rWrapper.FcConfigGetCurrent(), pPattern, FcMatchPattern ); - rWrapper.FcDefaultSubstitute( pPattern ); + FcConfigSubstitute(FcConfigGetCurrent(), pPattern, FcMatchPattern); + FcDefaultSubstitute(pPattern); // process the result of the fontconfig query FcResult eResult = FcResultNoMatch; FcFontSet* pFontSet = rWrapper.getFontSet(); - FcPattern* pResult = rWrapper.FcFontSetMatch( rWrapper.FcConfigGetCurrent(), &pFontSet, 1, pPattern, &eResult ); - rWrapper.FcPatternDestroy( pPattern ); + FcPattern* pResult = FcFontSetMatch(FcConfigGetCurrent(), &pFontSet, 1, pPattern, &eResult); + FcPatternDestroy( pPattern ); FcFontSet* pSet = NULL; if( pResult ) { - pSet = rWrapper.FcFontSetCreate(); + pSet = FcFontSetCreate(); // info: destroying the pSet destroys pResult implicitly // since pResult was "added" to pSet - rWrapper.FcFontSetAdd( pSet, pResult ); + FcFontSetAdd( pSet, pResult ); } if( pSet ) @@ -1187,7 +813,7 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, { //extract the closest match FcChar8* family = NULL; - FcResult eFileRes = rWrapper.FcPatternGetString( pSet->fonts[0], FC_FAMILY, 0, &family ); + FcResult eFileRes = FcPatternGetString( pSet->fonts[0], FC_FAMILY, 0, &family ); // get the family name if( eFileRes == FcResultMatch ) @@ -1200,13 +826,13 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, int val = 0; - if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WEIGHT, 0, &val)) + if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_WEIGHT, 0, &val)) rWeight = convertWeight(val); - if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SLANT, 0, &val)) + if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_SLANT, 0, &val)) rItalic = convertSlant(val); - if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SPACING, 0, &val)) + if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_SPACING, 0, &val)) rPitch = convertSpacing(val); - if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WIDTH, 0, &val)) + if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_WIDTH, 0, &val)) rWidth = convertWidth(val); } @@ -1216,13 +842,13 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, sal_uInt32* pRemainingCodes = (sal_uInt32*)alloca( rMissingCodes.getLength() * sizeof(sal_uInt32) ); int nRemainingLen = 0; FcCharSet* unicodes; - if( !rWrapper.FcPatternGetCharSet( pSet->fonts[0], FC_CHARSET, 0, &unicodes ) ) + if (!FcPatternGetCharSet(pSet->fonts[0], FC_CHARSET, 0, &unicodes)) { for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); ) { // also handle unicode surrogates const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex ); - if( rWrapper.FcCharSetHasChar( unicodes, nCode ) != FcTrue ) + if (FcCharSetHasChar(unicodes, nCode) != FcTrue) pRemainingCodes[ nRemainingLen++ ] = nCode; } } @@ -1230,7 +856,7 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, } } - rWrapper.FcFontSetDestroy( pSet ); + FcFontSetDestroy( pSet ); } return aName; @@ -1242,18 +868,15 @@ public: FontConfigFontOptions() : mpPattern(0) {} ~FontConfigFontOptions() { - FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( rWrapper.isValid() ) - rWrapper.FcPatternDestroy( mpPattern ); + 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); - } + FcValue value; + value.type = FcTypeFTFace; + value.u.f = face; + FcPatternAdd (mpPattern, FC_FT_FACE, value, FcTrue); + FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse); return mpPattern; } FcPattern* mpPattern; @@ -1262,17 +885,11 @@ public: ImplFontOptions* PrintFontManager::getFontOptions( const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*)) const { -#ifndef ENABLE_FONTCONFIG - (void)rInfo;(void)nSize;(void)subcallback;(void)rOptions; - return NULL; -#else // ENABLE_FONTCONFIG FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( ! rWrapper.isValid() ) - return NULL; FontConfigFontOptions* pOptions = NULL; - FcConfig* pConfig = rWrapper.FcConfigGetCurrent(); - FcPattern* pPattern = rWrapper.FcPatternCreate(); + FcConfig* pConfig = FcConfigGetCurrent(); + FcPattern* pPattern = FcPatternCreate(); OString sFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 ); @@ -1280,32 +897,33 @@ ImplFontOptions* PrintFontManager::getFontOptions( if (aI != rWrapper.m_aLocalizedToCanonical.end()) sFamily = aI->second; if( sFamily.getLength() ) - rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)sFamily.getStr() ); + FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)sFamily.getStr()); - addtopattern(rWrapper, pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch); - rWrapper.FcPatternAddDouble( pPattern, FC_PIXEL_SIZE, nSize); + addtopattern(pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch); + FcPatternAddDouble(pPattern, FC_PIXEL_SIZE, nSize); FcBool embitmap = true, antialias = true, autohint = true, hinting = true; int hintstyle = FC_HINT_FULL; - rWrapper.FcConfigSubstitute( pConfig, pPattern, FcMatchPattern ); - if (subcallback) subcallback(pPattern); - rWrapper.FcDefaultSubstitute( pPattern ); + FcConfigSubstitute(pConfig, pPattern, FcMatchPattern); + if (subcallback) + subcallback(pPattern); + FcDefaultSubstitute(pPattern); FcResult eResult = FcResultNoMatch; FcFontSet* pFontSet = rWrapper.getFontSet(); - FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult ); + FcPattern* pResult = FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult ); if( pResult ) { - FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool(pResult, + FcResult eEmbeddedBitmap = FcPatternGetBool(pResult, FC_EMBEDDED_BITMAP, 0, &embitmap); - FcResult eAntialias = rWrapper.FcPatternGetBool(pResult, + FcResult eAntialias = FcPatternGetBool(pResult, FC_ANTIALIAS, 0, &antialias); - FcResult eAutoHint = rWrapper.FcPatternGetBool(pResult, + FcResult eAutoHint = FcPatternGetBool(pResult, FC_AUTOHINT, 0, &autohint); - FcResult eHinting = rWrapper.FcPatternGetBool(pResult, + FcResult eHinting = FcPatternGetBool(pResult, FC_HINTING, 0, &hinting); - /*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger(pResult, + /*FcResult eHintStyle =*/ FcPatternGetInteger(pResult, FC_HINT_STYLE, 0, &hintstyle); pOptions = new FontConfigFontOptions; @@ -1331,20 +949,17 @@ ImplFontOptions* PrintFontManager::getFontOptions( } // cleanup - rWrapper.FcPatternDestroy( pPattern ); + FcPatternDestroy( pPattern ); return pOptions; -#endif } bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale ) { FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( ! rWrapper.isValid() ) - return false; - FcConfig* pConfig = rWrapper.FcConfigGetCurrent(); - FcPattern* pPattern = rWrapper.FcPatternCreate(); + FcConfig* pConfig = FcConfigGetCurrent(); + FcPattern* pPattern = FcPatternCreate(); OString aLangAttrib; // populate pattern with font characteristics @@ -1360,29 +975,29 @@ bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star aLangAttrib = OUStringToOString( aLang.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); } if( aLangAttrib.getLength() ) - rWrapper.FcPatternAddString( pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr() ); + FcPatternAddString(pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr()); OString aFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 ); if( aFamily.getLength() ) - rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr() ); + FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr()); - addtopattern(rWrapper, pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch); + addtopattern(pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch); - rWrapper.FcConfigSubstitute( pConfig, pPattern, FcMatchPattern ); - rWrapper.FcDefaultSubstitute( pPattern ); + FcConfigSubstitute(pConfig, pPattern, FcMatchPattern); + FcDefaultSubstitute(pPattern); FcResult eResult = FcResultNoMatch; FcFontSet *pFontSet = rWrapper.getFontSet(); - FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult ); + FcPattern* pResult = FcFontSetMatch(pConfig, &pFontSet, 1, pPattern, &eResult); bool bSuccess = false; if( pResult ) { - FcFontSet* pSet = rWrapper.FcFontSetCreate(); - rWrapper.FcFontSetAdd( pSet, pResult ); + FcFontSet* pSet = FcFontSetCreate(); + FcFontSetAdd( pSet, pResult ); if( pSet->nfont > 0 ) { //extract the closest match FcChar8* file = NULL; - FcResult eFileRes = rWrapper.FcPatternGetString( pSet->fonts[0], FC_FILE, 0, &file ); + FcResult eFileRes = FcPatternGetString(pSet->fonts[0], FC_FILE, 0, &file); if( eFileRes == FcResultMatch ) { OString aDir, aBase, aOrgPath( (sal_Char*)file ); @@ -1395,52 +1010,13 @@ bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star } // info: destroying the pSet destroys pResult implicitly // since pResult was "added" to pSet - rWrapper.FcFontSetDestroy( pSet ); + FcFontSetDestroy( pSet ); } // cleanup - rWrapper.FcPatternDestroy( pPattern ); + FcPatternDestroy( pPattern ); return bSuccess; } -#else // ENABLE_FONTCONFIG not defined - -bool PrintFontManager::initFontconfig() -{ - return false; -} - -int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, int, rtl::OStringHash>& ) -{ - return 0; -} - -void PrintFontManager::deinitFontconfig() -{} - -bool PrintFontManager::addFontconfigDir( const rtl::OString& ) -{ - return false; -} - -bool PrintFontManager::matchFont( FastPrintFontInfo&, const com::sun::star::lang::Locale& ) -{ - return false; -} - -int PrintFontManager::FreeTypeCharIndex( void*, sal_uInt32 ) -{ - return 0; -} - -rtl::OUString PrintFontManager::Substitute( const rtl::OUString&, - rtl::OUString&, const rtl::OString&, FontItalic, FontWeight, FontWidth, FontPitch) const -{ - rtl::OUString aName; - return aName; -} - -#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 1427daedb193..8936df327aeb 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -1281,9 +1281,12 @@ int PrintFontManager::addFontFile( const ::rtl::OString& rFileName, int /*nFaceN return nFontId; } -// ------------------------------------------------------------------------- +enum fontFormat +{ + UNKNOWN, TRUETYPE, CFF, TYPE1, AFM +}; -bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const ::std::list<OString>& rXLFDs, ::std::list< PrintFontManager::PrintFont* >& rNewFonts ) const +bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const ::std::list<OString>& rXLFDs, ::std::list< PrintFontManager::PrintFont* >& rNewFonts, const char *pFormat ) const { rNewFonts.clear(); @@ -1297,8 +1300,32 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co if( access( aFullPath.getStr(), R_OK ) ) return false; - ByteString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); - if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) ) + fontFormat eFormat = UNKNOWN; + if (pFormat) + { + if (!strcmp(pFormat, "TrueType")) + eFormat = TRUETYPE; + else if (!strcmp(pFormat, "CFF")) + eFormat = CFF; + else if (!strcmp(pFormat, "Type 1")) + eFormat = TYPE1; + } + if (eFormat == UNKNOWN) + { + ByteString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); + if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) ) + eFormat = TYPE1; + else if( aExt.EqualsIgnoreCaseAscii( "afm" ) ) + eFormat = AFM; + else if( aExt.EqualsIgnoreCaseAscii( "ttf" ) + || aExt.EqualsIgnoreCaseAscii( "ttc" ) + || aExt.EqualsIgnoreCaseAscii( "tte" ) ) // #i33947# for Gaiji support + eFormat = TRUETYPE; + else if( aExt.EqualsIgnoreCaseAscii( "otf" ) ) // check for TTF- and PS-OpenType too + eFormat = CFF; + } + + if (eFormat == TYPE1) { // check for corresponding afm metric // first look for an adjacent file @@ -1352,7 +1379,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co } } } - else if( aExt.EqualsIgnoreCaseAscii( "afm" ) ) + else if (eFormat == AFM) { ByteString aFilePath( aDir ); aFilePath.Append( '/' ); @@ -1365,34 +1392,14 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co else delete pFont; } - else if( aExt.EqualsIgnoreCaseAscii( "ttf" ) - || aExt.EqualsIgnoreCaseAscii( "tte" ) // #i33947# for Gaiji support - || aExt.EqualsIgnoreCaseAscii( "otf" ) ) // check for TTF- and PS-OpenType too - { - TrueTypeFontFile* pFont = new TrueTypeFontFile(); - pFont->m_nDirectory = nDirID; - pFont->m_aFontFile = rFontFile; - pFont->m_nCollectionEntry = -1; - - if( rXLFDs.size() ) - getFontAttributesFromXLFD( pFont, rXLFDs ); - // need to read the font anyway to get aliases inside the font file - if( ! analyzeTrueTypeFile( pFont ) ) - { - delete pFont; - pFont = NULL; - } - else - rNewFonts.push_back( pFont ); - } - else if( aExt.EqualsIgnoreCaseAscii( "ttc" ) ) + else if (eFormat == TRUETYPE || eFormat == CFF) { // get number of ttc entries int nLength = CountTTCFonts( aFullPath.getStr() ); if( nLength ) { #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "%s contains %d fonts\n", aFullPath.getStr(), nLength ); + fprintf( stderr, "ttc: %s contains %d fonts\n", aFullPath.getStr(), nLength ); #endif for( int i = 0; i < nLength; i++ ) { @@ -1411,10 +1418,24 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co rNewFonts.push_back( pFont ); } } -#if OSL_DEBUG_LEVEL > 1 else - fprintf( stderr, "CountTTCFonts( \"%s/%s\" ) failed\n", getDirectory(nDirID).getStr(), rFontFile.getStr() ); -#endif + { + TrueTypeFontFile* pFont = new TrueTypeFontFile(); + pFont->m_nDirectory = nDirID; + pFont->m_aFontFile = rFontFile; + pFont->m_nCollectionEntry = -1; + + if( rXLFDs.size() ) + getFontAttributesFromXLFD( pFont, rXLFDs ); + // need to read the font anyway to get aliases inside the font file + if( ! analyzeTrueTypeFile( pFont ) ) + { + delete pFont; + pFont = NULL; + } + else + rNewFonts.push_back( pFont ); + } } return ! rNewFonts.empty(); } diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx index 3349e6ef3c01..22a5d1eddb26 100644 --- a/vcl/unx/generic/gdi/salbmp.cxx +++ b/vcl/unx/generic/gdi/salbmp.cxx @@ -32,6 +32,7 @@ #include <string.h> #include <stdio.h> #include <errno.h> + #ifdef FREEBSD #include <sys/types.h> #endif @@ -69,14 +70,14 @@ SalBitmap* X11SalInstance::CreateSalBitmap() } ImplSalBitmapCache* X11SalBitmap::mpCache = NULL; -sal_uLong X11SalBitmap::mnCacheInstCount = 0; +sal_uLong X11SalBitmap::mnCacheInstCount = 0; // ----------------------------------------------------------------------------- -X11SalBitmap::X11SalBitmap() : - mpDIB( NULL ), - mpDDB( NULL ), - mbGrey( false ) +X11SalBitmap::X11SalBitmap() + : mpDIB( NULL ) + , mpDDB( NULL ) + , mbGrey( false ) { } @@ -115,9 +116,19 @@ void X11SalBitmap::ImplRemovedFromCache() // ----------------------------------------------------------------------------- -BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) -{ - DBG_ASSERT( nBitCount == 1 || nBitCount == 4 || nBitCount == 8 || nBitCount == 16 || nBitCount == 24, "Unsupported BitCount!" ); +BitmapBuffer* X11SalBitmap::ImplCreateDIB( + const Size& rSize, + sal_uInt16 nBitCount, + const BitmapPalette& rPal +) { + DBG_ASSERT( + nBitCount == 1 + || nBitCount == 4 + || nBitCount == 8 + || nBitCount == 16 + || nBitCount == 24 + , "Unsupported BitCount!" + ); BitmapBuffer* pDIB = NULL; @@ -192,13 +203,16 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCou // ----------------------------------------------------------------------------- -BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - long nX, long nY, - long nWidth, long nHeight, - bool bGrey ) -{ +BitmapBuffer* X11SalBitmap::ImplCreateDIB( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight, + bool bGrey +) { BitmapBuffer* pDIB = NULL; if( aDrawable && nWidth && nHeight && nDrawableDepth ) @@ -221,7 +235,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, { const SalTwoRect aTwoRect = { 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight }; BitmapBuffer aSrcBuf; - sal_uLong nDstFormat = BMP_FORMAT_BOTTOM_UP; + sal_uLong nDstFormat = BMP_FORMAT_BOTTOM_UP; const BitmapPalette* pDstPal = NULL; aSrcBuf.mnFormat = BMP_FORMAT_TOP_DOWN; @@ -239,14 +253,20 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, { case( 1 ): { - aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_1BIT_LSB_PAL : BMP_FORMAT_1BIT_MSB_PAL ); + aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order + ? BMP_FORMAT_1BIT_LSB_PAL + : BMP_FORMAT_1BIT_MSB_PAL + ); nDstFormat |= BMP_FORMAT_1BIT_MSB_PAL; } break; case( 4 ): { - aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_4BIT_LSN_PAL : BMP_FORMAT_4BIT_MSN_PAL ); + aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order + ? BMP_FORMAT_4BIT_LSN_PAL + : BMP_FORMAT_4BIT_MSN_PAL + ); nDstFormat |= BMP_FORMAT_4BIT_MSN_PAL; } break; @@ -270,7 +290,6 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, else { aSrcBuf.mnFormat |= BMP_FORMAT_16BIT_TC_MSB_MASK; - // aSrcBuf.maColorMask = ColorMask( pImage->red_mask ), SWAPSHORT( pImage->green_mask ), SWAPSHORT( pImage->blue_mask ) ); } } break; @@ -289,10 +308,15 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, case( 32 ): { if( LSBFirst == pImage->byte_order ) - aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_RGBA : BMP_FORMAT_32BIT_TC_BGRA ); + aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF + ? BMP_FORMAT_32BIT_TC_RGBA + : BMP_FORMAT_32BIT_TC_BGRA + ); else - aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_ABGR : BMP_FORMAT_32BIT_TC_ARGB ); - + aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF + ? BMP_FORMAT_32BIT_TC_ABGR + : BMP_FORMAT_32BIT_TC_ARGB + ); nDstFormat |= BMP_FORMAT_24BIT_TC_BGR; } break; @@ -326,7 +350,9 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, else if( aSrcBuf.mnBitCount <= 8 ) { const SalColormap& rColMap = pSalDisp->GetColormap( nScreen ); - const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed(), (sal_uLong)(1 << nDrawableDepth) ); + const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed() + , (sal_uLong)(1 << nDrawableDepth) + ); rPal.SetEntryCount( nCols ); pDstPal = &rPal; @@ -354,7 +380,12 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, // ----------------------------------------------------------------------------- -XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const +XImage* X11SalBitmap::ImplCreateXImage( + SalDisplay *pSalDisp, + int nScreen, + long nDepth, + const SalTwoRect& rTwoRect +) const { XImage* pImage = NULL; @@ -393,11 +424,17 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long switch( pImage->bits_per_pixel ) { case( 1 ): - nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_1BIT_LSB_PAL : BMP_FORMAT_1BIT_MSB_PAL ); + nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order + ? BMP_FORMAT_1BIT_LSB_PAL + : BMP_FORMAT_1BIT_MSB_PAL + ); break; case( 4 ): - nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_4BIT_LSN_PAL : BMP_FORMAT_4BIT_MSN_PAL ); + nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order + ? BMP_FORMAT_4BIT_LSN_PAL + : BMP_FORMAT_4BIT_MSN_PAL + ); break; case( 8 ): @@ -437,9 +474,15 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long case( 32 ): { if( LSBFirst == pImage->byte_order ) - nDstFormat |= ( pImage->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_RGBA : BMP_FORMAT_32BIT_TC_BGRA ); + nDstFormat |= ( pImage->red_mask == 0xFF + ? BMP_FORMAT_32BIT_TC_RGBA + : BMP_FORMAT_32BIT_TC_BGRA + ); else - nDstFormat |= ( pImage->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_ABGR : BMP_FORMAT_32BIT_TC_ARGB ); + nDstFormat |= ( pImage->red_mask == 0xFF + ? BMP_FORMAT_32BIT_TC_ABGR + : BMP_FORMAT_32BIT_TC_ARGB + ); } break; } @@ -467,7 +510,9 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long else if( pImage->depth <= 8 ) { const SalColormap& rColMap = pSalDisp->GetColormap( nScreen ); - const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed(), (sal_uLong)(1 << pImage->depth) ); + const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed() + , (sal_uLong)(1 << pImage->depth) + ); pPal = new BitmapPalette( nCols ); @@ -506,10 +551,15 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long } // ----------------------------------------------------------------------------- -bool X11SalBitmap::ImplCreateFromDrawable( Drawable aDrawable, - int nScreen, long nDrawableDepth, - long nX, long nY, long nWidth, long nHeight ) -{ +bool X11SalBitmap::ImplCreateFromDrawable( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight +) { Destroy(); if( aDrawable && nWidth && nHeight && nDrawableDepth ) @@ -519,8 +569,7 @@ bool X11SalBitmap::ImplCreateFromDrawable( Drawable aDrawable, } // ----------------------------------------------------------------------------- -bool -X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow) +bool X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow) { if (hWindow != None) { @@ -598,9 +647,12 @@ X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow) return False; } -bool -X11SalBitmap::ImplCreateFromXImage (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage) -{ +bool X11SalBitmap::ImplCreateFromXImage ( + Display* pDisplay, + XLIB_Window hWindow, + int nScreen, + XImage* pImage +) { Destroy(); if (pImage != NULL && pImage->width != 0 && pImage->height != 0 && pImage->depth != 0) @@ -611,10 +663,12 @@ X11SalBitmap::ImplCreateFromXImage (Display* pDisplay, XLIB_Window hWindow, int return False; } -ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - const SalTwoRect& rTwoRect ) const +ImplSalDDB* X11SalBitmap::ImplGetDDB( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + const SalTwoRect& rTwoRect +) const { if( !mpDDB || !mpDDB->ImplMatches( nScreen, nDrawableDepth, rTwoRect ) ) { @@ -708,11 +762,13 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable aDrawable, // ----------------------------------------------------------------------------- -void X11SalBitmap::ImplDraw( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - const SalTwoRect& rTwoRect, - const GC& rGC ) const +void X11SalBitmap::ImplDraw( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + const SalTwoRect& rTwoRect, + const GC& rGC +) const { ImplGetDDB( aDrawable, nScreen, nDrawableDepth, rTwoRect ); if( mpDDB ) @@ -770,21 +826,26 @@ bool X11SalBitmap::Create( const SalBitmap& rSSalBmp ) bool X11SalBitmap::Create( const SalBitmap&, SalGraphics* ) { - return sal_False; + return false; } // ----------------------------------------------------------------------------- bool X11SalBitmap::Create( const SalBitmap&, sal_uInt16 ) { - return sal_False; + return false; } // ----------------------------------------------------------------------------- -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 ); +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; @@ -794,7 +855,15 @@ bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::s if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) { mbGrey = bMask; - bool bSuccess = ImplCreateFromDrawable( pixmapHandle, 0, depth, 0, 0, (long) rSize.Width(), (long) rSize.Height() ); + 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 ); @@ -860,10 +929,15 @@ BitmapBuffer* X11SalBitmap::AcquireBuffer( bool ) { if( !mpDIB && mpDDB ) { - mpDIB = ImplCreateDIB( mpDDB->ImplGetPixmap(), - mpDDB->ImplGetScreen(), - mpDDB->ImplGetDepth(), - 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight(), mbGrey ); + mpDIB = ImplCreateDIB( + mpDDB->ImplGetPixmap(), + mpDDB->ImplGetScreen(), + mpDDB->ImplGetDepth(), + 0, 0, + mpDDB->ImplGetWidth(), + mpDDB->ImplGetHeight(), + mbGrey + ); } return mpDIB; @@ -905,11 +979,11 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData ) // - ImplSalDDB - // -------------- -ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const SalTwoRect& rTwoRect ) : - maPixmap ( 0 ), - maTwoRect ( rTwoRect ), - mnDepth ( pImage->depth ), - mnScreen ( nScreen ) +ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const SalTwoRect& rTwoRect ) + : maPixmap ( 0 ) + , maTwoRect ( rTwoRect ) + , mnDepth ( pImage->depth ) + , mnScreen ( nScreen ) { SalDisplay* pSalDisp = GetX11SalData()->GetDisplay(); Display* pXDisp = pSalDisp->GetDisplay(); @@ -937,8 +1011,8 @@ ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const S // ----------------------------------------------------------------------------------------- // create from XImage -ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage) : - mnScreen( nScreen ) +ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage) + : mnScreen( nScreen ) { maPixmap = XCreatePixmap (pDisplay, hWindow, pImage->width, pImage->height, pImage->depth); if (maPixmap != 0) @@ -975,9 +1049,16 @@ ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XIm // ----------------------------------------------------------------------------- -ImplSalDDB::ImplSalDDB( Drawable aDrawable, int nScreen, long nDrawableDepth, long nX, long nY, long nWidth, long nHeight ) : - mnDepth( nDrawableDepth ), - mnScreen( nScreen ) +ImplSalDDB::ImplSalDDB( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight +) : mnDepth( nDrawableDepth ) + , mnScreen( nScreen ) { SalDisplay* pSalDisp = GetX11SalData()->GetDisplay(); Display* pXDisp = pSalDisp->GetDisplay(); @@ -1019,24 +1100,32 @@ ImplSalDDB::~ImplSalDDB() bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const { - bool bRet = sal_False; + bool bRet = false; if( ( maPixmap != 0 ) && ( ( mnDepth == nDepth ) || ( 1 == mnDepth ) ) && nScreen == mnScreen) { - if( rTwoRect.mnSrcX == maTwoRect.mnSrcX && rTwoRect.mnSrcY == maTwoRect.mnSrcY && - rTwoRect.mnSrcWidth == maTwoRect.mnSrcWidth && rTwoRect.mnSrcHeight == maTwoRect.mnSrcHeight && - rTwoRect.mnDestWidth == maTwoRect.mnDestWidth && rTwoRect.mnDestHeight == maTwoRect.mnDestHeight ) + if ( rTwoRect.mnSrcX == maTwoRect.mnSrcX + && rTwoRect.mnSrcY == maTwoRect.mnSrcY + && rTwoRect.mnSrcWidth == maTwoRect.mnSrcWidth + && rTwoRect.mnSrcHeight == maTwoRect.mnSrcHeight + && rTwoRect.mnDestWidth == maTwoRect.mnDestWidth + && rTwoRect.mnDestHeight == maTwoRect.mnDestHeight + ) { // absolutely indentically - bRet = sal_True; + bRet = true; } - else if( rTwoRect.mnSrcWidth == rTwoRect.mnDestWidth && rTwoRect.mnSrcHeight == rTwoRect.mnDestHeight && - maTwoRect.mnSrcWidth == maTwoRect.mnDestWidth && maTwoRect.mnSrcHeight == maTwoRect.mnDestHeight && - rTwoRect.mnSrcX >= maTwoRect.mnSrcX && rTwoRect.mnSrcY >= maTwoRect.mnSrcY && - ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) <= ( maTwoRect.mnSrcX + maTwoRect.mnSrcWidth ) && - ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) <= ( maTwoRect.mnSrcY + maTwoRect.mnSrcHeight ) ) + else if( rTwoRect.mnSrcWidth == rTwoRect.mnDestWidth + && rTwoRect.mnSrcHeight == rTwoRect.mnDestHeight + && maTwoRect.mnSrcWidth == maTwoRect.mnDestWidth + && maTwoRect.mnSrcHeight == maTwoRect.mnDestHeight + && rTwoRect.mnSrcX >= maTwoRect.mnSrcX + && rTwoRect.mnSrcY >= maTwoRect.mnSrcY + && ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) <= ( maTwoRect.mnSrcX + maTwoRect.mnSrcWidth ) + && ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) <= ( maTwoRect.mnSrcY + maTwoRect.mnSrcHeight ) + ) { - bRet = sal_True; + bRet = true; } } @@ -1045,7 +1134,12 @@ bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRe // ----------------------------------------------------------------------------- -void ImplSalDDB::ImplDraw( Drawable aDrawable, long nDrawableDepth, const SalTwoRect& rTwoRect, const GC& rGC ) const +void ImplSalDDB::ImplDraw( + Drawable aDrawable, + long nDrawableDepth, + const SalTwoRect& rTwoRect, + const GC& rGC +) const { ImplDraw( maPixmap, mnDepth, aDrawable, nDrawableDepth, rTwoRect.mnSrcX - maTwoRect.mnSrcX, rTwoRect.mnSrcY - maTwoRect.mnSrcY, @@ -1055,12 +1149,19 @@ void ImplSalDDB::ImplDraw( Drawable aDrawable, long nDrawableDepth, const SalTwo // ----------------------------------------------------------------------------- -void ImplSalDDB::ImplDraw( Drawable aSrcDrawable, long nSrcDrawableDepth, - Drawable aDstDrawable, long, - long nSrcX, long nSrcY, - long nDestWidth, long nDestHeight, - long nDestX, long nDestY, const GC& rGC ) -{ +void ImplSalDDB::ImplDraw( + Drawable aSrcDrawable, + long nSrcDrawableDepth, + Drawable aDstDrawable, + long, + long nSrcX, + long nSrcY, + long nDestWidth, + long nDestHeight, + long nDestX, + long nDestY, + const GC& rGC +) { SalDisplay* pSalDisp = GetX11SalData()->GetDisplay(); Display* pXDisp = pSalDisp->GetDisplay(); @@ -1108,12 +1209,18 @@ ImplSalBitmapCache::~ImplSalBitmapCache() void ImplSalBitmapCache::ImplAdd( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uLong nFlags ) { - ImplBmpObj* pObj; - bool bFound = sal_False; - - for( pObj = (ImplBmpObj*) maBmpList.Last(); pObj && !bFound; pObj = (ImplBmpObj*) maBmpList.Prev() ) + ImplBmpObj* pObj = NULL; + bool bFound = false; + + for( + BmpList_impl::iterator it = maBmpList.begin(); + (it != maBmpList.end() ) && !bFound ; + ++it + ) { + pObj = *it; if( pObj->mpBmp == pBmp ) - bFound = sal_True; + bFound = true; + } mnTotalSize += nMemSize; @@ -1123,21 +1230,24 @@ void ImplSalBitmapCache::ImplAdd( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uL pObj->mnMemSize = nMemSize, pObj->mnFlags = nFlags; } else - maBmpList.Insert( new ImplBmpObj( pBmp, nMemSize, nFlags ), LIST_APPEND ); + maBmpList.push_back( new ImplBmpObj( pBmp, nMemSize, nFlags ) ); } // ----------------------------------------------------------------------------- void ImplSalBitmapCache::ImplRemove( X11SalBitmap* pBmp ) { - for( ImplBmpObj* pObj = (ImplBmpObj*) maBmpList.Last(); pObj; pObj = (ImplBmpObj*) maBmpList.Prev() ) - { - if( pObj->mpBmp == pBmp ) + for( + BmpList_impl::iterator it = maBmpList.begin(); + it != maBmpList.end(); + ++it + ) { + if( (*it)->mpBmp == pBmp ) { - maBmpList.Remove( pObj ); - pObj->mpBmp->ImplRemovedFromCache(); - mnTotalSize -= pObj->mnMemSize; - delete pObj; + (*it)->mpBmp->ImplRemovedFromCache(); + mnTotalSize -= (*it)->mnMemSize; + delete *it; + maBmpList.erase( it ); break; } } @@ -1147,13 +1257,15 @@ void ImplSalBitmapCache::ImplRemove( X11SalBitmap* pBmp ) void ImplSalBitmapCache::ImplClear() { - for( ImplBmpObj* pObj = (ImplBmpObj*) maBmpList.First(); pObj; pObj = (ImplBmpObj*) maBmpList.Next() ) - { - pObj->mpBmp->ImplRemovedFromCache(); - delete pObj; + for( + BmpList_impl::iterator it = maBmpList.begin(); + it != maBmpList.end(); + ++it + ) { + (*it)->mpBmp->ImplRemovedFromCache(); + delete *it; } - - maBmpList.Clear(); + maBmpList.clear(); mnTotalSize = 0; } diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx index dce2e5ccb793..4934ed7f83fa 100644 --- a/vcl/unx/generic/gdi/salgdi3.cxx +++ b/vcl/unx/generic/gdi/salgdi3.cxx @@ -78,28 +78,21 @@ #include "salframe.hxx" #include "outdev.h" - - #ifdef ENABLE_GRAPHITE #include <graphite_layout.hxx> #include <graphite_serverfont.hxx> #endif -struct cairo_surface_t; -struct cairo_t; -struct cairo_font_face_t; -typedef void* FT_Face; -struct cairo_matrix_t { - double xx; double yx; - double xy; double yy; - double x0; double y0; -}; -struct cairo_glyph_t -{ - unsigned long index; - double x; - double y; -}; +#ifdef SYSTEM_CAIRO +#include <cairo.h> +#include <cairo-ft.h> +#include <cairo-xlib-xrender.h> +#else +#include <cairo/cairo.h> +#include <cairo/cairo-ft.h> +#include <cairo/cairo-xlib-xrender.h> +#endif + struct BOX { short x1, x2, y1, y2; @@ -249,179 +242,12 @@ void ImplServerFontEntry::HandleFontOptions( void ) //-------------------------------------------------------------------------- -namespace { - -class CairoWrapper -{ -private: - 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 *); - cairo_t* (*mp_create)(cairo_surface_t *); - void (*mp_destroy)(cairo_t*); - 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 *); - void (*mp_matrix_scale)(cairo_matrix_t *, double, double); - void (*mp_matrix_rotate)(cairo_matrix_t *, double); - void (*mp_set_font_matrix)(cairo_t *, const cairo_matrix_t *); - void (*mp_show_glyphs)(cairo_t *, const cairo_glyph_t *, int ); - void (*mp_set_source_rgb)(cairo_t *, double , double , double ); - void (*mp_set_font_options)(cairo_t *, const void *); - void (*mp_ft_font_options_substitute)(const void*, void*); - - bool canEmbolden() const { return mp_ft_font_face_create_for_pattern != NULL; } - - CairoWrapper(); -public: - static CairoWrapper& get(); - bool isValid() const { return (mpCairoLib != NULL); } - bool isCairoRenderable(const ServerFont& rFont); - - cairo_surface_t* xlib_surface_create_with_xrender_format(Display *pDisplay, Drawable drawable, Screen *pScreen, XRenderPictFormat *pFormat, int width, int height) - { return (*mp_xlib_surface_create_with_xrender_format)(pDisplay, drawable, pScreen, pFormat, width, height); } - void surface_destroy(cairo_surface_t *surface) { (*mp_surface_destroy)(surface); } - cairo_t* create(cairo_surface_t *surface) { return (*mp_create)(surface); } - void destroy(cairo_t *cr) { (*mp_destroy)(cr); } - void clip(cairo_t *cr) { (*mp_clip)(cr); } - void rectangle(cairo_t *cr, double x, double y, double width, double height) - { (*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) - { (*mp_font_face_destroy)(font_face); } - void matrix_init_identity(cairo_matrix_t *matrix) - { (*mp_matrix_init_identity)(matrix); } - void matrix_scale(cairo_matrix_t *matrix, double sx, double sy) - { (*mp_matrix_scale)(matrix, sx, sy); } - void matrix_rotate(cairo_matrix_t *matrix, double radians) - { (*mp_matrix_rotate)(matrix, radians); } - void set_font_matrix(cairo_t *cr, const cairo_matrix_t *matrix) - { (*mp_set_font_matrix)(cr, matrix); } - void show_glyphs(cairo_t *cr, const cairo_glyph_t *glyphs, int no_glyphs) - { (*mp_show_glyphs)(cr, glyphs, no_glyphs); } - void set_source_rgb(cairo_t *cr, double red, double green, double blue) - { (*mp_set_source_rgb)(cr, red, green, blue); } - void set_font_options(cairo_t *cr, const void *options) - { (*mp_set_font_options)(cr, options); } - void ft_font_options_substitute(const void *options, void *pattern) - { (*mp_ft_font_options_substitute)(options, pattern); } -}; - -static CairoWrapper* pCairoInstance = NULL; - -CairoWrapper& CairoWrapper::get() -{ - if( ! pCairoInstance ) - pCairoInstance = new CairoWrapper(); - return *pCairoInstance; -} - -CairoWrapper::CairoWrapper() +namespace { - static const char* pDisableCairoText = getenv( "SAL_DISABLE_CAIROTEXT" ); - if( pDisableCairoText && (pDisableCairoText[0] != '0') ) - return; - - int nDummy; - if( !XQueryExtension( GetX11SalData()->GetDisplay()->GetDisplay(), "RENDER", &nDummy, &nDummy, &nDummy ) ) - return; - - OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libcairo.so.2" )); - if ( !mpCairoLib.load( aLibName, SAL_LOADMODULE_DEFAULT ) ) - return; - -#ifdef DEBUG - // check cairo version - int (*p_version)(); - p_version = (int(*)()) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_version" ); - const int nVersion = p_version ? (*p_version)() : 0; - fprintf( stderr, "CAIRO version=%d\n", nVersion ); -#endif - - mp_xlib_surface_create_with_xrender_format = (cairo_surface_t* (*)(Display *, Drawable , Screen *, XRenderPictFormat *, int , int )) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_xlib_surface_create_with_xrender_format" ); - mp_surface_destroy = (void(*)(cairo_surface_t*)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_surface_destroy" ); - mp_create = (cairo_t*(*)(cairo_surface_t*)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_create" ); - mp_destroy = (void(*)(cairo_t*)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_destroy" ); - mp_clip = (void(*)(cairo_t*)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_clip" ); - mp_rectangle = (void(*)(cairo_t*, double, double, double, double)) - 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 *)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_font_face_destroy" ); - mp_matrix_init_identity = (void (*)(cairo_matrix_t *)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_init_identity" ); - mp_matrix_scale = (void (*)(cairo_matrix_t *, double, double)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_scale" ); - mp_matrix_rotate = (void (*)(cairo_matrix_t *, double)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_rotate" ); - mp_set_font_matrix = (void (*)(cairo_t *, const cairo_matrix_t *)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_matrix" ); - mp_show_glyphs = (void (*)(cairo_t *, const cairo_glyph_t *, int )) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_show_glyphs" ); - mp_set_source_rgb = (void (*)(cairo_t *, double , double , double )) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_source_rgb" ); - mp_set_font_options = (void (*)(cairo_t *, const void *options )) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_options" ); - mp_ft_font_options_substitute = (void (*)(const void *, void *)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_options_substitute" ); - - if( !( - mp_xlib_surface_create_with_xrender_format && - mp_surface_destroy && - mp_create && - mp_destroy && - mp_clip && - mp_rectangle && - mp_ft_font_face_create_for_ft_face && - mp_set_font_face && - mp_font_face_destroy && - mp_matrix_init_identity && - mp_matrix_scale && - mp_matrix_rotate && - mp_set_font_matrix && - mp_show_glyphs && - mp_set_source_rgb && - mp_set_font_options && - mp_ft_font_options_substitute - ) ) + bool isCairoRenderable(const ServerFont& rFont) { - mpCairoLib.unload(); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "not all needed symbols were found\n" ); -#endif + return rFont.GetFtFace(); } -} - -bool CairoWrapper::isCairoRenderable(const ServerFont& rFont) -{ - return rFont.GetFtFace() && isValid() && rFont.GetAntialiasAdvice() && - (rFont.NeedsArtificialBold() ? canEmbolden() : true); -} - } //namespace CairoFontsCache::LRUFonts CairoFontsCache::maLRUFonts; @@ -437,10 +263,9 @@ CairoFontsCache::~CairoFontsCache() --mnRefCount; if (!mnRefCount && !maLRUFonts.empty()) { - CairoWrapper &rCairo = CairoWrapper::get(); LRUFonts::iterator aEnd = maLRUFonts.end(); for (LRUFonts::iterator aI = maLRUFonts.begin(); aI != aEnd; ++aI) - rCairo.font_face_destroy((cairo_font_face_t*)aI->first); + cairo_font_face_destroy((cairo_font_face_t*)aI->first); } } @@ -449,8 +274,7 @@ void CairoFontsCache::CacheFont(void *pFont, const CairoFontsCache::CacheId &rId maLRUFonts.push_front( std::pair<void*, CairoFontsCache::CacheId>(pFont, rId) ); if (maLRUFonts.size() > 8) { - CairoWrapper &rCairo = CairoWrapper::get(); - rCairo.font_face_destroy((cairo_font_face_t*)maLRUFonts.back().first); + cairo_font_face_destroy((cairo_font_face_t*)maLRUFonts.back().first); maLRUFonts.pop_back(); } } @@ -464,9 +288,18 @@ void* CairoFontsCache::FindCachedFont(const CairoFontsCache::CacheId &rId) return NULL; } +namespace +{ + bool hasRotation(int nRotation) + { + return nRotation != 0; + } +} + void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) { std::vector<cairo_glyph_t> cairo_glyphs; + std::vector<int> glyph_extrarotation; cairo_glyphs.reserve( 256 ); Point aPos; @@ -478,6 +311,19 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) aGlyph.x = aPos.X(); aGlyph.y = aPos.Y(); cairo_glyphs.push_back(aGlyph); + + switch (aGlyphId & GF_ROTMASK) + { + case GF_ROTL: // left + glyph_extrarotation.push_back(900); + break; + case GF_ROTR: // right + glyph_extrarotation.push_back(-900); + break; + default: + glyph_extrarotation.push_back(0); + break; + } } if (cairo_glyphs.empty()) @@ -489,11 +335,9 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) if( !pVisualFormat ) return; - CairoWrapper &rCairo = CairoWrapper::get(); - Display* pDisplay = GetXDisplay(); - cairo_surface_t *surface = rCairo.xlib_surface_create_with_xrender_format (pDisplay, + cairo_surface_t *surface = cairo_xlib_surface_create_with_xrender_format (pDisplay, hDrawable_, ScreenOfDisplay(pDisplay, m_nScreen), pVisualFormat, SAL_MAX_INT16, SAL_MAX_INT16); /* @@ -502,26 +346,26 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) * least change the SalFrame etc impls to dtor the SalGraphics *before* the * destruction of the windows they reference */ - cairo_t *cr = rCairo.create(surface); - rCairo.surface_destroy(surface); + cairo_t *cr = cairo_create(surface); + cairo_surface_destroy(surface); if (const void *pOptions = Application::GetSettings().GetStyleSettings().GetCairoFontOptions()) - rCairo.set_font_options( cr, pOptions); + cairo_set_font_options(cr, static_cast<const cairo_font_options_t*>(pOptions)); if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) { for (long i = 0; i < mpClipRegion->numRects; ++i) { - rCairo.rectangle(cr, - mpClipRegion->rects[i].x1, - mpClipRegion->rects[i].y1, - mpClipRegion->rects[i].x2 - mpClipRegion->rects[i].x1, - mpClipRegion->rects[i].y2 - mpClipRegion->rects[i].y1); + cairo_rectangle(cr, + mpClipRegion->rects[i].x1, + mpClipRegion->rects[i].y1, + mpClipRegion->rects[i].x2 - mpClipRegion->rects[i].x1, + mpClipRegion->rects[i].y2 - mpClipRegion->rects[i].y1); } - rCairo.clip(cr); + cairo_clip(cr); } - rCairo.set_source_rgb(cr, + cairo_set_source_rgb(cr, SALCOLOR_RED(nTextColor_)/255.0, SALCOLOR_GREEN(nTextColor_)/255.0, SALCOLOR_BLUE(nTextColor_)/255.0); @@ -541,30 +385,67 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) 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); + font_face = cairo_ft_font_face_create_for_pattern(reinterpret_cast<FcPattern*>(pPattern)); if (!font_face) - font_face = rCairo.ft_font_face_create_for_ft_face(pFace, rFont.GetLoadFlags()); + font_face = cairo_ft_font_face_create_for_ft_face(reinterpret_cast<FT_Face>(pFace), rFont.GetLoadFlags()); m_aCairoFontsCache.CacheFont(font_face, aId); } - rCairo.set_font_face(cr, font_face); + cairo_set_font_face(cr, font_face); cairo_matrix_t m; const ImplFontSelectData& rFSD = rFont.GetFontSelData(); - int nWidth = rFSD.mnWidth ? rFSD.mnWidth : rFSD.mnHeight; + int nHeight = rFSD.mnHeight; + int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight; + + std::vector<int>::const_iterator aEnd = glyph_extrarotation.end(); + std::vector<int>::const_iterator aStart = glyph_extrarotation.begin(); + std::vector<int>::const_iterator aI = aStart; + while (aI != aEnd) + { + int nGlyphRotation = *aI; + + std::vector<int>::const_iterator aNext = std::find_if(aI+1, aEnd, hasRotation); + + cairo_matrix_init_identity(&m); + + if (rFont.NeedsArtificialItalic()) + m.xy = -m.xx * 0x6000L / 0x10000L; + + if (rLayout.GetOrientation()) + cairo_matrix_rotate(&m, (3600 - rLayout.GetOrientation()) * M_PI / 1800.0); - rCairo.matrix_init_identity(&m); + cairo_matrix_scale(&m, nWidth, nHeight); - if (rLayout.GetOrientation()) - rCairo.matrix_rotate(&m, (3600 - rLayout.GetOrientation()) * M_PI / 1800.0); + if (nGlyphRotation) + { + cairo_matrix_rotate(&m, (3600 - nGlyphRotation) * M_PI / 1800.0); + + cairo_font_extents_t extents; + cairo_font_extents(cr, &extents); + //gives the same positions as pre-cairo conversion, but I don't like them + double xdiff = -extents.descent/(extents.height+extents.descent); + cairo_matrix_translate(&m, xdiff, 1); + } - rCairo.matrix_scale(&m, nWidth, rFSD.mnHeight); - if (rFont.NeedsArtificialItalic()) - m.xy = -m.xx * 0x6000L / 0x10000L; + cairo_set_font_matrix(cr, &m); + size_t nStartIndex = std::distance(aStart, aI); + size_t nLen = std::distance(aI, aNext); + cairo_show_glyphs(cr, &cairo_glyphs[nStartIndex], nLen); + +#if OSL_DEBUG_LEVEL > 2 + //draw origin + cairo_save (cr); + cairo_rectangle (cr, cairo_glyphs[nStartIndex].x, cairo_glyphs[nStartIndex].y, 5, 5); + cairo_set_source_rgba (cr, 1, 0, 0, 0.80); + cairo_fill (cr); + cairo_restore (cr); +#endif - rCairo.set_font_matrix(cr, &m); - rCairo.show_glyphs(cr, &cairo_glyphs[0], cairo_glyphs.size()); - rCairo.destroy(cr); + aI = aNext; + } + + cairo_destroy(cr); } //-------------------------------------------------------------------------- @@ -924,7 +805,7 @@ void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout ) ServerFont& rFont = rLayout.GetServerFont(); const bool bVertical = rFont.GetFontSelData().mbVertical; - if( !bVertical && CairoWrapper::get().isCairoRenderable(rFont) ) + if( !bVertical && isCairoRenderable(rFont) ) DrawCairoAAFontString( rLayout ); else { @@ -1083,16 +964,14 @@ void X11SalGraphics::GetDevFontSubstList( OutputDevice* ) // ---------------------------------------------------------------------------- -void cairosubcallback( void* pPattern ) +void cairosubcallback(void* pPattern) { - CairoWrapper& rCairo = CairoWrapper::get(); - if( !rCairo.isValid() ) - return; const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); const void* pFontOptions = rStyleSettings.GetCairoFontOptions(); if( !pFontOptions ) return; - rCairo.ft_font_options_substitute( pFontOptions, pPattern ); + cairo_ft_font_options_substitute(static_cast<const cairo_font_options_t*>(pFontOptions), + static_cast<FcPattern*>(pPattern)); } ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize) diff --git a/vcl/unx/generic/gdi/salprnpsp.cxx b/vcl/unx/generic/gdi/salprnpsp.cxx index 009621a9e22e..dbee65c589dc 100644 --- a/vcl/unx/generic/gdi/salprnpsp.cxx +++ b/vcl/unx/generic/gdi/salprnpsp.cxx @@ -271,11 +271,16 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma close( fd[0] ); char aBuffer[ 2048 ]; FILE* fp = fopen( aFilename.GetBuffer(), "r" ); - while( fp && ! feof( fp ) ) + while (fp && !feof(fp)) { - int nBytes = fread( aBuffer, 1, sizeof( aBuffer ), fp ); - if( nBytes ) - write( fd[ 1 ], aBuffer, nBytes ); + size_t nBytesRead = fread(aBuffer, 1, sizeof( aBuffer ), fp); + if (nBytesRead ) + { + size_t nBytesWritten = write(fd[1], aBuffer, nBytesRead); + OSL_ENSURE(nBytesWritten == nBytesRead, "short write"); + if (nBytesWritten != nBytesRead) + break; + } } fclose( fp ); close( fd[ 1 ] ); @@ -1342,7 +1347,12 @@ sal_Bool PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJo { osl_readFile( pFile, &buffer[0], buffer.size(), &nBytesRead ); if( nBytesRead > 0 ) - fwrite( &buffer[0], 1, nBytesRead, fp ); + { + size_t nBytesWritten = fwrite(&buffer[0], 1, nBytesRead, fp); + OSL_ENSURE(nBytesRead == nBytesWritten, "short write"); + if (nBytesRead != nBytesWritten) + break; + } } while( nBytesRead == buffer.size() ); rtl::OUStringBuffer aBuf( i_rJobName.Len() + 8 ); aBuf.append( i_rJobName ); diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx index 3235aa9a58fa..8cadab79b0a7 100644 --- a/vcl/unx/generic/plugadapt/salplug.cxx +++ b/vcl/unx/generic/plugadapt/salplug.cxx @@ -272,7 +272,7 @@ void SalAbort( const XubString& rErrorText ) if( !rErrorText.Len() ) std::fprintf( stderr, "Application Error\n" ); else - std::fprintf( stderr, "%s\n", ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() ); + std::fprintf( stderr, "%s\n", rtl::OUStringToOString(rErrorText, gsl_getSystemTextEncoding()).getStr() ); exit(-1); } diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index a850ec14bb28..1e8c378c8166 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -436,7 +436,7 @@ extern "C" { static void lcl_signal_action(int nSignal) { - fprintf( stderr, "Signal %d during fontconfig initialization called, ignoring fontconfig\n", nSignal ); + fprintf( stderr, "Signal %d during cups initialization called, ignoring cups\n", nSignal ); siglongjmp( aViolationBuffer, 1 ); } } diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index 03d676470ecb..872e880adc61 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -34,7 +34,8 @@ #include "tools/stream.hxx" -#include "sal/alloca.h" +#include <sal/alloca.h> +#include <rtl/strbuf.hxx> using namespace psp; @@ -122,48 +123,52 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes ) return false; SvMemoryStream aStream; - ByteString aLine; // write header job data aStream.WriteLine( "JobData 1" ); - aLine = "printer="; - aLine += ByteString( String( m_aPrinterName ), RTL_TEXTENCODING_UTF8 ); - aStream.WriteLine( aLine ); + rtl::OStringBuffer aLine; + + aLine.append(RTL_CONSTASCII_STRINGPARAM("printer=")); + aLine.append(rtl::OUStringToOString(m_aPrinterName, RTL_TEXTENCODING_UTF8)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "orientation="; - aLine += m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait"; - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("orientation=")); + if (m_eOrientation == orientation::Landscape) + aLine.append(RTL_CONSTASCII_STRINGPARAM("Landscape")); + else + aLine.append(RTL_CONSTASCII_STRINGPARAM("Portrait")); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "copies="; - aLine += ByteString::CreateFromInt32( m_nCopies ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("copies=")); + aLine.append(static_cast<sal_Int32>(m_nCopies)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "margindajustment="; - aLine += ByteString::CreateFromInt32( m_nLeftMarginAdjust ); - aLine += ','; - aLine += ByteString::CreateFromInt32( m_nRightMarginAdjust ); - aLine += ','; - aLine += ByteString::CreateFromInt32( m_nTopMarginAdjust ); - aLine += ','; - aLine += ByteString::CreateFromInt32( m_nBottomMarginAdjust ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("margindajustment=")); + aLine.append(static_cast<sal_Int32>(m_nLeftMarginAdjust)); + aLine.append(','); + aLine.append(static_cast<sal_Int32>(m_nRightMarginAdjust)); + aLine.append(','); + aLine.append(static_cast<sal_Int32>(m_nTopMarginAdjust)); + aLine.append(','); + aLine.append(static_cast<sal_Int32>(m_nBottomMarginAdjust)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "colordepth="; - aLine += ByteString::CreateFromInt32( m_nColorDepth ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("colordepth=")); + aLine.append(static_cast<sal_Int32>(m_nColorDepth)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "pslevel="; - aLine += ByteString::CreateFromInt32( m_nPSLevel ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("pslevel=")); + aLine.append(static_cast<sal_Int32>(m_nPSLevel)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "pdfdevice="; - aLine += ByteString::CreateFromInt32( m_nPDFDevice ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("pdfdevice=")); + aLine.append(static_cast<sal_Int32>(m_nPDFDevice)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "colordevice="; - aLine += ByteString::CreateFromInt32( m_nColorDevice ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("colordevice=")); + aLine.append(static_cast<sal_Int32>(m_nColorDevice)); + aStream.WriteLine(aLine.makeStringAndClear()); // now append the PPDContext stream buffer aStream.WriteLine( "PPDContexData" ); diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 3246e18fc806..91643d6646b2 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -696,7 +696,7 @@ PPDParser::PPDParser( const String& rFile ) : m_pTranslator( new PPDTranslator() ) { // read in the file - std::list< ByteString > aLines; + std::list< rtl::OString > aLines; PPDDecompressStream aStream( m_aFile ); bool bLanguageEncoding = false; if( aStream.IsOpen() ) @@ -897,11 +897,11 @@ static sal_uInt8 getNibble( sal_Char cChar ) return nRet; } -String PPDParser::handleTranslation( const ByteString& i_rString, bool bIsGlobalized ) +String PPDParser::handleTranslation(const rtl::OString& i_rString, bool bIsGlobalized) { - int nOrigLen = i_rString.Len(); + sal_Int32 nOrigLen = i_rString.getLength(); OStringBuffer aTrans( nOrigLen ); - const sal_Char* pStr = i_rString.GetBuffer(); + const sal_Char* pStr = i_rString.getStr(); const sal_Char* pEnd = pStr + nOrigLen; while( pStr < pEnd ) { @@ -923,9 +923,9 @@ String PPDParser::handleTranslation( const ByteString& i_rString, bool bIsGlobal return OStringToOUString( aTrans.makeStringAndClear(), bIsGlobalized ? RTL_TEXTENCODING_UTF8 : m_aFileEncoding ); } -void PPDParser::parse( ::std::list< ByteString >& rLines ) +void PPDParser::parse( ::std::list< rtl::OString >& rLines ) { - std::list< ByteString >::iterator line = rLines.begin(); + std::list< rtl::OString >::iterator line = rLines.begin(); PPDParser::hash_type::const_iterator keyit; while( line != rLines.end() ) { @@ -1027,7 +1027,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines ) { // copy the newlines also aLine += '\n'; - aLine += *line; + aLine += ByteString(*line); ++line; } } @@ -1142,7 +1142,9 @@ void PPDParser::parse( ::std::list< ByteString >& rLines ) if( nPos != STRING_NOTFOUND ) { aKey.Erase( nPos ); - String aOption( WhitespaceToSpace( aLine.Copy( nPos+9 ) ), RTL_TEXTENCODING_MS_1252 ); + rtl::OUString aOption(rtl::OStringToOUString( + WhitespaceToSpace(aLine.Copy(nPos+9)), + RTL_TEXTENCODING_MS_1252)); keyit = m_aKeys.find( aKey ); if( keyit != m_aKeys.end() ) { @@ -1171,7 +1173,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines ) } } -void PPDParser::parseOpenUI( const ByteString& rLine ) +void PPDParser::parseOpenUI(const rtl::OString& rLine) { String aTranslation; ByteString aKey = rLine; @@ -1202,7 +1204,8 @@ void PPDParser::parseOpenUI( const ByteString& rLine ) pKey->m_bUIOption = true; m_pTranslator->insertKey( pKey->getKey(), aTranslation ); - ByteString aValue = WhitespaceToSpace( rLine.GetToken( 1, ':' ) ); + sal_Int32 nIndex = 0; + ByteString aValue = WhitespaceToSpace( rLine.getToken( 1, ':', nIndex ) ); if( aValue.CompareIgnoreCaseToAscii( "boolean" ) == COMPARE_EQUAL ) pKey->m_eUIType = PPDKey::Boolean; else if( aValue.CompareIgnoreCaseToAscii( "pickmany" ) == COMPARE_EQUAL ) @@ -1211,16 +1214,16 @@ void PPDParser::parseOpenUI( const ByteString& rLine ) pKey->m_eUIType = PPDKey::PickOne; } -void PPDParser::parseOrderDependency( const ByteString& rLine ) +void PPDParser::parseOrderDependency(const rtl::OString& rLine) { - ByteString aLine( rLine ); - int nPos = aLine.Search( ':' ); - if( nPos != STRING_NOTFOUND ) - aLine.Erase( 0, nPos+1 ); + rtl::OString aLine(rLine); + sal_Int32 nPos = aLine.indexOf(':'); + if( nPos != -1 ) + aLine = aLine.copy( nPos+1 ); - int nOrder = GetCommandLineToken( 0, aLine ).ToInt32(); + sal_Int32 nOrder = GetCommandLineToken( 0, aLine ).toInt32(); ByteString aSetup = GetCommandLineToken( 1, aLine ); - String aKey( GetCommandLineToken( 2, aLine ), RTL_TEXTENCODING_MS_1252 ); + String aKey(rtl::OStringToOUString(GetCommandLineToken(2, aLine), RTL_TEXTENCODING_MS_1252)); if( aKey.GetChar( 0 ) != '*' ) return; // invalid order depency aKey.Erase( 0, 1 ); @@ -1250,12 +1253,12 @@ void PPDParser::parseOrderDependency( const ByteString& rLine ) pKey->m_eSetupType = PPDKey::AnySetup; } -void PPDParser::parseConstraint( const ByteString& rLine ) +void PPDParser::parseConstraint( const rtl::OString& rLine ) { bool bFailed = false; - String aLine( rLine, RTL_TEXTENCODING_MS_1252 ); - aLine.Erase( 0, rLine.Search( ':' )+1 ); + String aLine(rtl::OStringToOUString(rLine, RTL_TEXTENCODING_MS_1252)); + aLine.Erase(0, rLine.indexOf(':') + 1); PPDConstraint aConstraint; int nTokens = GetCommandLineTokenCount( aLine ); for( int i = 0; i < nTokens; i++ ) @@ -1291,7 +1294,7 @@ void PPDParser::parseConstraint( const ByteString& rLine ) if( ! aConstraint.m_pKey1 || ! aConstraint.m_pKey2 || bFailed ) { #ifdef __DEBUG - fprintf( stderr, "Warning: constraint \"%s\" is invalid\n", rLine.GetStr() ); + fprintf( stderr, "Warning: constraint \"%s\" is invalid\n", rLine.getStr() ); #endif } else diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index e29855c939d1..144821173962 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -772,30 +772,30 @@ bool PrinterInfoManager::writePrinterConfig() pConfig->DeleteGroup( it->second.m_aGroup ); // else some old keys may remain pConfig->SetGroup( it->second.m_aGroup ); - ByteString aValue( String( it->second.m_aInfo.m_aDriverName ), RTL_TEXTENCODING_UTF8 ); - aValue += '/'; - aValue += ByteString( String( it->first ), RTL_TEXTENCODING_UTF8 ); - pConfig->WriteKey( "Printer", aValue ); + rtl::OStringBuffer aValue(rtl::OUStringToOString(it->second.m_aInfo.m_aDriverName, RTL_TEXTENCODING_UTF8)); + aValue.append('/'); + aValue.append(rtl::OUStringToOString(it->first, RTL_TEXTENCODING_UTF8)); + pConfig->WriteKey("Printer", aValue.makeStringAndClear()); pConfig->WriteKey( "DefaultPrinter", it->first == m_aDefaultPrinter ? "1" : "0" ); pConfig->WriteKey( "Location", ByteString( String( it->second.m_aInfo.m_aLocation ), RTL_TEXTENCODING_UTF8 ) ); pConfig->WriteKey( "Comment", ByteString( String( it->second.m_aInfo.m_aComment ), RTL_TEXTENCODING_UTF8 ) ); pConfig->WriteKey( "Command", ByteString( String( it->second.m_aInfo.m_aCommand ), RTL_TEXTENCODING_UTF8 ) ); pConfig->WriteKey( "QuickCommand", ByteString( String( it->second.m_aInfo.m_aQuickCommand ), RTL_TEXTENCODING_UTF8 ) ); pConfig->WriteKey( "Features", ByteString( String( it->second.m_aInfo.m_aFeatures ), RTL_TEXTENCODING_UTF8 ) ); - pConfig->WriteKey( "Copies", ByteString::CreateFromInt32( it->second.m_aInfo.m_nCopies ) ); + pConfig->WriteKey("Copies", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nCopies))); pConfig->WriteKey( "Orientation", it->second.m_aInfo.m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait" ); - pConfig->WriteKey( "PSLevel", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPSLevel ) ); - pConfig->WriteKey( "PDFDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPDFDevice ) ); - pConfig->WriteKey( "ColorDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDevice ) ); - pConfig->WriteKey( "ColorDepth", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDepth ) ); - aValue = ByteString::CreateFromInt32( it->second.m_aInfo.m_nLeftMarginAdjust ); - aValue += ','; - aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nRightMarginAdjust ); - aValue += ','; - aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nTopMarginAdjust ); - aValue += ','; - aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nBottomMarginAdjust ); - pConfig->WriteKey( "MarginAdjust", aValue ); + pConfig->WriteKey("PSLevel", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nPSLevel))); + pConfig->WriteKey("PDFDevice", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nPDFDevice))); + pConfig->WriteKey("ColorDevice", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nColorDevice))); + pConfig->WriteKey("ColorDepth", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nColorDepth))); + aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nLeftMarginAdjust)); + aValue.append(','); + aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nRightMarginAdjust)); + aValue.append(','); + aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nTopMarginAdjust)); + aValue.append(','); + aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nBottomMarginAdjust)); + pConfig->WriteKey("MarginAdjust", aValue.makeStringAndClear()); if( it->second.m_aInfo.m_aDriverName.compareToAscii( "CUPS:", 5 ) != 0 ) { @@ -807,8 +807,11 @@ bool PrinterInfoManager::writePrinterConfig() aKey += ByteString( pKey->getKey(), RTL_TEXTENCODING_ISO_8859_1 ); const PPDValue* pValue = it->second.m_aInfo.m_aContext.getValue( pKey ); - aValue = pValue ? ByteString( pValue->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ) : ByteString( "*nil" ); - pConfig->WriteKey( aKey, aValue ); + if (pValue) + aValue.append(rtl::OUStringToOString(pValue->m_aOption, RTL_TEXTENCODING_ISO_8859_1)); + else + aValue.append(RTL_CONSTASCII_STRINGPARAM("*nil")); + pConfig->WriteKey(aKey, aValue.makeStringAndClear()); } } diff --git a/vcl/unx/generic/printergfx/common_gfx.cxx b/vcl/unx/generic/printergfx/common_gfx.cxx index 7cae4586bf6e..71ae6962ad73 100644 --- a/vcl/unx/generic/printergfx/common_gfx.cxx +++ b/vcl/unx/generic/printergfx/common_gfx.cxx @@ -1230,7 +1230,7 @@ PrinterGfx::DrawEPS( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize static sal_uInt16 nEps = 0; if( ! aDocTitle.Len() ) - aDocTitle = ByteString::CreateFromInt32( (sal_Int32)(nEps++) ); + aDocTitle = rtl::OString::valueOf(static_cast<sal_Int32>(nEps++)); if( fLeft != fRight && fTop != fBottom ) { diff --git a/vcl/unx/generic/printergfx/printerjob.cxx b/vcl/unx/generic/printergfx/printerjob.cxx index 827b5c7cf269..9fb50947bcf4 100644 --- a/vcl/unx/generic/printergfx/printerjob.cxx +++ b/vcl/unx/generic/printergfx/printerjob.cxx @@ -1191,12 +1191,13 @@ bool PrinterJob::writeSetup( osl::File* pFile, const JobData& rJob ) if( ! bExternalDialog && rJob.m_nCopies > 1 ) { // setup code - ByteString aLine( "/#copies " ); - aLine += ByteString::CreateFromInt32( rJob.m_nCopies ); - aLine += " def\n"; + rtl::OStringBuffer aLine(RTL_CONSTASCII_STRINGPARAM("/#copies ")); + aLine.append(static_cast<sal_Int32>(rJob.m_nCopies)); + aLine.append(RTL_CONSTASCII_STRINGPARAM(" def\n")); sal_uInt64 nWritten = 0; - bSuccess = pFile->write( aLine.GetBuffer(), aLine.Len(), nWritten ) - || nWritten != aLine.Len() ? false : true; + bSuccess = pFile->write(aLine.getStr(), aLine.getLength(), nWritten) + || nWritten != static_cast<sal_uInt64>(aLine.getLength()) ? + false : true; if( bSuccess && GetPostscriptLevel( &rJob ) >= 2 ) WritePS (pFile, "<< /NumCopies null /Policies << /NumCopies 1 >> >> setpagedevice\n" ); diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 1fdfc02c3916..2c1c94ae46c3 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -4241,7 +4241,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent ) CaptureMouse( sal_True ); #ifdef DBG_UTIL if( -1 != nCaptured_ ) - pDisplay_->PrintEvent( "Captured", pEvent ); + pDisplay_->DbgPrintDisplayEvent("Captured", pEvent); #endif } diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index 78e0cb05d4de..8514e4417ca3 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -224,7 +224,7 @@ void DocumentFocusListener::notifyEvent( const accessibility::AccessibleEventObj if( accessibility::AccessibleStateType::FOCUSED == nState ) atk_wrapper_focus_tracker_notify_when_idle( getAccessible(aEvent) ); } - catch(const lang::IndexOutOfBoundsException &e) + catch (const lang::IndexOutOfBoundsException&) { g_warning("Focused object has invalid index in parent"); } @@ -559,7 +559,7 @@ static void handle_get_focus(::VclWindowEvent const * pEvent) { aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet); } - catch( const uno::Exception &e ) + catch (const uno::Exception&) { g_warning( "Exception caught processing focus events" ); } @@ -593,7 +593,7 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent) } } } - catch( const uno::Exception& e ) + catch (const uno::Exception&) { g_warning( "Exception caught processing menu highlight events" ); } @@ -603,74 +603,76 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent) long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent) { - try { - switch (pEvent->GetId()) + try { - case VCLEVENT_WINDOW_SHOW: - break; - case VCLEVENT_WINDOW_HIDE: - break; - case VCLEVENT_WINDOW_CLOSE: - break; - case VCLEVENT_WINDOW_GETFOCUS: - handle_get_focus(static_cast< ::VclWindowEvent const * >(pEvent)); - break; - case VCLEVENT_WINDOW_LOSEFOCUS: - break; - case VCLEVENT_WINDOW_MINIMIZE: - break; - case VCLEVENT_WINDOW_NORMALIZE: - break; - case VCLEVENT_WINDOW_KEYINPUT: - case VCLEVENT_WINDOW_KEYUP: - case VCLEVENT_WINDOW_COMMAND: - case VCLEVENT_WINDOW_MOUSEMOVE: - break; - - case VCLEVENT_MENU_HIGHLIGHT: - if (const VclMenuEvent* pMenuEvent = dynamic_cast<const VclMenuEvent*>(pEvent)) - { - handle_menu_highlighted(pMenuEvent); - } - else if (const VclAccessibleEvent* pAccEvent = dynamic_cast<const VclAccessibleEvent*>(pEvent)) + switch (pEvent->GetId()) { - uno::Reference< accessibility::XAccessible > xAccessible = pAccEvent->GetAccessible(); - if (xAccessible.is()) - atk_wrapper_focus_tracker_notify_when_idle(xAccessible); + case VCLEVENT_WINDOW_SHOW: + break; + case VCLEVENT_WINDOW_HIDE: + break; + case VCLEVENT_WINDOW_CLOSE: + break; + case VCLEVENT_WINDOW_GETFOCUS: + handle_get_focus(static_cast< ::VclWindowEvent const * >(pEvent)); + break; + case VCLEVENT_WINDOW_LOSEFOCUS: + break; + case VCLEVENT_WINDOW_MINIMIZE: + break; + case VCLEVENT_WINDOW_NORMALIZE: + break; + case VCLEVENT_WINDOW_KEYINPUT: + case VCLEVENT_WINDOW_KEYUP: + case VCLEVENT_WINDOW_COMMAND: + case VCLEVENT_WINDOW_MOUSEMOVE: + break; + + case VCLEVENT_MENU_HIGHLIGHT: + if (const VclMenuEvent* pMenuEvent = dynamic_cast<const VclMenuEvent*>(pEvent)) + { + handle_menu_highlighted(pMenuEvent); + } + else if (const VclAccessibleEvent* pAccEvent = dynamic_cast<const VclAccessibleEvent*>(pEvent)) + { + uno::Reference< accessibility::XAccessible > xAccessible = pAccEvent->GetAccessible(); + if (xAccessible.is()) + atk_wrapper_focus_tracker_notify_when_idle(xAccessible); + } + break; + + case VCLEVENT_TOOLBOX_HIGHLIGHT: + handle_toolbox_highlight(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); + break; + + case VCLEVENT_TOOLBOX_BUTTONSTATECHANGED: + handle_toolbox_buttonchange(static_cast< ::VclWindowEvent const * >(pEvent)); + break; + + case VCLEVENT_OBJECT_DYING: + g_aWindowList.erase( static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow() ); + // fallthrough intentional ! + case VCLEVENT_TOOLBOX_HIGHLIGHTOFF: + handle_toolbox_highlightoff(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); + break; + + case VCLEVENT_TABPAGE_ACTIVATE: + handle_tabpage_activated(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); + break; + + case VCLEVENT_COMBOBOX_SETTEXT: + // 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. + // create_wrapper_for_children(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); + break; + + default: + break; } - break; - - case VCLEVENT_TOOLBOX_HIGHLIGHT: - handle_toolbox_highlight(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); - break; - - case VCLEVENT_TOOLBOX_BUTTONSTATECHANGED: - handle_toolbox_buttonchange(static_cast< ::VclWindowEvent const * >(pEvent)); - break; - - case VCLEVENT_OBJECT_DYING: - g_aWindowList.erase( static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow() ); - // fallthrough intentional ! - case VCLEVENT_TOOLBOX_HIGHLIGHTOFF: - handle_toolbox_highlightoff(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); - break; - - case VCLEVENT_TABPAGE_ACTIVATE: - handle_tabpage_activated(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); - break; - - case VCLEVENT_COMBOBOX_SETTEXT: - // 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. - // create_wrapper_for_children(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); - break; - - default: - break; } - } catch(lang::IndexOutOfBoundsException) + catch (const lang::IndexOutOfBoundsException&) { g_warning("Focused object has invalid index in parent"); } diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 0a71ad01dab0..dde909ff27f2 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -333,25 +333,70 @@ long GtkSalDisplay::Dispatch( XEvent* pEvent ) return GDK_FILTER_CONTINUE; } -GdkCursor* GtkSalDisplay::getFromXPM( const unsigned char *pBitmap, +#if GTK_CHECK_VERSION(3,0,0) +namespace +{ + //cairo annoyingly won't take raw xbm data unless it fits + //the required cairo stride + unsigned char* ensurePaddedForCairo(const unsigned char *pXBM, + int nWidth, int nHeight, int nStride) + { + unsigned char *pPaddedXBM = const_cast<unsigned char*>(pXBM); + + int bytes_per_row = (nWidth + 7) / 8; + + if (nStride != bytes_per_row) + { + pPaddedXBM = new unsigned char[nStride * nHeight]; + for (int row = 0; row < nHeight; ++row) + { + memcpy(pPaddedXBM + (nStride * row), + pXBM + (bytes_per_row * row), bytes_per_row); + memset(pPaddedXBM + (nStride * row) + bytes_per_row, + 0, nStride - bytes_per_row); + } + } + + return pPaddedXBM; + } +} +#endif + +GdkCursor* GtkSalDisplay::getFromXBM( 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); + int cairo_stride = cairo_format_stride_for_width(CAIRO_FORMAT_A1, nWidth); + + unsigned char *pPaddedXBM = ensurePaddedForCairo(pBitmap, nWidth, nHeight, cairo_stride); + cairo_surface_t *s = cairo_image_surface_create_for_data( + pPaddedXBM, + CAIRO_FORMAT_A1, nWidth, nHeight, + cairo_stride); + + cairo_t *cr = cairo_create(s); + unsigned char *pPaddedMaskXBM = ensurePaddedForCairo(pMask, nWidth, nHeight, cairo_stride); + cairo_surface_t *mask = cairo_image_surface_create_for_data( + pPaddedMaskXBM, + CAIRO_FORMAT_A1, nWidth, nHeight, + cairo_stride); + cairo_mask_surface(cr, mask, 0, 0); + cairo_destroy(cr); + cairo_surface_destroy(mask); + if (pPaddedMaskXBM != pMask) + delete [] pPaddedMaskXBM; + + GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, nWidth, nHeight); + cairo_surface_destroy(s); + if (pPaddedXBM != pBitmap) + delete [] pPaddedXBM; + + GdkCursor *cursor = gdk_cursor_new_from_pixbuf(m_pGdkDisplay, pixbuf, nXHot, nYHot); + g_object_unref(pixbuf); + + return cursor; #else GdkScreen *pScreen = gdk_display_get_default_screen( m_pGdkDisplay ); GdkDrawable *pDrawable = GDK_DRAWABLE( gdk_screen_get_root_window (pScreen) ); @@ -375,7 +420,7 @@ GdkCursor* GtkSalDisplay::getFromXPM( const unsigned char *pBitmap, #define MAKE_CURSOR( vcl_name, name ) \ case vcl_name: \ - pCursor = getFromXPM( name##curs##_bits, name##mask##_bits, \ + pCursor = getFromXBM( name##curs##_bits, name##mask##_bits, \ name##curs_width, name##curs_height, \ name##curs_x_hot, name##curs_y_hot ); \ break diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx index 2076d39cc229..66987ef533e1 100644 --- a/vcl/unx/gtk/app/gtksys.cxx +++ b/vcl/unx/gtk/app/gtksys.cxx @@ -55,11 +55,11 @@ GtkSalSystem::~GtkSalSystem() } // convert ~ to indicate mnemonic to '_' -static ByteString MapToGtkAccelerator (const String &rStr) +static rtl::OString MapToGtkAccelerator(const String &rStr) { String aRet( rStr ); aRet.SearchAndReplaceAscii("~", String::CreateFromAscii("_")); - return ByteString( aRet, RTL_TEXTENCODING_UTF8 ); + return rtl::OUStringToOString(aRet, RTL_TEXTENCODING_UTF8); } int GtkSalSystem::ShowNativeDialog( const String& rTitle, @@ -76,14 +76,16 @@ int GtkSalSystem::ShowNativeDialog( const String& rTitle, std::fprintf( stderr, "GtkSalSystem::ShowNativeDialog\n"); #endif - ByteString aTitle( rTitle, RTL_TEXTENCODING_UTF8 ); - ByteString aMessage( rMessage, RTL_TEXTENCODING_UTF8 ); + rtl::OString aTitle(rtl::OUStringToOString(rTitle, + RTL_TEXTENCODING_UTF8)); + rtl::OString aMessage(rtl::OUStringToOString(rMessage, + RTL_TEXTENCODING_UTF8)); /* Create the dialogue */ GtkWidget* mainwin = gtk_message_dialog_new ( NULL, (GtkDialogFlags)0, GTK_MESSAGE_WARNING, - GTK_BUTTONS_NONE, aMessage.GetBuffer(), NULL ); - gtk_window_set_title( GTK_WINDOW( mainwin ), aTitle.GetBuffer() ); + GTK_BUTTONS_NONE, aMessage.getStr(), NULL ); + gtk_window_set_title( GTK_WINDOW( mainwin ), aTitle.getStr() ); gint nButtons = 0, nResponse; @@ -92,13 +94,16 @@ int GtkSalSystem::ShowNativeDialog( const String& rTitle, { if( nButton == nDefButton ) { - gtk_dialog_add_button( GTK_DIALOG( mainwin ), MapToGtkAccelerator(*it).GetBuffer(), nButtons ); - gtk_dialog_set_default_response( GTK_DIALOG( mainwin ), nButtons ); + gtk_dialog_add_button(GTK_DIALOG( mainwin ), + MapToGtkAccelerator(*it).getStr(), 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 ); + rtl::OString aLabel(rtl::OUStringToOString(*it, + RTL_TEXTENCODING_UTF8)); + gtk_dialog_add_button(GTK_DIALOG(mainwin), aLabel.getStr(), + nButtons); } nButtons++; } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 8c151e782153..faa8a719b331 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -1431,7 +1431,7 @@ void GtkSalFrame::setMinMaxSize() int aHints = 0; if( m_nStyle & SAL_FRAME_STYLE_SIZEABLE ) { - if( m_aMinSize.Width() && m_aMinSize.Height() ) + if( m_aMinSize.Width() && m_aMinSize.Height() && ! m_bFullscreen ) { aGeo.min_width = m_aMinSize.Width()+CONTAINER_ADJUSTMENT; aGeo.min_height = m_aMinSize.Height()+CONTAINER_ADJUSTMENT; @@ -1446,11 +1446,12 @@ void GtkSalFrame::setMinMaxSize() } else { - aGeo.min_width = maGeometry.nWidth; - aGeo.min_height = maGeometry.nHeight; - aHints |= GDK_HINT_MIN_SIZE; if( ! m_bFullscreen ) { + aGeo.min_width = maGeometry.nWidth; + aGeo.min_height = maGeometry.nHeight; + aHints |= GDK_HINT_MIN_SIZE; + aGeo.max_width = maGeometry.nWidth; aGeo.max_height = maGeometry.nHeight; aHints |= GDK_HINT_MAX_SIZE; @@ -2371,6 +2372,8 @@ void GtkSalFrame::UpdateSettings( AllSettings& rSettings ) #ifndef GTK_GRAPHICS_DISABLED pGraphics->updateSettings( rSettings ); +#else + (void)rSettings; #endif if( bFreeGraphics ) @@ -3067,7 +3070,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp * - which is not good since the window manager will now size the window back to this * wrong size at some point. */ - if( (pThis->m_nStyle & (SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_PLUG)) == SAL_FRAME_STYLE_SIZEABLE ) + if( pThis->m_bFullscreen || (pThis->m_nStyle & (SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_PLUG)) == SAL_FRAME_STYLE_SIZEABLE ) { if( pEvent->width != (int)pThis->maGeometry.nWidth || pEvent->height != (int)pThis->maGeometry.nHeight ) { diff --git a/vcl/unx/gtk3/a11y/gtk3atkaction.cxx b/vcl/unx/gtk3/a11y/gtk3atkaction.cxx index 71a92c8e918b..80593f6af67c 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkaction.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkaction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkaction.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkbridge.cxx b/vcl/unx/gtk3/a11y/gtk3atkbridge.cxx index 34d094ff9d20..f7babdb8d95f 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkbridge.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkbridge.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkbridge.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx b/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx index cd33fcf91e9d..8c300b125d79 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkcomponent.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkeditabletext.cxx b/vcl/unx/gtk3/a11y/gtk3atkeditabletext.cxx index 6ba2164d2842..ae91ac31c63e 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkeditabletext.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkeditabletext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkeditabletext.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkfactory.cxx b/vcl/unx/gtk3/a11y/gtk3atkfactory.cxx index 3fd107f960c9..2a3c0dc8d76a 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkfactory.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkfactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkfactory.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx b/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx index 29458829989c..f6b8cb651ffb 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkhypertext.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkimage.cxx b/vcl/unx/gtk3/a11y/gtk3atkimage.cxx index e8404b199b0f..8167f6e8ecc9 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkimage.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkimage.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkimage.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx index a43aeab9abcb..76ad3ba5c6ea 100644 --- a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atklistener.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkregistry.cxx b/vcl/unx/gtk3/a11y/gtk3atkregistry.cxx index 95c372a8c74e..3ad55519a892 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkregistry.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkregistry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkregistry.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkselection.cxx b/vcl/unx/gtk3/a11y/gtk3atkselection.cxx index 860e125d38cb..b233bbee9ef5 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkselection.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkselection.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkselection.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atktable.cxx b/vcl/unx/gtk3/a11y/gtk3atktable.cxx index 39dc5fc75407..bc0f473a773c 100644 --- a/vcl/unx/gtk3/a11y/gtk3atktable.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atktable.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atktable.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atktext.cxx b/vcl/unx/gtk3/a11y/gtk3atktext.cxx index 3239c6630114..f6f69af3b4be 100644 --- a/vcl/unx/gtk3/a11y/gtk3atktext.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atktext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atktext.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx b/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx index 61eeb47211d1..85ecf50da8bd 100644 --- a/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atktextattributes.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkutil.cxx b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx index 44b41f63e575..183a33c3ac27 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkutil.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkutil.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkvalue.cxx b/vcl/unx/gtk3/a11y/gtk3atkvalue.cxx index 8398e0f5f57f..346d7672d6d2 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkvalue.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkvalue.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkvalue.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkwindow.cxx b/vcl/unx/gtk3/a11y/gtk3atkwindow.cxx index 3b11cf0f0780..c93b0ff4a8de 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkwindow.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkwindow.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkwindow.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx b/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx index 9a6c2e9c5d22..fbcecd3495f8 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkwrapper.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/app/gtk3gtkdata.cxx b/vcl/unx/gtk3/app/gtk3gtkdata.cxx index a6d7a0e2abc2..01d5c59104ca 100644 --- a/vcl/unx/gtk3/app/gtk3gtkdata.cxx +++ b/vcl/unx/gtk3/app/gtk3gtkdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/app/gtkdata.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/app/gtk3gtkinst.cxx b/vcl/unx/gtk3/app/gtk3gtkinst.cxx index ad2d59ac54a5..7d10b89e62a6 100644 --- a/vcl/unx/gtk3/app/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/app/gtk3gtkinst.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/app/gtkinst.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/app/gtk3gtksys.cxx b/vcl/unx/gtk3/app/gtk3gtksys.cxx index ee769b30e71a..8b103fa28e61 100644 --- a/vcl/unx/gtk3/app/gtk3gtksys.cxx +++ b/vcl/unx/gtk3/app/gtk3gtksys.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/app/gtksys.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 07dc4e58d395..aa68cc26e002 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -25,4 +26,7 @@ * instead of those above. */ -#include "../../gtk/gdi/salnativewidgets-gtk.cxx" +#include "../../headless/svpdi.hxx" +#include "../../headless/svpdi.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/window/gtk3gtkframe.cxx b/vcl/unx/gtk3/window/gtk3gtkframe.cxx index a1d950ec5a15..47cbf2f41893 100644 --- a/vcl/unx/gtk3/window/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/window/gtk3gtkframe.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/window/gtkframe.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/window/gtk3gtkobject.cxx b/vcl/unx/gtk3/window/gtk3gtkobject.cxx index ab1628018e06..e91c849d8dff 100644 --- a/vcl/unx/gtk3/window/gtk3gtkobject.cxx +++ b/vcl/unx/gtk3/window/gtk3gtkobject.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/window/gtkobject.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpbmp.cxx b/vcl/unx/headless/svpbmp.cxx index 2d8309af5eba..eccdd2bb97b3 100644 --- a/vcl/unx/headless/svpbmp.cxx +++ b/vcl/unx/headless/svpbmp.cxx @@ -26,7 +26,7 @@ * ************************************************************************/ -#include "svpbmp.hxx" +#include "unx/headless/svpbmp.hxx" #include <basegfx/vector/b2ivector.hxx> #include <basegfx/range/b2irange.hxx> diff --git a/vcl/unx/headless/svpdummies.cxx b/vcl/unx/headless/svpdummies.cxx index 3bf1a4da9cc0..326ad814651f 100644 --- a/vcl/unx/headless/svpdummies.cxx +++ b/vcl/unx/headless/svpdummies.cxx @@ -26,8 +26,8 @@ * ************************************************************************/ -#include "svpdummies.hxx" -#include "svpinst.hxx" +#include "unx/headless/svpdummies.hxx" +#include "unx/headless/svpinst.hxx" #include <rtl/ustrbuf.hxx> // SalObject diff --git a/vcl/unx/headless/svpelement.cxx b/vcl/unx/headless/svpelement.cxx index b6bf4822b576..785f3377e9af 100644 --- a/vcl/unx/headless/svpelement.cxx +++ b/vcl/unx/headless/svpelement.cxx @@ -26,7 +26,7 @@ * ************************************************************************/ -#include "svpelement.hxx" +#include "unx/headless/svpelement.hxx" #include <basebmp/scanlineformats.hxx> #include <tools/debug.hxx> @@ -39,9 +39,9 @@ #include <vcl/bitmap.hxx> #include <tools/stream.hxx> -#include "svpvd.hxx" -#include "svpbmp.hxx" -#include "svpframe.hxx" +#include "unx/headless/svpvd.hxx" +#include "unx/headless/svpbmp.hxx" +#include "unx/headless/svpframe.hxx" #include <list> #include <boost/unordered_map.hpp> diff --git a/vcl/unx/headless/svpframe.cxx b/vcl/unx/headless/svpframe.cxx index 1b8455557fac..bd15389cb1c0 100644 --- a/vcl/unx/headless/svpframe.cxx +++ b/vcl/unx/headless/svpframe.cxx @@ -26,9 +26,9 @@ * ************************************************************************/ -#include "svpframe.hxx" -#include "svpinst.hxx" -#include "svpgdi.hxx" +#include "unx/headless/svpframe.hxx" +#include "unx/headless/svpinst.hxx" +#include "unx/headless/svpgdi.hxx" #include <basebmp/scanlineformats.hxx> #include <basegfx/vector/b2ivector.hxx> diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx index 0a7041661d4e..7025b7d18b7d 100644 --- a/vcl/unx/headless/svpgdi.cxx +++ b/vcl/unx/headless/svpgdi.cxx @@ -26,8 +26,8 @@ * ************************************************************************/ -#include "svpgdi.hxx" -#include "svpbmp.hxx" +#include "unx/headless/svpgdi.hxx" +#include "unx/headless/svpbmp.hxx" #include <vcl/sysdata.hxx> #include <basegfx/range/b2drange.hxx> @@ -46,7 +46,7 @@ #include <sys/stat.h> #endif -#include <svppspgraphics.hxx> +#include "unx/headless/svppspgraphics.hxx" #include <region.h> using namespace basegfx; diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index c9e011c1a67a..41d268a7a437 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -35,11 +35,11 @@ #include <vcl/apptypes.hxx> -#include "svpinst.hxx" -#include "svpframe.hxx" -#include "svpdummies.hxx" -#include "svpvd.hxx" -#include "svpbmp.hxx" +#include "unx/headless/svpinst.hxx" +#include "unx/headless/svpframe.hxx" +#include "unx/headless/svpdummies.hxx" +#include "unx/headless/svpvd.hxx" +#include "unx/headless/svpbmp.hxx" #include <salframe.hxx> #include <svdata.hxx> diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx index 6f30f2d38969..64929876de17 100644 --- a/vcl/unx/headless/svpprn.cxx +++ b/vcl/unx/headless/svpprn.cxx @@ -41,9 +41,9 @@ #include "print.h" #include "salptype.hxx" -#include "svpprn.hxx" -#include "svppspgraphics.hxx" -#include "svpinst.hxx" +#include "unx/headless/svpprn.hxx" +#include "unx/headless/svppspgraphics.hxx" +#include "unx/headless/svpinst.hxx" using namespace psp; diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index 93fb0ced68b2..7b463a338e13 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -54,8 +54,8 @@ #include "outfont.hxx" #include "fontsubset.hxx" #include "printergfx.hxx" -#include "svppspgraphics.hxx" -#include "svpbmp.hxx" +#include "unx/headless/svppspgraphics.hxx" +#include "unx/headless/svpbmp.hxx" #include "region.h" using namespace psp; @@ -1135,10 +1135,12 @@ ImplDevFontAttributes PspGraphics::Info2DevFontAttributes( const psp::FastPrintF #if OSL_DEBUG_LEVEL > 2 if( bHasMapNames ) { - ByteString aOrigName( aDFA.maName, osl_getThreadTextEncoding() ); - ByteString aAliasNames( aDFA.maMapNames, osl_getThreadTextEncoding() ); + rtl::OString aOrigName(rtl::OUStringToOString(aDFA.maName, + osl_getThreadTextEncoding())); + rtl::OString aAliasNames(rtl::OUStringToOString(aDFA.maMapNames, + osl_getThreadTextEncoding())); fprintf( stderr, "using alias names \"%s\" for font family \"%s\"\n", - aAliasNames.GetBuffer(), aOrigName.GetBuffer() ); + aAliasNames.getStr(), aOrigName.getStr() ); } #endif diff --git a/vcl/unx/headless/svptext.cxx b/vcl/unx/headless/svptext.cxx index 18531baf1b52..4d3424605ba2 100644 --- a/vcl/unx/headless/svptext.cxx +++ b/vcl/unx/headless/svptext.cxx @@ -43,9 +43,9 @@ #include <impfont.hxx> #include <rtl/instance.hxx> -#include "svpgdi.hxx" -#include "svpbmp.hxx" -#include "svppspgraphics.hxx" +#include "unx/headless/svpgdi.hxx" +#include "unx/headless/svpbmp.hxx" +#include "unx/headless/svppspgraphics.hxx" using namespace basegfx; using namespace basebmp; diff --git a/vcl/unx/headless/svpvd.cxx b/vcl/unx/headless/svpvd.cxx index 8477da7b3bfc..c1de04b8d865 100644 --- a/vcl/unx/headless/svpvd.cxx +++ b/vcl/unx/headless/svpvd.cxx @@ -26,8 +26,8 @@ * ************************************************************************/ -#include "svpvd.hxx" -#include "svpgdi.hxx" +#include "unx/headless/svpvd.hxx" +#include "unx/headless/svpgdi.hxx" #include <basegfx/vector/b2ivector.hxx> #include <basebmp/scanlineformats.hxx> diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 98b84ce54d7a..10e73502927c 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -88,8 +88,6 @@ static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey ) return OUString::createFromAscii( (const char *) pGroup->readEntryUntranslated( pKey ).toAscii() ); } -#if 0 -#endif /** Helper function to add information to Font from QFont. Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx). diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk deleted file mode 100755 index c8dc1012dd8f..000000000000 --- a/vcl/util/makefile.mk +++ /dev/null @@ -1,465 +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=vcl -TARGETTYPE=GUI -USE_DEFFILE=TRUE -GEN_HID_OTHER=TRUE - -.IF "$(SNDFILE_LIBS)"!="" -SNDFILELIB=$(SNDFILE_LIBS) -.ENDIF - -# --- Settings ----------------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : makefile.pmk -.INCLUDE : makefile2.pmk - -.IF "$(OS)" == "SOLARIS" -.IF "$(CPUNAME)" == "SPARC" && "$(CPU)" == "U" -LINKFLAGSRUNPATH_OOO := -R/usr/sfw/lib/64 $(LINKFLAGSRUNPATH_OOO) -.ELSE -LINKFLAGSRUNPATH_OOO := -R/usr/sfw/lib $(LINKFLAGSRUNPATH_OOO) -.ENDIF -.ENDIF - -# --- Allgemein ---------------------------------------------------------- - -HXXDEPNLST= $(INC)$/vcl$/accel.hxx \ - $(INC)$/vcl$/animate.hxx \ - $(INC)$/vcl$/apptypes.hxx \ - $(INC)$/vcl$/bitmap.hxx \ - $(INC)$/vcl$/bitmapex.hxx \ - $(INC)$/vcl$/bmpacc.hxx \ - $(INC)$/vcl$/btndlg.hxx \ - $(INC)$/vcl$/button.hxx \ - $(INC)$/vcl$/ctrl.hxx \ - $(INC)$/vcl$/cursor.hxx \ - $(INC)$/vcl$/cmdevt.hxx \ - $(INC)$/vcl$/decoview.hxx \ - $(INC)$/vcl$/dialog.hxx \ - $(INC)$/vcl$/dllapi.h \ - $(INC)$/vcl$/dockwin.hxx \ - $(INC)$/vcl$/edit.hxx \ - $(INC)$/vcl$/event.hxx \ - $(INC)$/vcl$/field.hxx \ - $(INC)$/vcl$/fixed.hxx \ - $(INC)$/vcl$/floatwin.hxx \ - $(INC)$/vcl$/font.hxx \ - $(INC)$/vcl$/floatwin.hxx \ - $(INC)$/vcl$/graph.hxx \ - $(INC)$/vcl$/group.hxx \ - $(INC)$/vcl$/help.hxx \ - $(INC)$/vcl$/jobset.hxx \ - $(INC)$/vcl$/keycodes.hxx \ - $(INC)$/vcl$/keycod.hxx \ - $(INC)$/vcl$/image.hxx \ - $(INC)$/vcl$/lstbox.h \ - $(INC)$/vcl$/lstbox.hxx \ - $(INC)$/vcl$/mapmod.hxx \ - $(INC)$/vcl$/metaact.hxx \ - $(INC)$/vcl$/menu.hxx \ - $(INC)$/vcl$/menubtn.hxx \ - $(INC)$/vcl$/metric.hxx \ - $(INC)$/vcl$/morebtn.hxx \ - $(INC)$/vcl$/msgbox.hxx \ - $(INC)$/vcl$/octree.hxx \ - $(INC)$/vcl$/outdev.hxx \ - $(INC)$/vcl$/pointr.hxx \ - $(INC)$/vcl$/ptrstyle.hxx \ - $(INC)$/vcl$/prntypes.hxx \ - $(INC)$/vcl$/print.hxx \ - $(INC)$/vcl$/prndlg.hxx \ - $(INC)$/vcl$/region.hxx \ - $(INC)$/vcl$/rendergraphic.hxx \ - $(INC)$/vcl$/rendergraphicrasterizer.hxx \ - $(INC)$/vcl$/salbtype.hxx \ - $(INC)$/vcl$/scrbar.hxx \ - $(INC)$/vcl$/slider.hxx \ - $(INC)$/vcl$/seleng.hxx \ - $(INC)$/vcl$/settings.hxx \ - $(INC)$/vcl$/sound.hxx \ - $(INC)$/vcl$/sndstyle.hxx \ - $(INC)$/vcl$/split.hxx \ - $(INC)$/vcl$/splitwin.hxx \ - $(INC)$/vcl$/spin.hxx \ - $(INC)$/vcl$/spinfld.hxx \ - $(INC)$/vcl$/status.hxx \ - $(INC)$/vcl$/stdtext.hxx \ - $(INC)$/vcl$/sv.h \ - $(INC)$/vcl$/svapp.hxx \ - $(INC)$/vcl$/syschild.hxx \ - $(INC)$/vcl$/sysdata.hxx \ - $(INC)$/vcl$/syswin.hxx \ - $(INC)$/vcl$/tabctrl.hxx \ - $(INC)$/vcl$/tabdlg.hxx \ - $(INC)$/vcl$/tabpage.hxx \ - $(INC)$/vcl$/toolbox.hxx \ - $(INC)$/vcl$/timer.hxx \ - $(INC)$/vcl$/virdev.hxx \ - $(INC)$/vcl$/wall.hxx \ - $(INC)$/vcl$/waitobj.hxx \ - $(INC)$/vcl$/window.hxx \ - $(INC)$/vcl$/wrkwin.hxx - -.IF "$(linkinc)" != "" -SHL11FILE= $(MISC)$/app.slo -SHL12FILE= $(MISC)$/gdi.slo -SHL13FILE= $(MISC)$/win.slo -SHL14FILE= $(MISC)$/ctrl.slo -SHL16FILE= $(MISC)$/salapp.slo -SHL17FILE= $(MISC)$/salwin.slo -SHL18FILE= $(MISC)$/salgdi.slo -.ENDIF - -LIB1TARGET= $(SLB)$/$(TARGET).lib -LIB1FILES= $(SLB)$/app.lib \ - $(SLB)$/gdi.lib \ - $(SLB)$/win.lib \ - $(SLB)$/ctrl.lib \ - $(SLB)$/helper.lib \ - $(SLB)$/fontsubset.lib \ - $(SLB)$/components.lib - -.IF "$(GUI)" == "UNX" && "$(GUIBASE)"!="aqua" -LIB1FILES+= $(SLB)$/salplug.lib \ - $(SLB)$/fontman.lib \ - $(SLB)$/printer.lib -.ELSE -LIB1FILES+= \ - $(SLB)$/salwin.lib \ - $(SLB)$/salgdi.lib \ - $(SLB)$/salapp.lib -.IF "$(GUIBASE)" == "aqua" -LIB1FILES+= $(SLB)$/dtransaqua.lib -.ENDIF -.ENDIF - -SHL1TARGET= vcl$(DLLPOSTFIX) -SHL1IMPLIB= ivcl -SHL1STDLIBS+=\ - $(SOTLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(I18NPAPERLIB) \ - $(I18NISOLANGLIB) \ - $(I18NUTILLIB) \ - $(COMPHELPERLIB) \ - $(UCBHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(BASEGFXLIB) \ - $(ICUUCLIB) \ - $(ICUDATALIB) \ - $(ICULELIB) \ - $(JVMACCESSLIB) - -.IF "$(GUI)" == "UNX" -.IF "$(ENABLE_GRAPHITE)" != "" -.IF "$(SYSTEM_GRAPHITE)" == "YES" -SHL1STDLIBS+= $(GRAPHITE_LIBS) -.ELSE -SHL1STDLIBS+= -lgraphite2_off -.ENDIF -.ENDIF -.ENDIF -SHL1USE_EXPORTS=name - -.IF "$(GUIBASE)"=="aqua" -SHL1STDLIBS+= \ - $(BASEBMPLIB) \ - -lAppleRemote$(DLLPOSTFIX) \ - -framework QuickTime - -LIB1FILES+= \ - $(SLB)$/sala11y.lib -.ENDIF - -.IF "$(USE_BUILTIN_RASTERIZER)"!="" - LIB1FILES += $(SLB)$/glyphs.lib - SHL1STDLIBS+= $(FREETYPELIB) -.ELSE -.IF "$(ENABLE_GRAPHITE)" == "TRUE" - LIB1FILES += $(SLB)$/glyphs.lib -.ENDIF -.ENDIF # USE_BUILTIN_RASTERIZER - -SHL1LIBS= $(LIB1TARGET) - -.IF "$(GUI)" != "UNX" -SHL1RES= $(RES)$/salsrc.res -.ENDIF - -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME =$(SHL1TARGET) -DEF1DEPN = $(HXXDEPNLST) \ - $(LIB1TARGET) -DEF1DES =VCL -DEFLIB1NAME =vcl - -# --- W32 ---------------------------------------------------------------- - -.IF "$(GUI)" == "WNT" - -.IF "$(ENABLE_GRAPHITE)" == "TRUE" -.IF "$(COM)" == "GCC" -SHL1STDLIBS += -Wl,-Bstatic -lgraphite2_off -Wl,-Bdynamic -#SHL1STDLIBS += -lgraphite2_off -.ELSE -SHL1STDLIBS += graphite2_off.lib -.ENDIF -.ENDIF - -SHL1STDLIBS += $(UWINAPILIB) \ - $(GDI32LIB) \ - $(GDIPLUSLIB) \ - $(MSIMG32LIB) \ - $(WINSPOOLLIB) \ - $(OLE32LIB) \ - $(SHELL32LIB) \ - $(ADVAPI32LIB) \ - $(VERSIONLIB) - -SHL1STDLIBS += $(IMM32LIB) - -.IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI" -LINKFLAGSSHL += /ENTRY:LibMain@12 -.ENDIF -.ENDIF - -# --- UNX ---------------------------------------------------------------- - -# UNX sal plugins -.IF "$(GUI)" == "UNX" && "$(GUIBASE)" != "aqua" - -# desktop detector -LIB7TARGET=$(SLB)$/idet -LIB7FILES=$(SLB)$/dtdetect.lib -SHL7TARGET=desktop_detector$(DLLPOSTFIX) -SHL7STDLIBS=\ - $(SALLIB) \ - $(X11LINK_DYNAMIC) -SHL7IMPLIB=idet -SHL7LIBS=$(LIB7TARGET) - -# basic pure X11 plugin -LIB2TARGET=$(SLB)$/ipure_x -LIB2FILES= \ - $(SLB)$/dtransX11.lib \ - $(SLB)$/printergfx.lib \ - $(SLB)$/salwin.lib \ - $(SLB)$/salgdi.lib \ - $(SLB)$/salapp.lib -SHL2TARGET=vclplug_gen$(DLLPOSTFIX) -SHL2IMPLIB=ipure_x -SHL2LIBS=$(LIB2TARGET) -SHL2DEPN=$(SHL1IMPLIBN) $(SHL1TARGETN) - -# libs for generic plugin -SHL2STDLIBS=\ - $(VCLLIB)\ - $(I18NPAPERLIB) \ - $(I18NISOLANGLIB) \ - $(TOOLSLIB) \ - $(BASEGFXLIB) \ - $(UNOTOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -# prepare linking of Xinerama -.IF "$(USE_XINERAMA)" != "NO" - -.IF "$(OS)"=="MACOSX" || "$(OS)$(CPU)" == "LINUXX" -XINERAMALIBS=-lXinerama -.ELSE -.IF "$(OS)" != "SOLARIS" || "$(USE_XINERAMA_VERSION)" == "Xorg" -.IF "$(XINERAMA_LINK)" == "dynamic" -XINERAMALIBS= -lXinerama -.ELSE -XINERAMALIBS= -Wl,-Bstatic -lXinerama -Wl,-Bdynamic -.ENDIF # XINERAMA_LINK == dynamic -.ENDIF # OS == SOLARIS -.ENDIF # OS == MACOSX - -SHL2STDLIBS += $(XINERAMALIBS) -.ENDIF # USE_XINERAMA != NO - -.IF "$(XRENDER_LINK)" == "YES" -SHL2STDLIBS+=`pkg-config --libs xrender` -.ENDIF - -.IF "$(GUIBASE)"=="unx" - -SHL2STDLIBS += -lXext -lSM -lICE -lX11 -.IF "$(OS)"!="MACOSX" && "$(OS)"!="FREEBSD" && "$(OS)"!="NETBSD" && \ - && "$(OS)"!="OPENBSD" "$(OS)"!="DRAGONFLY" -# needed by salprnpsp.cxx -SHL2STDLIBS+= -ldl -.ENDIF - -.IF "$(ENABLE_RANDR)" != "" -.IF "$(XRANDR_DLOPEN)" == "FALSE" -SHL2STDLIBS+= $(XRANDR_LIBS) -.ENDIF -.ENDIF - -.ENDIF # "$(GUIBASE)"=="unx" - -# gtk plugin -.IF "$(ENABLE_GTK)" != "" -PKGCONFIG_MODULES=gtk+-2.0 gthread-2.0 -.IF "$(ENABLE_DBUS)" != "" -PKGCONFIG_MODULES+= dbus-glib-1 -.ENDIF -.INCLUDE: pkg_config.mk - -LIB4TARGET=$(SLB)$/igtk_plug_ -LIB4FILES=\ - $(SLB)$/gtkapp.lib\ - $(SLB)$/gtka11y.lib \ - $(SLB)$/gtkgdi.lib\ - $(SLB)$/gtkwin.lib - -SHL4TARGET=vclplug_gtk$(DLLPOSTFIX) -SHL4IMPLIB=igtk_plug_ -SHL4LIBS=$(LIB4TARGET) -SHL4DEPN=$(SHL1IMPLIBN) $(SHL1TARGETN) $(SHL2IMPLIBN) $(SHL2TARGETN) -# libs for gtk plugin -SHL4STDLIBS+=$(PKGCONFIG_LIBS:s/ -lpangoxft-1.0//) -# hack for faked SO environment -.IF "$(PKGCONFIG_ROOT)"!="" -SHL4SONAME+=-z nodefs -SHL4NOCHECK=TRUE -.ENDIF # "$(PKGCONFIG_ROOT)"!="" - - -SHL4STDLIBS+=-l$(SHL2TARGET) -SHL4STDLIBS+=\ - $(VCLLIB) \ - $(TOOLSLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(X11LINK_DYNAMIC) - -.IF "$(ENABLE_RANDR)" != "" -.IF "$(XRANDR_DLOPEN)" == "FALSE" -SHL4STDLIBS+= $(XRANDR_LIBS) -.ENDIF -.ENDIF - -.ENDIF # "$(ENABLE_GTK)" != "" - -# KDE plugin -.IF "$(ENABLE_KDE)" != "" -.IF "$(KDE_ROOT)"!="" -EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib -.IF "$(OS)$(CPU)" == "LINUXX" -EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib64 -.ENDIF -.ENDIF -LIB5TARGET=$(SLB)$/ikde_plug_ -LIB5FILES=$(SLB)$/kdeplug.lib -SHL5TARGET=vclplug_kde$(DLLPOSTFIX) -SHL5IMPLIB=ikde_plug_ -SHL5LIBS=$(LIB5TARGET) -SHL5DEPN=$(SHL2TARGETN) -# libs for KDE plugin -SHL5STDLIBS+=-l$(SHL2TARGET) -SHL5STDLIBS+=\ - $(VCLLIB) \ - $(TOOLSLIB) \ - $(SALLIB) \ - $(X11LINK_DYNAMIC) - -.IF "$(ENABLE_RANDR)" != "" -.IF "$(XRANDR_DLOPEN)" == "FALSE" -SHL5STDLIBS+= $(XRANDR_LIBS) -.ENDIF -.ENDIF - -SHL5LINKFLAGS+=$(KDE_LIBS) - -.ENDIF # "$(ENABLE_KDE)" != "" - -# KDE4 plugin -.IF "$(ENABLE_KDE4)" != "" -.IF "$(KDE4_ROOT)"!="" -EXTRALIBPATHS+=-L$(KDE4_ROOT)$/lib -.ENDIF -LIB6TARGET=$(SLB)$/ikde4_plug_ -LIB6FILES=$(SLB)$/kde4plug.lib -SHL6TARGET=vclplug_kde4$(DLLPOSTFIX) -SHL6IMPLIB=ikde4_plug_ -SHL6LIBS=$(LIB6TARGET) -SHL6DEPN=$(SHL2TARGETN) -# libs for KDE4 plugin -SHL6STDLIBS+=-l$(SHL2TARGET) -SHL6STDLIBS+=\ - $(VCLLIB) \ - $(PSPLIB) \ - $(TOOLSLIB) \ - $(SALLIB) \ - $(X11LINK_DYNAMIC) - -.IF "$(ENABLE_RANDR)" != "" -.IF "$(XRANDR_DLOPEN)" == "FALSE" -SHL6STDLIBS+= $(XRANDR_LIBS) -.ENDIF -.ENDIF - -SHL6STDLIBS+=$(KDE4_LIBS) $(KDE_GLIB_LIBS) - -.ENDIF # "$(ENABLE_KDE4)" != "" - -.ENDIF # UNX - -# --- Allgemein ---------------------------------------------------------- - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/vcl.component - -.IF "$(OS)" == "MACOSX" -my_platform = .macosx -.ELIF "$(OS)" == "WNT" -my_platform = .windows -.END - -$(MISC)/vcl.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - vcl.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt vcl$(my_platform).component diff --git a/vcl/vcl.android.component b/vcl/vcl.android.component new file mode 100644 index 000000000000..5dd80ebe0029 --- /dev/null +++ b/vcl/vcl.android.component @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.frame.VCLSessionManagerClient"> + <service name="com.sun.star.frame.SessionManagerClient"/> + </implementation> + <implementation name="vcl::DisplayAccess"> + <service name="com.sun.star.awt.DisplayAccess"/> + </implementation> + <implementation name="vcl::FontIdentificator"> + <service name="com.sun.star.awt.FontIdentificator"/> + </implementation> + <implementation name="vcl::rsvg::Rasterizer"> + <service name="com.sun.star.graphic.GraphicRasterizer_RSVG"/> + </implementation> +</component> diff --git a/vcl/vcl.ios.component b/vcl/vcl.ios.component new file mode 100644 index 000000000000..5dd80ebe0029 --- /dev/null +++ b/vcl/vcl.ios.component @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.frame.VCLSessionManagerClient"> + <service name="com.sun.star.frame.SessionManagerClient"/> + </implementation> + <implementation name="vcl::DisplayAccess"> + <service name="com.sun.star.awt.DisplayAccess"/> + </implementation> + <implementation name="vcl::FontIdentificator"> + <service name="com.sun.star.awt.FontIdentificator"/> + </implementation> + <implementation name="vcl::rsvg::Rasterizer"> + <service name="com.sun.star.graphic.GraphicRasterizer_RSVG"/> + </implementation> +</component> diff --git a/vcl/vcl.macosx.component b/vcl/vcl.macosx.component index 023f805672bd..a4f551c63a79 100644 --- a/vcl/vcl.macosx.component +++ b/vcl/vcl.macosx.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.datatransfer.dnd.OleDragSource_V1"> <service name="com.sun.star.datatransfer.dnd.OleDragSource"/> diff --git a/vcl/vcl.unx.component b/vcl/vcl.unx.component index ea14667d17c1..c58bb8fa3c47 100644 --- a/vcl/vcl.unx.component +++ b/vcl/vcl.unx.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.datatransfer.X11ClipboardSupport"> <service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/> diff --git a/vcl/vcl.windows.component b/vcl/vcl.windows.component index df786c4d832b..5dd80ebe0029 100644 --- a/vcl/vcl.windows.component +++ b/vcl/vcl.windows.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.frame.VCLSessionManagerClient"> <service name="com.sun.star.frame.SessionManagerClient"/> diff --git a/vcl/win/source/app/saldata.cxx b/vcl/win/source/app/saldata.cxx index 805ca84dc906..805ca84dc906 100755..100644 --- a/vcl/win/source/app/saldata.cxx +++ b/vcl/win/source/app/saldata.cxx diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx index 4436c0243f1d..4436c0243f1d 100755..100644 --- a/vcl/win/source/app/salinfo.cxx +++ b/vcl/win/source/app/salinfo.cxx diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 6db248c0ddb4..5e8930f4155f 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -34,9 +34,6 @@ #include <svsys.h> #include <process.h> #endif -#ifdef __MINGW32__ -#include <excpt.h> -#endif #include <osl/file.hxx> #include <osl/mutex.hxx> @@ -72,15 +69,19 @@ #pragma warning( disable: 4917 ) #endif -#include <GdiPlus.h> -#include <GdiPlusEnums.h> -#include <GdiPlusColor.h> -#include <Shlobj.h> +#include <gdiplus.h> +#include <gdiplusenums.h> +#include <gdipluscolor.h> +#include <shlobj.h> #if defined _MSC_VER #pragma warning(pop) #endif +#ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + // ======================================================================= void SalAbort( const XubString& rErrorText ) @@ -516,8 +517,6 @@ SalInstance* CreateSalInstance() // determine the windows version aSalShlData.mbWXP = 0; - aSalShlData.mbWPrinter = 0; - WORD nVer = (WORD)GetVersion(); rtl_zeroMemory( &aSalShlData.maVersionInfo, sizeof(aSalShlData.maVersionInfo) ); aSalShlData.maVersionInfo.dwOSVersionInfoSize = sizeof( aSalShlData.maVersionInfo ); if ( GetVersionEx( &aSalShlData.maVersionInfo ) ) @@ -526,8 +525,6 @@ SalInstance* CreateSalInstance() 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(); diff --git a/vcl/win/source/app/salshl.cxx b/vcl/win/source/app/salshl.cxx index caebe9ca5b18..caebe9ca5b18 100755..100644 --- a/vcl/win/source/app/salshl.cxx +++ b/vcl/win/source/app/salshl.cxx diff --git a/vcl/win/source/app/saltimer.cxx b/vcl/win/source/app/saltimer.cxx index 60c917475a94..5aab67d88cdd 100755..100644 --- a/vcl/win/source/app/saltimer.cxx +++ b/vcl/win/source/app/saltimer.cxx @@ -29,13 +29,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" #include <svsys.h> -#ifdef __MINGW32__ -#include <excpt.h> -#endif #include <win/saldata.hxx> #include <win/saltimer.h> #include <win/salinst.h> +#ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + // ======================================================================= // Maximale Periode diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx index 7661fa5f6ed1..7661fa5f6ed1 100755..100644 --- a/vcl/win/source/gdi/salbmp.cxx +++ b/vcl/win/source/gdi/salbmp.cxx diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx index 3c55685f0aba..fd828d6c0878 100644 --- a/vcl/win/source/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -50,9 +50,9 @@ #pragma warning(push, 1) #endif -#include <GdiPlus.h> -#include <GdiPlusEnums.h> -#include <GdiPlusColor.h> +#include <gdiplus.h> +#include <gdiplusenums.h> +#include <gdipluscolor.h> #if defined _MSC_VER #pragma warning(pop) @@ -62,7 +62,7 @@ // ----------------------------------------------------------------------- -void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) +void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GpPath *pPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) { sal_uInt32 nCount(rPolygon.count()); @@ -71,44 +71,42 @@ void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GraphicsPath& rPath, con const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1); const bool bControls(rPolygon.areControlPointsUsed()); basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0)); - Gdiplus::PointF aFCurr(Gdiplus::REAL(aCurr.getX()), Gdiplus::REAL(aCurr.getY())); for(sal_uInt32 a(0); a < nEdgeCount; a++) { const sal_uInt32 nNextIndex((a + 1) % nCount); const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex)); - const Gdiplus::PointF aFNext(Gdiplus::REAL(aNext.getX()), Gdiplus::REAL(aNext.getY())); if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex))) { const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a)); const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex)); - rPath.AddBezier( - aFCurr, - Gdiplus::PointF(Gdiplus::REAL(aCa.getX()), Gdiplus::REAL(aCa.getY())), - Gdiplus::PointF(Gdiplus::REAL(aCb.getX()), Gdiplus::REAL(aCb.getY())), - aFNext); + Gdiplus::DllExports::GdipAddPathBezier(pPath, + aCurr.getX(), aCurr.getY(), + aCa.getX(), aCa.getY(), + aCb.getX(), aCb.getY(), + aNext.getX(), aNext.getY()); } else { - rPath.AddLine(aFCurr, aFNext); + Gdiplus::DllExports::GdipAddPathLine(pPath, aCurr.getX(), aCurr.getY(), aNext.getX(), aNext.getY()); } if(a + 1 < nEdgeCount) { - aFCurr = aFNext; + aCurr = aNext; if(bNoLineJoin) { - rPath.StartFigure(); + Gdiplus::DllExports::GdipStartPathFigure(pPath); } } } } } -void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) +void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GpPath *pPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) { sal_uInt32 nCount(rPolygon.count()); @@ -117,37 +115,36 @@ void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GraphicsPath& rPath, const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1); const bool bControls(rPolygon.areControlPointsUsed()); basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0)); - Gdiplus::Point aICurr(INT(aCurr.getX()), INT(aCurr.getY())); for(sal_uInt32 a(0); a < nEdgeCount; a++) { const sal_uInt32 nNextIndex((a + 1) % nCount); const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex)); - const Gdiplus::Point aINext(INT(aNext.getX()), INT(aNext.getY())); if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex))) { const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a)); const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex)); - rPath.AddBezier( - aICurr, - Gdiplus::Point(INT(aCa.getX()), INT(aCa.getY())), - Gdiplus::Point(INT(aCb.getX()), INT(aCb.getY())), - aINext); + Gdiplus::DllExports::GdipAddPathBezier( + pPath, + aCurr.getX(), aCurr.getY(), + aCa.getX(), aCa.getY(), + aCb.getX(), aCb.getY(), + aNext.getX(), aNext.getY()); } else { - rPath.AddLine(aICurr, aINext); + Gdiplus::DllExports::GdipAddPathLine(pPath, aCurr.getX(), aCurr.getY(), aNext.getX(), aNext.getY()); } if(a + 1 < nEdgeCount) { - aICurr = aINext; + aCurr = aNext; if(bNoLineJoin) { - rPath.StartFigure(); + Gdiplus::DllExports::GdipStartPathFigure(pPath); } } } @@ -160,33 +157,39 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly if(mbBrush && nCount && (fTransparency >= 0.0 && fTransparency < 1.0)) { - Gdiplus::Graphics aGraphics(mhDC); + Gdiplus::GpGraphics *pGraphics = NULL; + Gdiplus::DllExports::GdipCreateFromHDC(mhDC, &pGraphics); const sal_uInt8 aTrans((sal_uInt8)255 - (sal_uInt8)basegfx::fround(fTransparency * 255.0)); Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maFillColor), SALCOLOR_GREEN(maFillColor), SALCOLOR_BLUE(maFillColor)); - Gdiplus::SolidBrush aTestBrush(aTestColor); - Gdiplus::GraphicsPath aPath; + Gdiplus::GpSolidFill *pTestBrush; + Gdiplus::DllExports::GdipCreateSolidFill(aTestColor.GetValue(), &pTestBrush); + Gdiplus::GpPath *pPath = NULL; + Gdiplus::DllExports::GdipCreatePath(Gdiplus::FillModeAlternate, &pPath); for(sal_uInt32 a(0); a < nCount; a++) { if(0 != a) { - aPath.StartFigure(); // #i101491# not needed for first run + Gdiplus::DllExports::GdipStartPathFigure(pPath); // #i101491# not needed for first run } - impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolyPolygon.getB2DPolygon(a), false); - aPath.CloseFigure(); + impAddB2DPolygonToGDIPlusGraphicsPathReal(pPath, rPolyPolygon.getB2DPolygon(a), false); + Gdiplus::DllExports::GdipClosePathFigure(pPath); } if(getAntiAliasB2DDraw()) { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeAntiAlias); } else { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeNone); } - aGraphics.FillPath(&aTestBrush, &aPath); + Gdiplus::DllExports::GdipFillPath(pGraphics, pTestBrush, pPath); + + Gdiplus::DllExports::GdipDeletePath(pPath); + Gdiplus::DllExports::GdipDeleteGraphics(pGraphics); } return true; @@ -198,11 +201,14 @@ bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double f if(mbPen && nCount) { - Gdiplus::Graphics aGraphics(mhDC); + Gdiplus::GpGraphics *pGraphics = NULL; + Gdiplus::DllExports::GdipCreateFromHDC(mhDC, &pGraphics); const sal_uInt8 aTrans = (sal_uInt8)basegfx::fround( 255 * (1.0 - fTransparency) ); Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); - Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX())); - Gdiplus::GraphicsPath aPath; + Gdiplus::GpPen *pTestPen = NULL; + Gdiplus::DllExports::GdipCreatePen1(aTestColor.GetValue(), Gdiplus::REAL(rLineWidths.getX()), Gdiplus::UnitWorld, &pTestPen); + Gdiplus::GpPath *pPath; + Gdiplus::DllExports::GdipCreatePath(Gdiplus::FillModeAlternate, &pPath); bool bNoLineJoin(false); switch(eLineJoin) @@ -217,49 +223,53 @@ bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double f } case basegfx::B2DLINEJOIN_BEVEL : { - aTestPen.SetLineJoin(Gdiplus::LineJoinBevel); + Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinBevel); break; } case basegfx::B2DLINEJOIN_MIDDLE : case basegfx::B2DLINEJOIN_MITER : { const Gdiplus::REAL aMiterLimit(15.0); - aTestPen.SetMiterLimit(aMiterLimit); - aTestPen.SetLineJoin(Gdiplus::LineJoinMiter); + Gdiplus::DllExports::GdipSetPenMiterLimit(pTestPen, aMiterLimit); + Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinMiter); break; } case basegfx::B2DLINEJOIN_ROUND : { - aTestPen.SetLineJoin(Gdiplus::LineJoinRound); + Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinRound); break; } } if(nCount > 250 && basegfx::fTools::more(rLineWidths.getX(), 1.5)) { - impAddB2DPolygonToGDIPlusGraphicsPathInteger(aPath, rPolygon, bNoLineJoin); + impAddB2DPolygonToGDIPlusGraphicsPathInteger(pPath, rPolygon, bNoLineJoin); } else { - impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolygon, bNoLineJoin); + impAddB2DPolygonToGDIPlusGraphicsPathReal(pPath, rPolygon, bNoLineJoin); } if(rPolygon.isClosed() && !bNoLineJoin) { // #i101491# needed to create the correct line joins - aPath.CloseFigure(); + Gdiplus::DllExports::GdipClosePathFigure(pPath); } if(getAntiAliasB2DDraw()) { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeAntiAlias); } else { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeNone); } - aGraphics.DrawPath(&aTestPen, &aPath); + Gdiplus::DllExports::GdipDrawPath(pGraphics, pTestPen, pPath); + + Gdiplus::DllExports::GdipDeletePath(pPath); + Gdiplus::DllExports::GdipDeletePen(pTestPen); + Gdiplus::DllExports::GdipDeleteGraphics(pGraphics); } return true; diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index 07a6b633e11b..7fdd77394cc2 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -39,10 +39,6 @@ #include <tools/urlobj.hxx> -#ifdef __MINGW32__ -#include <excpt.h> -#endif - #include <win/wincomp.hxx> #include <win/saldata.hxx> #include <win/salinst.h> @@ -65,6 +61,10 @@ #include <malloc.h> #ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + +#ifdef __MINGW32__ #define CATCH_DRIVER_EX_BEGIN \ jmp_buf jmpbuf; \ __SEHandler han; \ @@ -110,24 +110,11 @@ static char aImplWindows[] = "windows"; static char aImplDevices[] = "devices"; static char aImplDevice[] = "device"; -static LPDEVMODEA SAL_DEVMODE_A( const ImplJobSetup* pSetupData ) -{ - LPDEVMODEA pRet = NULL; - SalDriverData* pDrv = (SalDriverData*)pSetupData->mpDriverData; - if( pDrv->mnVersion == SAL_DRIVERDATA_VERSION_A && - pSetupData->mnDriverDataLen >= sizeof(DEVMODEA)+sizeof(SalDriverData)-1 - ) - pRet = ((LPDEVMODEA)((pSetupData->mpDriverData) + (pDrv->mnDriverOffset))); - return pRet; -} - static LPDEVMODEW SAL_DEVMODE_W( const ImplJobSetup* pSetupData ) { LPDEVMODEW pRet = NULL; SalDriverData* pDrv = (SalDriverData*)pSetupData->mpDriverData; - if( pDrv->mnVersion == SAL_DRIVERDATA_VERSION_W && - pSetupData->mnDriverDataLen >= sizeof(DEVMODEW)+sizeof(SalDriverData)-1 - ) + if( pSetupData->mnDriverDataLen >= sizeof(DEVMODEW)+sizeof(SalDriverData)-1 ) pRet = ((LPDEVMODEW)((pSetupData->mpDriverData) + (pDrv->mnDriverOffset))); return pRet; } @@ -192,140 +179,8 @@ static sal_uLong ImplWinQueueStatusToSal( DWORD nWinStatus ) // ----------------------------------------------------------------------- -static void getPrinterQueueInfoOldStyle( ImplPrnQueueList* pList ) -{ - DWORD i; - DWORD n; - DWORD nBytes = 0; - DWORD nInfoPrn2; - sal_Bool bFound = FALSE; - PRINTER_INFO_2* pWinInfo2 = NULL; - PRINTER_INFO_2* pGetInfo2; - EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nBytes, &nInfoPrn2 ); - if ( nBytes ) - { - pWinInfo2 = (PRINTER_INFO_2*) rtl_allocateMemory( nBytes ); - if ( EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pWinInfo2, nBytes, &nBytes, &nInfoPrn2 ) ) - { - pGetInfo2 = pWinInfo2; - for ( i = 0; i < nInfoPrn2; i++ ) - { - SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo; - pInfo->maPrinterName = ImplSalGetUniString( pGetInfo2->pPrinterName ); - pInfo->maDriver = ImplSalGetUniString( pGetInfo2->pDriverName ); - XubString aPortName; - if ( pGetInfo2->pPortName ) - aPortName = ImplSalGetUniString( pGetInfo2->pPortName ); - // pLocation can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pLocation && strlen( pGetInfo2->pLocation ) ) - pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pLocation ); - else - pInfo->maLocation = aPortName; - // pComment can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pComment ) - pInfo->maComment = ImplSalGetUniString( pGetInfo2->pComment ); - pInfo->mnStatus = ImplWinQueueStatusToSal( pGetInfo2->Status ); - pInfo->mnJobs = pGetInfo2->cJobs; - pInfo->mpSysData = new XubString( aPortName ); - pList->Add( pInfo ); - pGetInfo2++; - } - - bFound = TRUE; - } - } - - // read printers from win.ini - // TODO: MSDN: GetProfileString() should not be called from server - // code because it is just there for WIN16 compatibility - UINT nSize = 4096; - char* pBuf = new char[nSize]; - UINT nRead = GetProfileStringA( aImplDevices, NULL, "", pBuf, nSize ); - while ( nRead >= nSize-2 ) - { - nSize += 2048; - delete []pBuf; - pBuf = new char[nSize]; - nRead = GetProfileStringA( aImplDevices, NULL, "", pBuf, nSize ); - } - - // extract printer names from buffer and fill list - char* pName = pBuf; - while ( *pName ) - { - char* pPortName; - char* pTmp; - char aPortBuf[256]; - GetProfileStringA( aImplDevices, pName, "", aPortBuf, sizeof( aPortBuf ) ); - - pPortName = aPortBuf; - - // create name - xub_StrLen nNameLen = sal::static_int_cast<xub_StrLen>(strlen( pName )); - XubString aName( ImplSalGetUniString( pName, nNameLen ) ); - - // get driver name - pTmp = pPortName; - while ( *pTmp != ',' ) - pTmp++; - XubString aDriver( ImplSalGetUniString( pPortName, (sal_uInt16)(pTmp-pPortName) ) ); - pPortName = pTmp; - - // get port names - do - { - pPortName++; - pTmp = pPortName; - while ( *pTmp && (*pTmp != ',') ) - pTmp++; - - String aPortName( ImplSalGetUniString( pPortName, (sal_uInt16)(pTmp-pPortName) ) ); - - // create new entry - // look up if printer was already found in first loop - sal_Bool bAdd = TRUE; - if ( pWinInfo2 ) - { - pGetInfo2 = pWinInfo2; - for ( n = 0; n < nInfoPrn2; n++ ) - { - if ( aName.EqualsIgnoreCaseAscii( pGetInfo2->pPrinterName ) ) - { - bAdd = FALSE; - break; - } - pGetInfo2++; - } - } - // if it's a new printer, add it - if ( bAdd ) - { - SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo; - pInfo->maPrinterName = aName; - pInfo->maDriver = aDriver; - pInfo->maLocation = aPortName; - pInfo->mnStatus = 0; - pInfo->mnJobs = QUEUE_JOBS_DONTKNOW; - pInfo->mpSysData = new XubString( aPortName ); - pList->Add( pInfo ); - } - } - while ( *pTmp == ',' ); - - pName += nNameLen + 1; - } - - delete []pBuf; - rtl_freeMemory( pWinInfo2 ); -} - void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) { - if( ! aSalShlData.mbWPrinter ) - { - getPrinterQueueInfoOldStyle( pList ); - return; - } DWORD i; DWORD nBytes = 0; DWORD nInfoPrn4 = 0; @@ -352,59 +207,8 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) // ----------------------------------------------------------------------- -static void getPrinterQueueStateOldStyle( SalPrinterQueueInfo* pInfo ) -{ - DWORD nBytes = 0; - DWORD nInfoRet; - PRINTER_INFO_2* pWinInfo2; - EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nBytes, &nInfoRet ); - if ( nBytes ) - { - pWinInfo2 = (PRINTER_INFO_2*) rtl_allocateMemory( nBytes ); - if ( EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pWinInfo2, nBytes, &nBytes, &nInfoRet ) ) - { - PRINTER_INFO_2* pGetInfo2 = pWinInfo2; - for ( DWORD i = 0; i < nInfoRet; i++ ) - { - if ( pInfo->maPrinterName.EqualsAscii( pGetInfo2->pPrinterName ) && - ( pInfo->maDriver.Len() == 0 || - pInfo->maDriver.EqualsAscii( pGetInfo2->pDriverName ) ) - ) - { - XubString aPortName; - if ( pGetInfo2->pPortName ) - aPortName = ImplSalGetUniString( pGetInfo2->pPortName ); - // pLocation can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pLocation && strlen( pGetInfo2->pLocation ) ) - pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pLocation ); - else - pInfo->maLocation = aPortName; - // pComment can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pComment ) - pInfo->maComment = ImplSalGetUniString( pGetInfo2->pComment ); - pInfo->mnStatus = ImplWinQueueStatusToSal( pGetInfo2->Status ); - pInfo->mnJobs = pGetInfo2->cJobs; - if( ! pInfo->mpSysData ) - pInfo->mpSysData = new XubString( aPortName ); - break; - } - - pGetInfo2++; - } - } - - rtl_freeMemory( pWinInfo2 ); - } -} - void WinSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) { - if( ! aSalShlData.mbWPrinter ) - { - getPrinterQueueStateOldStyle( pInfo ); - return; - } - HANDLE hPrinter = 0; LPWSTR pPrnName = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pInfo->maPrinterName.GetBuffer())); if( OpenPrinterW( pPrnName, &hPrinter, NULL ) ) @@ -451,43 +255,19 @@ void WinSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) // ----------------------------------------------------------------------- XubString WinSalInstance::GetDefaultPrinter() { - static bool bGetDefPrtAPI = true; - static sal_Bool(WINAPI*pGetDefaultPrinter)(LPWSTR,LPDWORD) = NULL; - // try to use GetDefaultPrinter API (not available prior to W2000) - if( bGetDefPrtAPI ) + DWORD nChars = 0; + GetDefaultPrinterW( NULL, &nChars ); + if( nChars ) { - bGetDefPrtAPI = false; - // check for W2k and XP - if( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && aSalShlData.maVersionInfo.dwMajorVersion >= 5 ) + LPWSTR pStr = (LPWSTR)rtl_allocateMemory(nChars*sizeof(WCHAR)); + XubString aDefPrt; + if( GetDefaultPrinterW( pStr, &nChars ) ) { - OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM( "winspool.drv" ) ); - oslModule pLib = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); - oslGenericFunction pFunc = NULL; - if( pLib ) - { - OUString queryFuncName( RTL_CONSTASCII_USTRINGPARAM( "GetDefaultPrinterW" ) ); - pFunc = osl_getFunctionSymbol( pLib, queryFuncName.pData ); - } - - pGetDefaultPrinter = (sal_Bool(WINAPI*)(LPWSTR,LPDWORD)) pFunc; - } - } - if( pGetDefaultPrinter ) - { - DWORD nChars = 0; - pGetDefaultPrinter( NULL, &nChars ); - if( nChars ) - { - LPWSTR pStr = (LPWSTR)rtl_allocateMemory(nChars*sizeof(WCHAR)); - XubString aDefPrt; - if( pGetDefaultPrinter( pStr, &nChars ) ) - { - aDefPrt = reinterpret_cast<sal_Unicode* >(pStr); - } - rtl_freeMemory( pStr ); - if( aDefPrt.Len() ) - return aDefPrt; + aDefPrt = reinterpret_cast<sal_Unicode* >(pStr); } + rtl_freeMemory( pStr ); + if( aDefPrt.Len() ) + return aDefPrt; } // get default printer from win.ini @@ -511,30 +291,15 @@ XubString WinSalInstance::GetDefaultPrinter() static DWORD ImplDeviceCaps( WinSalInfoPrinter* pPrinter, WORD nCaps, BYTE* pOutput, const ImplJobSetup* pSetupData ) { - if( aSalShlData.mbWPrinter ) - { - DEVMODEW* pDevMode; - if ( !pSetupData || !pSetupData->mpDriverData ) - pDevMode = NULL; - else - pDevMode = SAL_DEVMODE_W( pSetupData ); - - return DeviceCapabilitiesW( reinterpret_cast<LPCWSTR>(pPrinter->maDeviceName.GetBuffer()), - reinterpret_cast<LPCWSTR>(pPrinter->maPortName.GetBuffer()), - nCaps, (LPWSTR)pOutput, pDevMode ); - } + DEVMODEW* pDevMode; + if ( !pSetupData || !pSetupData->mpDriverData ) + pDevMode = NULL; else - { - DEVMODEA* pDevMode; - if ( !pSetupData || !pSetupData->mpDriverData ) - pDevMode = NULL; - else - pDevMode = SAL_DEVMODE_A( pSetupData ); + pDevMode = SAL_DEVMODE_W( pSetupData ); - return DeviceCapabilitiesA( ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(), - ImplSalGetWinAnsiString( pPrinter->maPortName, TRUE ).GetBuffer(), - nCaps, (LPSTR)pOutput, pDevMode ); - } + return DeviceCapabilitiesW( reinterpret_cast<LPCWSTR>(pPrinter->maDeviceName.GetBuffer()), + reinterpret_cast<LPCWSTR>(pPrinter->maPortName.GetBuffer()), + nCaps, (LPWSTR)pOutput, pDevMode ); } // ----------------------------------------------------------------------- @@ -549,25 +314,15 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, // initialize versions from jobsetup // those will be overwritten with driver's version - DEVMODEA* pDevModeA = NULL; DEVMODEW* pDevModeW = NULL; LONG dmSpecVersion = -1; LONG dmDriverVersion = -1; SalDriverData* pSalDriverData = (SalDriverData*)pSetupData->mpDriverData; BYTE* pDriverData = ((BYTE*)pSalDriverData) + pSalDriverData->mnDriverOffset; - if( pSalDriverData->mnVersion == SAL_DRIVERDATA_VERSION_W ) - { - if( aSalShlData.mbWPrinter ) - pDevModeW = (DEVMODEW*)pDriverData; - } - else if( pSalDriverData->mnVersion == SAL_DRIVERDATA_VERSION_A ) - { - if( ! aSalShlData.mbWPrinter ) - pDevModeA = (DEVMODEA*)pDriverData; - } + pDevModeW = (DEVMODEW*)pDriverData; long nSysJobSize = -1; - if( pPrinter && ( pDevModeA || pDevModeW ) ) + if( pPrinter && pDevModeW ) { // just too many driver crashes in that area -> check the dmSpecVersion and dmDriverVersion fields always !!! // this prevents using the jobsetup between different Windows versions (eg from XP to 9x) but we @@ -576,31 +331,16 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, ByteString aPrinterNameA= ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ); HANDLE hPrn; LPWSTR pPrinterNameW = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pPrinter->maDeviceName.GetBuffer())); - if ( ! aSalShlData.mbWPrinter ) - { - if ( !OpenPrinterA( (LPSTR)aPrinterNameA.GetBuffer(), &hPrn, NULL ) ) - return FALSE; - } - else - if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) - return FALSE; + if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) + return FALSE; // #131642# hPrn==HGDI_ERROR even though OpenPrinter() succeeded! if( hPrn == HGDI_ERROR ) return FALSE; - if( aSalShlData.mbWPrinter ) - { - nSysJobSize = DocumentPropertiesW( 0, hPrn, - pPrinterNameW, - NULL, NULL, 0 ); - } - else - { - nSysJobSize = DocumentPropertiesA( 0, hPrn, - (LPSTR)aPrinterNameA.GetBuffer(), - NULL, NULL, 0 ); - } + nSysJobSize = DocumentPropertiesW( 0, hPrn, + pPrinterNameW, + NULL, NULL, 0 ); if( nSysJobSize < 0 ) { @@ -609,18 +349,9 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, } BYTE *pBuffer = (BYTE*)_alloca( nSysJobSize ); LONG nRet = -1; - if( aSalShlData.mbWPrinter ) - { - nRet = DocumentPropertiesW( 0, hPrn, - pPrinterNameW, - (LPDEVMODEW)pBuffer, NULL, DM_OUT_BUFFER ); - } - else - { - nRet = DocumentPropertiesA( 0, hPrn, - (LPSTR)aPrinterNameA.GetBuffer(), - (LPDEVMODEA)pBuffer, NULL, DM_OUT_BUFFER ); - } + nRet = DocumentPropertiesW( 0, hPrn, + pPrinterNameW, + (LPDEVMODEW)pBuffer, NULL, DM_OUT_BUFFER ); if( nRet < 0 ) { ClosePrinter( hPrn ); @@ -630,8 +361,8 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, // the spec version differs between the windows platforms, ie 98,NT,2000/XP // this allows us to throw away printer settings from other platforms that might crash a buggy driver // we check the driver version as well - dmSpecVersion = aSalShlData.mbWPrinter ? ((DEVMODEW*)pBuffer)->dmSpecVersion : ((DEVMODEA*)pBuffer)->dmSpecVersion; - dmDriverVersion = aSalShlData.mbWPrinter ? ((DEVMODEW*)pBuffer)->dmDriverVersion : ((DEVMODEA*)pBuffer)->dmDriverVersion; + dmSpecVersion = ((DEVMODEW*)pBuffer)->dmSpecVersion; + dmDriverVersion = ((DEVMODEW*)pBuffer)->dmDriverVersion; ClosePrinter( hPrn ); } @@ -642,10 +373,6 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, (long)(pSetupData->mnDriverDataLen - pSetupDriverData->mnDriverOffset) == nSysJobSize && pSetupDriverData->mnSysSignature == SAL_DRIVERDATA_SYSSIGN ) { - if( pDevModeA && - (dmSpecVersion == pDevModeA->dmSpecVersion) && - (dmDriverVersion == pDevModeA->dmDriverVersion) ) - return TRUE; if( pDevModeW && (dmSpecVersion == pDevModeW->dmSpecVersion) && (dmDriverVersion == pDevModeW->dmDriverVersion) ) @@ -670,16 +397,8 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup ByteString aPrinterNameA = ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ); HANDLE hPrn; LPWSTR pPrinterNameW = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pPrinter->maDeviceName.GetBuffer())); - if( aSalShlData.mbWPrinter ) - { - if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) - return FALSE; - } - else - { - if ( !OpenPrinterA( (LPSTR)aPrinterNameA.GetBuffer(), &hPrn, NULL ) ) - return FALSE; - } + if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) + return FALSE; // #131642# hPrn==HGDI_ERROR even though OpenPrinter() succeeded! if( hPrn == HGDI_ERROR ) return FALSE; @@ -692,16 +411,9 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup SalDriverData* pOutBuffer = NULL; BYTE* pInBuffer = NULL; - if( aSalShlData.mbWPrinter ) - { - nSysJobSize = DocumentPropertiesW( hWnd, hPrn, - pPrinterNameW, - NULL, NULL, 0 ); - } - else - nSysJobSize = DocumentPropertiesA( hWnd, hPrn, - (LPSTR)ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(), - NULL, NULL, 0 ); + nSysJobSize = DocumentPropertiesW( hWnd, hPrn, + pPrinterNameW, + NULL, NULL, 0 ); if ( nSysJobSize < 0 ) { ClosePrinter( hPrn ); @@ -712,7 +424,6 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup nDriverDataLen = sizeof(SalDriverData) + nSysJobSize-1; pOutBuffer = (SalDriverData*)rtl_allocateZeroMemory( nDriverDataLen ); pOutBuffer->mnSysSignature = SAL_DRIVERDATA_SYSSIGN; - pOutBuffer->mnVersion = aSalShlData.mbWPrinter ? SAL_DRIVERDATA_VERSION_W : SAL_DRIVERDATA_VERSION_A; // calculate driver data offset including structure padding pOutBuffer->mnDriverOffset = sal::static_int_cast<sal_uInt16>( (char*)pOutBuffer->maDriverData - @@ -738,18 +449,9 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup nMutexCount = ImplSalReleaseYieldMutex(); BYTE* pOutDevMode = (((BYTE*)pOutBuffer) + pOutBuffer->mnDriverOffset); - if( aSalShlData.mbWPrinter ) - { - nRet = DocumentPropertiesW( hWnd, hPrn, - pPrinterNameW, - (LPDEVMODEW)pOutDevMode, (LPDEVMODEW)pInBuffer, nMode ); - } - else - { - nRet = DocumentPropertiesA( hWnd, hPrn, - (LPSTR)ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(), - (LPDEVMODEA)pOutDevMode, (LPDEVMODEA)pInBuffer, nMode ); - } + nRet = DocumentPropertiesW( hWnd, hPrn, + pPrinterNameW, + (LPDEVMODEW)pOutDevMode, (LPDEVMODEW)pInBuffer, nMode ); if ( pVisibleDlgParent ) ImplSalAcquireYieldMutex( nMutexCount ); ClosePrinter( hPrn ); @@ -761,35 +463,17 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup } // fill up string buffers with 0 so they do not influence a JobSetup's memcmp - if( aSalShlData.mbWPrinter ) + if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 64 ) { - if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 64 ) - { - sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmDeviceName ); - if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )/sizeof(sal_Unicode) ) - memset( ((LPDEVMODEW)pOutDevMode)->dmDeviceName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )-(nLen*sizeof(sal_Unicode)) ); - } - if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 166 ) - { - sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmFormName ); - if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )/sizeof(sal_Unicode) ) - memset( ((LPDEVMODEW)pOutDevMode)->dmFormName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )-(nLen*sizeof(sal_Unicode)) ); - } + sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmDeviceName ); + if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )/sizeof(sal_Unicode) ) + memset( ((LPDEVMODEW)pOutDevMode)->dmDeviceName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )-(nLen*sizeof(sal_Unicode)) ); } - else + if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 166 ) { - if( ((LPDEVMODEA)pOutDevMode)->dmSize >= 32 ) - { - sal_Int32 nLen = strlen( (const char*)((LPDEVMODEA)pOutDevMode)->dmDeviceName ); - if ( nLen < sizeof( ((LPDEVMODEA)pOutDevMode)->dmDeviceName ) ) - memset( ((LPDEVMODEA)pOutDevMode)->dmDeviceName+nLen, 0, sizeof( ((LPDEVMODEA)pOutDevMode)->dmDeviceName )-nLen ); - } - if( ((LPDEVMODEA)pOutDevMode)->dmSize >= 102 ) - { - sal_Int32 nLen = strlen( (const char*)((LPDEVMODEA)pOutDevMode)->dmFormName ); - if ( nLen < sizeof( ((LPDEVMODEA)pOutDevMode)->dmFormName ) ) - memset( ((LPDEVMODEA)pOutDevMode)->dmFormName+nLen, 0, sizeof( ((LPDEVMODEA)pOutDevMode)->dmFormName )-nLen ); - } + sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmFormName ); + if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )/sizeof(sal_Unicode) ) + memset( ((LPDEVMODEW)pOutDevMode)->dmFormName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )-(nLen*sizeof(sal_Unicode)) ); } // update data @@ -805,13 +489,12 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup // ----------------------------------------------------------------------- #define DECLARE_DEVMODE( i )\ - DEVMODEA* pDevModeA = SAL_DEVMODE_A(i);\ DEVMODEW* pDevModeW = SAL_DEVMODE_W(i);\ - if( pDevModeA == NULL && pDevModeW == NULL )\ + if( pDevModeW == NULL )\ return #define CHOOSE_DEVMODE(i)\ - (pDevModeW ? pDevModeW->i : pDevModeA->i) + (pDevModeW->i) static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, sal_uLong nFlags ) { @@ -1379,75 +1062,27 @@ static HDC ImplCreateICW_WithCatch( LPWSTR pDriver, return hDC; } -static HDC ImplCreateICA_WithCatch( char* pDriver, - char* pDevice, - LPDEVMODEA pDevMode ) -{ - HDC hDC = 0; - CATCH_DRIVER_EX_BEGIN; - hDC = CreateICA( pDriver, pDevice, 0, pDevMode ); - CATCH_DRIVER_EX_END_2( "exception in CreateICW" ); - return hDC; -} - - static HDC ImplCreateSalPrnIC( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData ) { HDC hDC = 0; - if( aSalShlData.mbWPrinter ) - { - LPDEVMODEW pDevMode; - if ( pSetupData && pSetupData->mpDriverData ) - pDevMode = SAL_DEVMODE_W( pSetupData ); - else - pDevMode = NULL; - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateIC, although declared const - so provide some space - // pl: does this hold true for Unicode functions ? - if( pPrinter->maDriverName.Len() > 2048 || pPrinter->maDeviceName.Len() > 2048 ) - return 0; - sal_Unicode pDriverName[ 4096 ]; - sal_Unicode pDeviceName[ 4096 ]; - rtl_copyMemory( pDriverName, pPrinter->maDriverName.GetBuffer(), pPrinter->maDriverName.Len()*sizeof(sal_Unicode)); - memset( pDriverName+pPrinter->maDriverName.Len(), 0, 32 ); - rtl_copyMemory( pDeviceName, pPrinter->maDeviceName.GetBuffer(), pPrinter->maDeviceName.Len()*sizeof(sal_Unicode)); - memset( pDeviceName+pPrinter->maDeviceName.Len(), 0, 32 ); - hDC = ImplCreateICW_WithCatch( reinterpret_cast< LPWSTR >(pDriverName), - reinterpret_cast< LPCWSTR >(pDeviceName), - pDevMode ); - } + LPDEVMODEW pDevMode; + if ( pSetupData && pSetupData->mpDriverData ) + pDevMode = SAL_DEVMODE_W( pSetupData ); else - { - LPDEVMODEA pDevMode; - if ( pSetupData && pSetupData->mpDriverData ) - pDevMode = SAL_DEVMODE_A( pSetupData ); - else - pDevMode = NULL; - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateIC, although declared const - so provide some space - ByteString aDriver ( ImplSalGetWinAnsiString( pPrinter->maDriverName, TRUE ) ); - ByteString aDevice ( ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ) ); - int n = aDriver.Len() > aDevice.Len() ? aDriver.Len() : aDevice.Len(); - // #125813# under some circumstances many printer drivers really - // seem to have a problem with the names and their conversions. - // We need to get on to of this, but haven't been able to reproduce - // the problem yet. Put the names on the stack so we get them - // with an eventual crash report. - if( n >= 2048 ) - return 0; - n += 2048; - char lpszDriverName[ 4096 ]; - char lpszDeviceName[ 4096 ]; - strncpy( lpszDriverName, aDriver.GetBuffer(), n ); - strncpy( lpszDeviceName, aDevice.GetBuffer(), n ); - // HDU: the crashes usually happen in a MBCS to unicode conversion, - // so I suspect the MBCS string's end is not properly recognized. - // The longest MBCS encoding I'm aware of has six bytes per code - // => add a couple of zeroes... - memset( lpszDriverName+aDriver.Len(), 0, 16 ); - memset( lpszDeviceName+aDevice.Len(), 0, 16 ); - hDC = ImplCreateICA_WithCatch( lpszDriverName, - lpszDeviceName, - pDevMode ); - } + pDevMode = NULL; + // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateIC, although declared const - so provide some space + // pl: does this hold true for Unicode functions ? + if( pPrinter->maDriverName.Len() > 2048 || pPrinter->maDeviceName.Len() > 2048 ) + return 0; + sal_Unicode pDriverName[ 4096 ]; + sal_Unicode pDeviceName[ 4096 ]; + rtl_copyMemory( pDriverName, pPrinter->maDriverName.GetBuffer(), pPrinter->maDriverName.Len()*sizeof(sal_Unicode)); + memset( pDriverName+pPrinter->maDriverName.Len(), 0, 32 ); + rtl_copyMemory( pDeviceName, pPrinter->maDeviceName.GetBuffer(), pPrinter->maDeviceName.Len()*sizeof(sal_Unicode)); + memset( pDeviceName+pPrinter->maDeviceName.Len(), 0, 32 ); + hDC = ImplCreateICW_WithCatch( reinterpret_cast< LPWSTR >(pDriverName), + reinterpret_cast< LPCWSTR >(pDeviceName), + pDevMode ); return hDC; } @@ -1567,28 +1202,14 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) pPaperSizes = (POINT*)rtl_allocateZeroMemory(nCount*sizeof(POINT)); ImplDeviceCaps( this, DC_PAPERSIZE, (BYTE*)pPaperSizes, pSetupData ); - if( aSalShlData.mbWPrinter ) + sal_Unicode* pNamesBuffer = (sal_Unicode*)rtl_allocateMemory(nCount*64*sizeof(sal_Unicode)); + ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData ); + for( DWORD i = 0; i < nCount; ++i ) { - sal_Unicode* pNamesBuffer = (sal_Unicode*)rtl_allocateMemory(nCount*64*sizeof(sal_Unicode)); - ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData ); - for( DWORD i = 0; i < nCount; ++i ) - { - PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10); - m_aPaperFormats.push_back( aInfo ); - } - rtl_freeMemory( pNamesBuffer ); - } - else - { - char* pNamesBuffer = (char*)rtl_allocateMemory(nCount*64); - ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData ); - for( DWORD i = 0; i < nCount; ++i ) - { - PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10); - m_aPaperFormats.push_back( aInfo ); - } - rtl_freeMemory( pNamesBuffer ); + PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10); + m_aPaperFormats.push_back( aInfo ); } + rtl_freeMemory( pNamesBuffer ); rtl_freeMemory( pPaperSizes ); } @@ -1683,22 +1304,11 @@ XubString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, sa DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, NULL, pSetupData ); if ( (nPaperBin < nBins) && (nBins != GDI_ERROR) ) { - if( aSalShlData.mbWPrinter ) - { - sal_Unicode* pBuffer = new sal_Unicode[nBins*24]; - DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, (BYTE*)pBuffer, pSetupData ); - if ( nRet && (nRet != GDI_ERROR) ) - aPaperBinName = pBuffer + (nPaperBin*24); - delete [] pBuffer; - } - else - { - char* pBuffer = new char[nBins*24]; - DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, (BYTE*)pBuffer, pSetupData ); - if ( nRet && (nRet != GDI_ERROR) ) - aPaperBinName = ImplSalGetUniString( (const char*)(pBuffer + (nPaperBin*24)) ); - delete [] pBuffer; - } + sal_Unicode* pBuffer = new sal_Unicode[nBins*24]; + DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, (BYTE*)pBuffer, pSetupData ); + if ( nRet && (nRet != GDI_ERROR) ) + aPaperBinName = pBuffer + (nPaperBin*24); + delete [] pBuffer; } return aPaperBinName; @@ -1832,29 +1442,6 @@ BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ ) // ----------------------------------------------------------------------- -static LPDEVMODEA ImplSalSetCopies( LPDEVMODEA pDevMode, sal_uLong nCopies, sal_Bool bCollate ) -{ - LPDEVMODEA pNewDevMode = pDevMode; - if ( pDevMode && (nCopies > 1) ) - { - if ( nCopies > 32765 ) - nCopies = 32765; - sal_uLong nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra; - pNewDevMode = (LPDEVMODEA)rtl_allocateMemory( nDevSize ); - memcpy( pNewDevMode, pDevMode, nDevSize ); - pDevMode = pNewDevMode; - pDevMode->dmFields |= DM_COPIES; - pDevMode->dmCopies = (short)(sal_uInt16)nCopies; - pDevMode->dmFields |= DM_COLLATE; - if ( bCollate ) - pDevMode->dmCollate = DMCOLLATE_TRUE; - else - pDevMode->dmCollate = DMCOLLATE_FALSE; - } - - return pNewDevMode; -} - static LPDEVMODEW ImplSalSetCopies( LPDEVMODEW pDevMode, sal_uLong nCopies, sal_Bool bCollate ) { LPDEVMODEW pNewDevMode = pDevMode; @@ -1951,15 +1538,6 @@ static int lcl_StartDocW( HDC hDC, DOCINFOW* pInfo, WinSalPrinter* pPrt ) return nRet; } -static int lcl_StartDocA( HDC hDC, DOCINFOA* pInfo, WinSalPrinter* pPrt ) -{ - int nRet = 0; - CATCH_DRIVER_EX_BEGIN; - nRet = ::StartDocA( hDC, pInfo ); - CATCH_DRIVER_EX_END( "exception in StartDocW", pPrt ); - return nRet; -} - sal_Bool WinSalPrinter::StartJob( const XubString* pFileName, const XubString& rJobName, const XubString&, @@ -1973,65 +1551,28 @@ sal_Bool WinSalPrinter::StartJob( const XubString* pFileName, mnCopies = nCopies; mbCollate = bCollate; - LPDEVMODEA pOrgDevModeA = NULL; - LPDEVMODEA pDevModeA = NULL; LPDEVMODEW pOrgDevModeW = NULL; LPDEVMODEW pDevModeW = NULL; HDC hDC = 0; - if( aSalShlData.mbWPrinter ) - { - if ( pSetupData && pSetupData->mpDriverData ) - { - pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); - pDevModeW = ImplSalSetCopies( pOrgDevModeW, nCopies, bCollate ); - } - else - pDevModeW = NULL; - - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateDC, although declared const - so provide some space - sal_Unicode aDrvBuf[4096]; - sal_Unicode aDevBuf[4096]; - rtl_copyMemory( aDrvBuf, mpInfoPrinter->maDriverName.GetBuffer(), (mpInfoPrinter->maDriverName.Len()+1)*sizeof(sal_Unicode)); - rtl_copyMemory( aDevBuf, mpInfoPrinter->maDeviceName.GetBuffer(), (mpInfoPrinter->maDeviceName.Len()+1)*sizeof(sal_Unicode)); - hDC = CreateDCW( reinterpret_cast<LPCWSTR>(aDrvBuf), - reinterpret_cast<LPCWSTR>(aDevBuf), - NULL, - pDevModeW ); - - if ( pDevModeW != pOrgDevModeW ) - rtl_freeMemory( pDevModeW ); - } - else + if ( pSetupData && pSetupData->mpDriverData ) { - if ( pSetupData && pSetupData->mpDriverData ) - { - pOrgDevModeA = SAL_DEVMODE_A( pSetupData ); - pDevModeA = ImplSalSetCopies( pOrgDevModeA, nCopies, bCollate ); - } - else - pDevModeA = NULL; - - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateDC, although declared const - so provide some space - ByteString aDriver ( ImplSalGetWinAnsiString( mpInfoPrinter->maDriverName, TRUE ) ); - ByteString aDevice ( ImplSalGetWinAnsiString( mpInfoPrinter->maDeviceName, TRUE ) ); - int n = aDriver.Len() > aDevice.Len() ? aDriver.Len() : aDevice.Len(); - n += 2048; - char *lpszDriverName = new char[n]; - char *lpszDeviceName = new char[n]; - strncpy( lpszDriverName, aDriver.GetBuffer(), n ); - strncpy( lpszDeviceName, aDevice.GetBuffer(), n ); - hDC = CreateDCA( lpszDriverName, - lpszDeviceName, - NULL, - pDevModeA ); - - delete [] lpszDriverName; - delete [] lpszDeviceName; - - if ( pDevModeA != pOrgDevModeA ) - rtl_freeMemory( pDevModeA ); + pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); + pDevModeW = ImplSalSetCopies( pOrgDevModeW, nCopies, bCollate ); } + // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateDC, although declared const - so provide some space + sal_Unicode aDrvBuf[4096]; + sal_Unicode aDevBuf[4096]; + rtl_copyMemory( aDrvBuf, mpInfoPrinter->maDriverName.GetBuffer(), (mpInfoPrinter->maDriverName.Len()+1)*sizeof(sal_Unicode)); + rtl_copyMemory( aDevBuf, mpInfoPrinter->maDeviceName.GetBuffer(), (mpInfoPrinter->maDeviceName.Len()+1)*sizeof(sal_Unicode)); + hDC = CreateDCW( reinterpret_cast<LPCWSTR>(aDrvBuf), + reinterpret_cast<LPCWSTR>(aDevBuf), + NULL, + pDevModeW ); + + if ( pDevModeW != pOrgDevModeW ) + rtl_freeMemory( pDevModeW ); + if ( !hDC ) { mnError = SAL_PRINTER_ERROR_GENERALERROR; @@ -2112,71 +1653,33 @@ sal_Bool WinSalPrinter::StartJob( const XubString* pFileName, } } - if( aSalShlData.mbWPrinter ) + DOCINFOW aInfo; + memset( &aInfo, 0, sizeof( DOCINFOW ) ); + aInfo.cbSize = sizeof( aInfo ); + aInfo.lpszDocName = (LPWSTR)rJobName.GetBuffer(); + if ( pFileName || aOutFileName.getLength() ) { - DOCINFOW aInfo; - memset( &aInfo, 0, sizeof( DOCINFOW ) ); - aInfo.cbSize = sizeof( aInfo ); - aInfo.lpszDocName = (LPWSTR)rJobName.GetBuffer(); - if ( pFileName || aOutFileName.getLength() ) + if ( (pFileName && pFileName->Len()) || aOutFileName.getLength() ) { - if ( (pFileName && pFileName->Len()) || aOutFileName.getLength() ) - { - aInfo.lpszOutput = (LPWSTR)( (pFileName && pFileName->Len()) ? pFileName->GetBuffer() : aOutFileName.getStr()); - } - else - aInfo.lpszOutput = L"FILE:"; + aInfo.lpszOutput = (LPWSTR)( (pFileName && pFileName->Len()) ? pFileName->GetBuffer() : aOutFileName.getStr()); } else - aInfo.lpszOutput = NULL; - - // start Job - int nRet = lcl_StartDocW( hDC, &aInfo, this ); - - if ( nRet <= 0 ) - { - long nError = GetLastError(); - if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (nError == ERROR_PRINT_CANCELLED) || (nError == ERROR_CANCELLED) ) - mnError = SAL_PRINTER_ERROR_ABORT; - else - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return FALSE; - } + aInfo.lpszOutput = L"FILE:"; } else + aInfo.lpszOutput = NULL; + + // start Job + int nRet = lcl_StartDocW( hDC, &aInfo, this ); + + if ( nRet <= 0 ) { - // Both strings must exist, if StartJob() is called - ByteString aJobName( ImplSalGetWinAnsiString( rJobName, TRUE ) ); - ByteString aFileName; - - DOCINFOA aInfo; - memset( &aInfo, 0, sizeof( DOCINFOA ) ); - aInfo.cbSize = sizeof( aInfo ); - aInfo.lpszDocName = (LPCSTR)aJobName.GetBuffer(); - if ( pFileName || aOutFileName.getLength() ) - { - if ( pFileName->Len() || aOutFileName.getLength() ) - { - aFileName = ImplSalGetWinAnsiString( pFileName ? *pFileName : static_cast<const XubString>(aOutFileName), TRUE ); - aInfo.lpszOutput = (LPCSTR)aFileName.GetBuffer(); - } - else - aInfo.lpszOutput = "FILE:"; - } + long nError = GetLastError(); + if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (nError == ERROR_PRINT_CANCELLED) || (nError == ERROR_CANCELLED) ) + mnError = SAL_PRINTER_ERROR_ABORT; else - aInfo.lpszOutput = NULL; - - // start Job - int nRet = lcl_StartDocA( hDC, &aInfo, this ); - if ( nRet <= 0 ) - { - long nError = GetLastError(); - if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (nError == ERROR_PRINT_CANCELLED) || (nError == ERROR_CANCELLED) ) - mnError = SAL_PRINTER_ERROR_ABORT; - else - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return FALSE; - } + mnError = SAL_PRINTER_ERROR_GENERALERROR; + return FALSE; } return TRUE; @@ -2285,26 +1788,13 @@ SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJo HDC hDC = mhDC; if ( pSetupData && pSetupData->mpDriverData && bNewJobData ) { - if( aSalShlData.mbWPrinter ) - { - LPDEVMODEW pOrgDevModeW; - LPDEVMODEW pDevModeW; - pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); - pDevModeW = ImplSalSetCopies( pOrgDevModeW, mnCopies, mbCollate ); - ResetDCW( hDC, pDevModeW ); - if ( pDevModeW != pOrgDevModeW ) - rtl_freeMemory( pDevModeW ); - } - else - { - LPDEVMODEA pOrgDevModeA; - LPDEVMODEA pDevModeA; - pOrgDevModeA = SAL_DEVMODE_A( pSetupData ); - pDevModeA = ImplSalSetCopies( pOrgDevModeA, mnCopies, mbCollate ); - ResetDCA( hDC, pDevModeA ); - if ( pDevModeA != pOrgDevModeA ) - rtl_freeMemory( pDevModeA ); - } + LPDEVMODEW pOrgDevModeW; + LPDEVMODEW pDevModeW; + pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); + pDevModeW = ImplSalSetCopies( pOrgDevModeW, mnCopies, mbCollate ); + ResetDCW( hDC, pDevModeW ); + if ( pDevModeW != pOrgDevModeW ) + rtl_freeMemory( pDevModeW ); } int nRet = 0; CATCH_DRIVER_EX_BEGIN; diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index 564a50d71ebb..564a50d71ebb 100755..100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index ec4917f4201a..6eb423f72cf6 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -57,8 +57,8 @@ #define USE_UNISCRIBE #ifdef USE_UNISCRIBE -#include <Usp10.h> -#include <ShLwApi.h> +#include <usp10.h> +#include <shlwapi.h> #include <winver.h> #endif // USE_UNISCRIBE @@ -2807,7 +2807,7 @@ private: grutils::GrFeatureParser * mpFeatures; mutable GraphiteLayoutWinImpl maImpl; public: - GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE); + GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE) throw(); // used by upper layers virtual bool LayoutText( ImplLayoutArgs& ); // first step of layout diff --git a/vcl/win/source/src/salsrc.rc b/vcl/win/source/src/salsrc.rc index 11b967ff475b..147b80fc3e8c 100755..100644 --- a/vcl/win/source/src/salsrc.rc +++ b/vcl/win/source/src/salsrc.rc @@ -1,3 +1,4 @@ +/* -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,94 +29,94 @@ // for WINVER #include <windows.h> -#ifndef _SV_SALIDS_HRC #include <win/salids.hrc> -#endif -SAL_RESID_POINTER_NULL CURSOR NULLPTR.CUR +SAL_RESID_POINTER_NULL CURSOR nullptr.cur #if ( WINVER < 0x0400 ) -SAL_RESID_POINTER_HELP CURSOR HELP.CUR +SAL_RESID_POINTER_HELP CURSOR help.cur #endif #ifndef WNT -SAL_RESID_POINTER_HSIZE CURSOR HSIZE.CUR -SAL_RESID_POINTER_VSIZE CURSOR VSIZE.CUR -SAL_RESID_POINTER_NESWSIZE CURSOR NESWSIZE.CUR -SAL_RESID_POINTER_NWSESIZE CURSOR NWSESIZE.CUR +SAL_RESID_POINTER_HSIZE CURSOR hsize.cur +SAL_RESID_POINTER_VSIZE CURSOR vsize.cur +SAL_RESID_POINTER_NESWSIZE CURSOR neswsize.cur +SAL_RESID_POINTER_NWSESIZE CURSOR nwsesize.cur #endif -SAL_RESID_POINTER_CROSS CURSOR CROSS.CUR -SAL_RESID_POINTER_MOVE CURSOR MOVE.CUR -SAL_RESID_POINTER_HSPLIT CURSOR HSPLIT.CUR -SAL_RESID_POINTER_VSPLIT CURSOR VSPLIT.CUR -SAL_RESID_POINTER_HSIZEBAR CURSOR HSIZEBAR.CUR -SAL_RESID_POINTER_VSIZEBAR CURSOR VSIZEBAR.CUR -SAL_RESID_POINTER_HAND CURSOR HAND.CUR -SAL_RESID_POINTER_REFHAND CURSOR REFHAND.CUR -SAL_RESID_POINTER_PEN CURSOR PEN.CUR -SAL_RESID_POINTER_MAGNIFY CURSOR MAGNIFY.CUR -SAL_RESID_POINTER_FILL CURSOR FILL.CUR -SAL_RESID_POINTER_ROTATE CURSOR ROTATE.CUR -SAL_RESID_POINTER_HSHEAR CURSOR HSHEAR.CUR -SAL_RESID_POINTER_VSHEAR CURSOR VSHEAR.CUR -SAL_RESID_POINTER_MIRROR CURSOR MIRROR.CUR -SAL_RESID_POINTER_CROOK CURSOR CROOK.CUR -SAL_RESID_POINTER_CROP CURSOR CROP.CUR -SAL_RESID_POINTER_MOVEPOINT CURSOR MOVEPT.CUR -SAL_RESID_POINTER_MOVEBEZIERWEIGHT CURSOR MOVEBW.CUR -SAL_RESID_POINTER_MOVEDATA CURSOR MOVEDATA.CUR -SAL_RESID_POINTER_COPYDATA CURSOR COPYDATA.CUR -SAL_RESID_POINTER_LINKDATA CURSOR LINKDATA.CUR -SAL_RESID_POINTER_MOVEDATALINK CURSOR MOVEDLNK.CUR -SAL_RESID_POINTER_COPYDATALINK CURSOR COPYDLNK.CUR -SAL_RESID_POINTER_MOVEFILE CURSOR MOVEF.CUR -SAL_RESID_POINTER_COPYFILE CURSOR COPYF.CUR -SAL_RESID_POINTER_LINKFILE CURSOR LINKF.CUR -SAL_RESID_POINTER_MOVEFILELINK CURSOR MOVEFLNK.CUR -SAL_RESID_POINTER_COPYFILELINK CURSOR COPYFLNK.CUR -SAL_RESID_POINTER_MOVEFILES CURSOR MOVEF2.CUR -SAL_RESID_POINTER_COPYFILES CURSOR COPYF2.CUR -SAL_RESID_POINTER_NOTALLOWED CURSOR NOTALLOW.CUR -SAL_RESID_POINTER_DRAW_LINE CURSOR DLINE.CUR -SAL_RESID_POINTER_DRAW_RECT CURSOR DRECT.CUR -SAL_RESID_POINTER_DRAW_POLYGON CURSOR DPOLYGON.CUR -SAL_RESID_POINTER_DRAW_BEZIER CURSOR DBEZIER.CUR -SAL_RESID_POINTER_DRAW_ARC CURSOR DARC.CUR -SAL_RESID_POINTER_DRAW_PIE CURSOR DPIE.CUR -SAL_RESID_POINTER_DRAW_CIRCLECUT CURSOR DCIRCCUT.CUR -SAL_RESID_POINTER_DRAW_ELLIPSE CURSOR DELLIPSE.CUR -SAL_RESID_POINTER_DRAW_FREEHAND CURSOR DFREE.CUR -SAL_RESID_POINTER_DRAW_CONNECT CURSOR DCONNECT.CUR -SAL_RESID_POINTER_DRAW_TEXT CURSOR DTEXT.CUR -SAL_RESID_POINTER_DRAW_CAPTION CURSOR DCAPT.CUR -SAL_RESID_POINTER_CHART CURSOR CHART.CUR -SAL_RESID_POINTER_DETECTIVE CURSOR DETECTIV.CUR -SAL_RESID_POINTER_PIVOT_COL CURSOR PIVOTCOL.CUR -SAL_RESID_POINTER_PIVOT_ROW CURSOR PIVOTROW.CUR -SAL_RESID_POINTER_PIVOT_FIELD CURSOR PIVOTFLD.CUR -SAL_RESID_POINTER_PIVOT_DELETE CURSOR PIVOTDEL.CUR -SAL_RESID_POINTER_CHAIN CURSOR CHAIN.CUR -SAL_RESID_POINTER_CHAIN_NOTALLOWED CURSOR CHAINNOT.CUR -SAL_RESID_POINTER_TIMEEVENT_MOVE CURSOR TIMEMOVE.CUR -SAL_RESID_POINTER_TIMEEVENT_SIZE CURSOR TIMESIZE.CUR -SAL_RESID_POINTER_AUTOSCROLL_N CURSOR ASN.CUR -SAL_RESID_POINTER_AUTOSCROLL_S CURSOR ASS.CUR -SAL_RESID_POINTER_AUTOSCROLL_W CURSOR ASW.CUR -SAL_RESID_POINTER_AUTOSCROLL_E CURSOR ASE.CUR -SAL_RESID_POINTER_AUTOSCROLL_NW CURSOR ASNW.CUR -SAL_RESID_POINTER_AUTOSCROLL_NE CURSOR ASNE.CUR -SAL_RESID_POINTER_AUTOSCROLL_SW CURSOR ASSW.CUR -SAL_RESID_POINTER_AUTOSCROLL_SE CURSOR ASSE.CUR -SAL_RESID_POINTER_AUTOSCROLL_NS CURSOR ASNS.CUR -SAL_RESID_POINTER_AUTOSCROLL_WE CURSOR ASWE.CUR -SAL_RESID_POINTER_AUTOSCROLL_NSWE CURSOR ASNSWE.CUR -SAL_RESID_POINTER_AIRBRUSH CURSOR AIRBRUSH.CUR -SAL_RESID_POINTER_TEXT_VERTICAL CURSOR VTEXT.CUR -SAL_RESID_POINTER_TAB_SELECT_S CURSOR TBLSELS.CUR -SAL_RESID_POINTER_TAB_SELECT_E CURSOR TBLSELE.CUR -SAL_RESID_POINTER_TAB_SELECT_SE CURSOR TBLSELSE.CUR -SAL_RESID_POINTER_TAB_SELECT_W CURSOR TBLSELW.CUR -SAL_RESID_POINTER_TAB_SELECT_SW CURSOR TBLSELSW.CUR -SAL_RESID_POINTER_PAINTBRUSH CURSOR PNTBRSH.CUR +SAL_RESID_POINTER_CROSS CURSOR cross.cur +SAL_RESID_POINTER_MOVE CURSOR move.cur +SAL_RESID_POINTER_HSPLIT CURSOR hsplit.cur +SAL_RESID_POINTER_VSPLIT CURSOR vsplit.cur +SAL_RESID_POINTER_HSIZEBAR CURSOR hsizebar.cur +SAL_RESID_POINTER_VSIZEBAR CURSOR vsizebar.cur +SAL_RESID_POINTER_HAND CURSOR hand.cur +SAL_RESID_POINTER_REFHAND CURSOR refhand.cur +SAL_RESID_POINTER_PEN CURSOR pen.cur +SAL_RESID_POINTER_MAGNIFY CURSOR magnify.cur +SAL_RESID_POINTER_FILL CURSOR fill.cur +SAL_RESID_POINTER_ROTATE CURSOR rotate.cur +SAL_RESID_POINTER_HSHEAR CURSOR hshear.cur +SAL_RESID_POINTER_VSHEAR CURSOR vshear.cur +SAL_RESID_POINTER_MIRROR CURSOR mirror.cur +SAL_RESID_POINTER_CROOK CURSOR crook.cur +SAL_RESID_POINTER_CROP CURSOR crop.cur +SAL_RESID_POINTER_MOVEPOINT CURSOR movept.cur +SAL_RESID_POINTER_MOVEBEZIERWEIGHT CURSOR movebw.cur +SAL_RESID_POINTER_MOVEDATA CURSOR movedata.cur +SAL_RESID_POINTER_COPYDATA CURSOR copydata.cur +SAL_RESID_POINTER_LINKDATA CURSOR linkdata.cur +SAL_RESID_POINTER_MOVEDATALINK CURSOR movedlnk.cur +SAL_RESID_POINTER_COPYDATALINK CURSOR copydlnk.cur +SAL_RESID_POINTER_MOVEFILE CURSOR movef.cur +SAL_RESID_POINTER_COPYFILE CURSOR copyf.cur +SAL_RESID_POINTER_LINKFILE CURSOR linkf.cur +SAL_RESID_POINTER_MOVEFILELINK CURSOR moveflnk.cur +SAL_RESID_POINTER_COPYFILELINK CURSOR copyflnk.cur +SAL_RESID_POINTER_MOVEFILES CURSOR movef2.cur +SAL_RESID_POINTER_COPYFILES CURSOR copyf2.cur +SAL_RESID_POINTER_NOTALLOWED CURSOR notallow.cur +SAL_RESID_POINTER_DRAW_LINE CURSOR dline.cur +SAL_RESID_POINTER_DRAW_RECT CURSOR drect.cur +SAL_RESID_POINTER_DRAW_POLYGON CURSOR dpolygon.cur +SAL_RESID_POINTER_DRAW_BEZIER CURSOR dbezier.cur +SAL_RESID_POINTER_DRAW_ARC CURSOR darc.cur +SAL_RESID_POINTER_DRAW_PIE CURSOR dpie.cur +SAL_RESID_POINTER_DRAW_CIRCLECUT CURSOR dcirccut.cur +SAL_RESID_POINTER_DRAW_ELLIPSE CURSOR dellipse.cur +SAL_RESID_POINTER_DRAW_FREEHAND CURSOR dfree.cur +SAL_RESID_POINTER_DRAW_CONNECT CURSOR dconnect.cur +SAL_RESID_POINTER_DRAW_TEXT CURSOR dtext.cur +SAL_RESID_POINTER_DRAW_CAPTION CURSOR dcapt.cur +SAL_RESID_POINTER_CHART CURSOR chart.cur +SAL_RESID_POINTER_DETECTIVE CURSOR detectiv.cur +SAL_RESID_POINTER_PIVOT_COL CURSOR pivotcol.cur +SAL_RESID_POINTER_PIVOT_ROW CURSOR pivotrow.cur +SAL_RESID_POINTER_PIVOT_FIELD CURSOR pivotfld.cur +SAL_RESID_POINTER_PIVOT_DELETE CURSOR pivotdel.cur +SAL_RESID_POINTER_CHAIN CURSOR chain.cur +SAL_RESID_POINTER_CHAIN_NOTALLOWED CURSOR chainnot.cur +SAL_RESID_POINTER_TIMEEVENT_MOVE CURSOR timemove.cur +SAL_RESID_POINTER_TIMEEVENT_SIZE CURSOR timesize.cur +SAL_RESID_POINTER_AUTOSCROLL_N CURSOR asn.cur +SAL_RESID_POINTER_AUTOSCROLL_S CURSOR ass.cur +SAL_RESID_POINTER_AUTOSCROLL_W CURSOR asw.cur +SAL_RESID_POINTER_AUTOSCROLL_E CURSOR ase.cur +SAL_RESID_POINTER_AUTOSCROLL_NW CURSOR asnw.cur +SAL_RESID_POINTER_AUTOSCROLL_NE CURSOR asne.cur +SAL_RESID_POINTER_AUTOSCROLL_SW CURSOR assw.cur +SAL_RESID_POINTER_AUTOSCROLL_SE CURSOR asse.cur +SAL_RESID_POINTER_AUTOSCROLL_NS CURSOR asns.cur +SAL_RESID_POINTER_AUTOSCROLL_WE CURSOR aswe.cur +SAL_RESID_POINTER_AUTOSCROLL_NSWE CURSOR asnswe.cur +SAL_RESID_POINTER_AIRBRUSH CURSOR airbrush.cur +SAL_RESID_POINTER_TEXT_VERTICAL CURSOR vtext.cur +SAL_RESID_POINTER_TAB_SELECT_S CURSOR tblsels.cur +SAL_RESID_POINTER_TAB_SELECT_E CURSOR tblsele.cur +SAL_RESID_POINTER_TAB_SELECT_SE CURSOR tblselse.cur +SAL_RESID_POINTER_TAB_SELECT_W CURSOR tblselw.cur +SAL_RESID_POINTER_TAB_SELECT_SW CURSOR tblselsw.cur +SAL_RESID_POINTER_PAINTBRUSH CURSOR pntbrsh.cur + +SAL_RESID_BITMAP_50 BITMAP "50.bmp" -SAL_RESID_BITMAP_50 BITMAP 50.BMP +SAL_RESID_ICON_DEFAULT ICON sd.ico -SAL_RESID_ICON_DEFAULT ICON SD.ICO +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 9ed173ee6170..80051f321eac 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -48,9 +48,6 @@ #include <stdio.h> #include <svsys.h> -#ifdef __MINGW32__ -#include <excpt.h> -#endif #include <rtl/string.h> #include <rtl/ustring.h> @@ -100,6 +97,10 @@ using ::std::max; #include <time.h> +#ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -107,30 +108,20 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; -// The following defines are newly added in Longhorn -#ifndef WM_MOUSEHWHEEL -# define WM_MOUSEHWHEEL 0x020E -#endif #ifndef SPI_GETWHEELSCROLLCHARS # define SPI_GETWHEELSCROLLCHARS 0x006C #endif #ifndef SPI_SETWHEELSCROLLCHARS # define SPI_SETWHEELSCROLLCHARS 0x006D #endif - - +#ifndef WM_MOUSEHWHEEL +# define WM_MOUSEHWHEEL 0x020E +#endif #if OSL_DEBUG_LEVEL > 1 void MyOutputDebugString( char *s) { OutputDebugString( s ); } #endif -// misssing prototypes and constants for LayeredWindows -extern "C" { - //WINUSERAPI sal_Bool WINAPI SetLayeredWindowAttributes(HWND,COLORREF,BYTE,DWORD); - typedef sal_Bool ( WINAPI * SetLayeredWindowAttributes_Proc_T ) (HWND,COLORREF,BYTE,DWORD); - static SetLayeredWindowAttributes_Proc_T lpfnSetLayeredWindowAttributes; -}; - // ======================================================================= const unsigned int WM_USER_SYSTEM_WINDOW_ACTIVATED = RegisterWindowMessageA("SYSTEM_WINDOW_ACTIVATED"); @@ -139,18 +130,6 @@ sal_Bool WinSalFrame::mbInReparent = FALSE; // ======================================================================= -// Wegen Fehler in Windows-Headerfiles -#ifndef IMN_OPENCANDIDATE -#define IMN_OPENCANDIDATE 0x0005 -#endif -#ifndef IMN_CLOSECANDIDATE -#define IMN_CLOSECANDIDATE 0x0004 -#endif - -#ifndef WM_THEMECHANGED -#define WM_THEMECHANGED 0x031A -#endif - // Macros for support of WM_UNICHAR & Keyman 6.0 #define Uni_UTF32ToSurrogate1(ch) (((unsigned long) (ch) - 0x10000) / 0x400 + 0xD800) #define Uni_UTF32ToSurrogate2(ch) (((unsigned long) (ch) - 0x10000) % 0x400 + 0xDC00) @@ -232,9 +211,6 @@ static void ImplSaveFrameState( WinSalFrame* pFrame ) // if pParentRect is set, the workarea of the monitor that contains pParentRect is returned void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ) { - static int winVerChecked = 0; - static int winVerOk = 0; - // check if we or our parent is fullscreen, then the taskbar should be ignored bool bIgnoreTaskbar = false; WinSalFrame* pFrame = GetWindowPtr( hWnd ); @@ -254,96 +230,64 @@ void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ) } } - if( !winVerChecked ) + // calculates the work area taking multiple monitors into account + static int nMonitors = GetSystemMetrics( SM_CMONITORS ); + if( nMonitors == 1 ) { - winVerChecked = 1; - winVerOk = 1; - - // multi monitor calls not available on Win95/NT - if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) - { - if ( aSalShlData.maVersionInfo.dwMajorVersion <= 4 ) - winVerOk = 0; // NT - } - else if( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) + if( bIgnoreTaskbar ) { - if ( aSalShlData.maVersionInfo.dwMajorVersion == 4 && aSalShlData.maVersionInfo.dwMinorVersion == 0 ) - winVerOk = 0; // Win95 + pRect->left = pRect->top = 0; + pRect->right = GetSystemMetrics( SM_CXSCREEN ); + pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); } + else + SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); } - - // calculates the work area taking multiple monitors into account - if( winVerOk ) + else { - static int nMonitors = GetSystemMetrics( SM_CMONITORS ); - if( nMonitors == 1 ) + if( pParentRect != NULL ) { - if( bIgnoreTaskbar ) - { - pRect->left = pRect->top = 0; - pRect->right = GetSystemMetrics( SM_CXSCREEN ); - pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); - } + // return the size of the monitor where pParentRect lives + HMONITOR hMonitor; + MONITORINFO mi; + + // get the nearest monitor to the passed rect. + hMonitor = MonitorFromRect(pParentRect, MONITOR_DEFAULTTONEAREST); + + // get the work area or entire monitor rect. + mi.cbSize = sizeof(mi); + GetMonitorInfo(hMonitor, &mi); + if( !bIgnoreTaskbar ) + *pRect = mi.rcWork; else - SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); + *pRect = mi.rcMonitor; } else { - if( pParentRect != NULL ) + // return the union of all monitors + pRect->left = GetSystemMetrics( SM_XVIRTUALSCREEN ); + pRect->top = GetSystemMetrics( SM_YVIRTUALSCREEN ); + pRect->right = pRect->left + GetSystemMetrics( SM_CXVIRTUALSCREEN ); + pRect->bottom = pRect->top + GetSystemMetrics( SM_CYVIRTUALSCREEN ); + + // virtualscreen does not take taskbar into account, so use the corresponding + // diffs between screen and workarea from the default screen + // however, this is still not perfect: the taskbar might not be on the primary screen + if( !bIgnoreTaskbar ) { - // return the size of the monitor where pParentRect lives - HMONITOR hMonitor; - MONITORINFO mi; - - // get the nearest monitor to the passed rect. - hMonitor = MonitorFromRect(pParentRect, MONITOR_DEFAULTTONEAREST); - - // get the work area or entire monitor rect. - mi.cbSize = sizeof(mi); - GetMonitorInfo(hMonitor, &mi); - if( !bIgnoreTaskbar ) - *pRect = mi.rcWork; - else - *pRect = mi.rcMonitor; + RECT wRect, scrRect; + SystemParametersInfo( SPI_GETWORKAREA, 0, &wRect, 0 ); + scrRect.left = 0; + scrRect.top = 0; + scrRect.right = GetSystemMetrics( SM_CXSCREEN ); + scrRect.bottom = GetSystemMetrics( SM_CYSCREEN ); + + pRect->left += wRect.left; + pRect->top += wRect.top; + pRect->right -= scrRect.right - wRect.right; + pRect->bottom -= scrRect.bottom - wRect.bottom; } - else - { - // return the union of all monitors - pRect->left = GetSystemMetrics( SM_XVIRTUALSCREEN ); - pRect->top = GetSystemMetrics( SM_YVIRTUALSCREEN ); - pRect->right = pRect->left + GetSystemMetrics( SM_CXVIRTUALSCREEN ); - pRect->bottom = pRect->top + GetSystemMetrics( SM_CYVIRTUALSCREEN ); - - // virtualscreen does not take taskbar into account, so use the corresponding - // diffs between screen and workarea from the default screen - // however, this is still not perfect: the taskbar might not be on the primary screen - if( !bIgnoreTaskbar ) - { - RECT wRect, scrRect; - SystemParametersInfo( SPI_GETWORKAREA, 0, &wRect, 0 ); - scrRect.left = 0; - scrRect.top = 0; - scrRect.right = GetSystemMetrics( SM_CXSCREEN ); - scrRect.bottom = GetSystemMetrics( SM_CYSCREEN ); - - pRect->left += wRect.left; - pRect->top += wRect.top; - pRect->right -= scrRect.right - wRect.right; - pRect->bottom -= scrRect.bottom - wRect.bottom; - } - } - } - } - else - { - if( bIgnoreTaskbar ) - { - pRect->left = pRect->top = 0; - pRect->right = GetSystemMetrics( SM_CXSCREEN ); - pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); } - else - SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); } } @@ -361,24 +305,6 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, if( getenv( "SAL_SYNCHRONIZE" ) ) // no buffering of drawing commands GdiSetBatchLimit( 1 ); - static int bLayeredAPI = -1; - if( bLayeredAPI == -1 ) - { - bLayeredAPI = 0; - // check for W2k and XP - if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && aSalShlData.maVersionInfo.dwMajorVersion >= 5 ) - { - OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM( "user32" ) ); - oslModule pLib = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); - oslGenericFunction pFunc = NULL; - if( pLib ) - pFunc = osl_getAsciiFunctionSymbol( pLib, "SetLayeredWindowAttributes" ); - - lpfnSetLayeredWindowAttributes = ( SetLayeredWindowAttributes_Proc_T ) pFunc; - - bLayeredAPI = pFunc ? 1 : 0; - } - } static const char* pEnvTransparentFloats = getenv("SAL_TRANSPARENT_FLOATS" ); // determine creation data @@ -449,7 +375,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, { pFrame->mbNoIcon = TRUE; nExSysStyle |= WS_EX_TOOLWINDOW; - if ( pEnvTransparentFloats && bLayeredAPI == 1 /*&& !(nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE) */) + if ( pEnvTransparentFloats /*&& !(nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE) */) nExSysStyle |= WS_EX_LAYERED; } } @@ -458,7 +384,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, nExSysStyle |= WS_EX_TOOLWINDOW; pFrame->mbFloatWin = TRUE; - if ( (bLayeredAPI == 1) && (pEnvTransparentFloats /* does not work remote! || (nSalFrameStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) */ ) ) + if ( (pEnvTransparentFloats /* does not work remote! || (nSalFrameStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) */ ) ) nExSysStyle |= WS_EX_LAYERED; } @@ -528,8 +454,8 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, 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*/ ); + if( GetWindowExStyle( hWnd ) & WS_EX_LAYERED ) + SetLayeredWindowAttributes( hWnd, 0, 230, 0x00000002 /*LWA_ALPHA*/ ); #endif if ( !hWnd ) { @@ -794,8 +720,7 @@ static UINT ImplSalGetWheelScrollChars() { // Depending on Windows version, use proper default or 1 (when // driver emulates hscroll) - if( VER_PLATFORM_WIN32_NT == aSalShlData.maVersionInfo.dwPlatformId && - aSalShlData.maVersionInfo.dwMajorVersion < 6 ) + if( aSalShlData.maVersionInfo.dwMajorVersion < 6 ) { // Windows 2000 & WinXP : emulating driver, use step size // of 1 @@ -5274,7 +5199,11 @@ static void ImplHandleInputLangChange( HWND hWnd, WPARAM, LPARAM lParam ) // Feststellen, ob wir IME unterstuetzen WinSalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame && pFrame->mbIME && pFrame->mhDefIMEContext ) + + if ( !pFrame ) + return; + + if ( pFrame->mbIME && pFrame->mhDefIMEContext ) { HKL hKL = (HKL)lParam; UINT nImeProps = ImmGetProperty( hKL, IGP_PROPERTY ); diff --git a/vcl/win/source/window/salobj.cxx b/vcl/win/source/window/salobj.cxx index f79ad89fff45..f79ad89fff45 100755..100644 --- a/vcl/win/source/window/salobj.cxx +++ b/vcl/win/source/window/salobj.cxx diff --git a/vcl/workben/makefile.mk b/vcl/workben/makefile.mk index d52737507a20..810b1fb42a00 100644 --- a/vcl/workben/makefile.mk +++ b/vcl/workben/makefile.mk @@ -49,6 +49,10 @@ OBJFILES= \ # --- Targets ------------------------------------------------------ +.IF "$(OS)" == "IOS" +CFLAGS += -x objective-c++ -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 +.ENDIF + # svdem APP1NOSAL= TRUE diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx index 4898aed1a995..ee5cbb2ba420 100644 --- a/vcl/workben/svdem.cxx +++ b/vcl/workben/svdem.cxx @@ -51,7 +51,7 @@ void Main(); // ----------------------------------------------------------------------- -SAL_IMPLEMENT_MAIN() +SAL_IMPLEMENT_MAIN_WITH_GUI() { tools::extendApplicationEnvironment(); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 547660fa1e1e..3c75c643fe4a 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -56,7 +56,7 @@ void Main(); // ----------------------------------------------------------------------- -SAL_IMPLEMENT_MAIN() +SAL_IMPLEMENT_MAIN_WITH_GUI() { tools::extendApplicationEnvironment(); |